Re: Command to list all revisions (with date?) when a particular was modified?

Nathan Hartman <[email protected]>
Newsgroups gmane.comp.version-control.subversion.user
Message-ID <CAJT2EHoap_4muUZr_yuSs11AX-ymau3gBnNi63ySwfijHbMA-w@mail.gmail.com>
On Mon, Nov 6, 2023 at 1:34 PM Bo Berglund <[email protected]> wrote:
>
> I am hunting for when a particular change was made in a file under version
> control. It happened years ago.
>
> The versioning system was migrated from CVSNT to Subversion back in 2017 and the
> old CVS repository was imported into SVN with all branches and tags etc
> available.
>
> The change I am looking for should have happened back in 2004 when the property
> behind what I am hunting for was changed but I cannot find any message about
> this in my archives...
>
> So now I am looking for *when* a particular section of a source file was changed
> so I would like to list all revisions when this file had a commit to it at all.
>
> Then I will extract the revisions in a binary fashion to find when exactly the
> change that should have been done in 2004 was actually done.
>
> Can this be done somehow using the command line interface to svn?
> If so what would be the correct command to issue?
>
>
> I need to get a list of the revisions where the file was changed.
>
> I tried reading the redbean documentation on line but I am not sure I understand
> the way the export works for different revisions of the same file.
>
> The way I understand svn the revision when you export/checkout a file at a
> specific rev number is the file as it existed at the time that revision was
> committed. So even if the file did not change during that revision there will be
> an exported file if I use the -r argument, right?
>
> So I need to start by some command to give me the revision numbers when the
> specific file *actually changed*. So I can focus on the commits when this file
> changed instead of getting lots of the same file because the revisions were done
> because something else changed..
>
> Can that be done?
>
> --
> Bo Berglund
> Developer in Sweden
>


Some things that might be helpful:

(1) The '--quiet' (or '-q') switch to 'svn log', together with the
<path> as mentioned by Robert, e.g.,:

$ svn log --quiet <path>

Using the INSTALL file in a working copy of Subversion's sources as an example:

$ svn log --quiet INSTALL

------------------------------------------------------------------------
r1911278 | hartmannathan | 2023-07-25 23:25:21 -0400 (Tue, 25 Jul 2023)
------------------------------------------------------------------------
r1905955 | kotkov | 2022-12-13 04:49:29 -0500 (Tue, 13 Dec 2022)
------------------------------------------------------------------------
r1903577 | hartmannathan | 2022-08-19 12:31:35 -0400 (Fri, 19 Aug 2022)
------------------------------------------------------------------------
r1899399 | hartmannathan | 2022-03-30 17:26:30 -0400 (Wed, 30 Mar 2022)
------------------------------------------------------------------------
r1894501 | dsahlberg | 2021-10-23 03:20:35 -0400 (Sat, 23 Oct 2021)
------------------------------------------------------------------------
r1894491 | dsahlberg | 2021-10-22 14:43:24 -0400 (Fri, 22 Oct 2021)
------------------------------------------------------------------------
r1881958 | julianfoad | 2020-09-23 11:04:31 -0400 (Wed, 23 Sep 2020)
------------------------------------------------------------------------
r1877960 | futatuki | 2020-05-20 14:58:15 -0400 (Wed, 20 May 2020)
------------------------------------------------------------------------
(snip some 600 lines)
------------------------------------------------------------------------
r840117 | kevin | 2001-09-05 09:59:27 -0400 (Wed, 05 Sep 2001)
------------------------------------------------------------------------
r840082 | kfogel | 2001-08-31 02:15:13 -0400 (Fri, 31 Aug 2001)
------------------------------------------------------------------------
r840068 | kfogel | 2001-08-30 23:22:56 -0400 (Thu, 30 Aug 2001)
------------------------------------------------------------------------
r839979 | kfogel | 2001-08-16 17:03:09 -0400 (Thu, 16 Aug 2001)
------------------------------------------------------------------------
r839944 | kfogel | 2001-08-14 20:28:37 -0400 (Tue, 14 Aug 2001)
------------------------------------------------------------------------
r839943 | kfogel | 2001-08-14 20:23:24 -0400 (Tue, 14 Aug 2001)
------------------------------------------------------------------------
r839929 | kfogel | 2001-08-13 20:54:08 -0400 (Mon, 13 Aug 2001)
------------------------------------------------------------------------
r839536 | kfogel | 2001-06-15 13:00:25 -0400 (Fri, 15 Jun 2001)
------------------------------------------------------------------------
r836593 | kfogel | 2000-06-06 13:47:11 -0400 (Tue, 06 Jun 2000)
------------------------------------------------------------------------

(2) The '--revision' (or '-r') switch with a {DATE} (or {DATE}:{DATE}
range) instead of a revision number. For example, with the same
INSTALL file, if I want to see the changes made in 2014:

$ svn log --quiet --revision {2014-01-01}:{2014-12-31} INSTALL
------------------------------------------------------------------------
r1572339 | breser | 2014-02-26 18:21:34 -0500 (Wed, 26 Feb 2014)
------------------------------------------------------------------------

There was only one revision to the file made in 2014. If we remove
'--quiet' we can see the log message:

$ svn log --revision {2014-01-01}:{2014-12-31} INSTALL
------------------------------------------------------------------------
r1572339 | breser | 2014-02-26 18:21:34 -0500 (Wed, 26 Feb 2014) | 6 lines

Bump required version of Apache httpd to 2.2.x or newer.

* INSTALL: Change from 2.x to 2.2.x or newer.

* configure.ac: Require 2.2.x's module magic number.

------------------------------------------------------------------------

If we wanted to see the changes, 'svn log' can take a '--diff' switch:

$ svn log --diff --revision {2014-01-01}:{2014-12-31} INSTALL
------------------------------------------------------------------------
r1572339 | breser | 2014-02-26 18:21:34 -0500 (Wed, 26 Feb 2014) | 6 lines

Bump required version of Apache httpd to 2.2.x or newer.

* INSTALL: Change from 2.x to 2.2.x or newer.

* configure.ac: Require 2.2.x's module magic number.


Index: INSTALL
===================================================================
--- INSTALL (revision 1572338)
+++ INSTALL (revision 1572339)
@@ -436,7 +436,7 @@
          http://freshmeat.net/projects/cyrussasl/


-      9.  Apache Web Server 2.X  (OPTIONAL)
+      9.  Apache Web Server 2.2.X or newer  (OPTIONAL)

           (http://httpd.apache.org/download.cgi)


------------------------------------------------------------------------

Hope this helps,
Nathan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.