2

I have an svn repository, I have created its svn-remote in an existing Git repository. I use "git svn fetch " command to fetch the data from svn repository.

In svn we create a working copy by checking out the required path/folder/project.

  1. An svn repository can be accessed only using subversion tools ?
  2. If so, So how does git svn download/fetch the svn data, which svn command it uses ? I see some subversion related dll files under "C:\Program Files\Git\usr\bin", msys-svn_client-1-0.dll must be the svn agent used by Git.
  3. does git svn maintain any working copy or it uses some different mechanism to fetch the data, If so then what is it ?
Jaimin Ajmeri
  • 572
  • 3
  • 18
  • Here you can see and follow what the subcommand does: https://github.com/git/git/blob/master/git-svn.perl#L550-L575 – Vampire Nov 22 '16 at 11:58
  • @Vampire Is this responsible for reading all remotes Git::SVN::read_all_remotes at Line 573 ? Does it use any svn command ? – Jaimin Ajmeri Nov 25 '16 at 05:07
  • https://github.com/git/git/blob/master/perl/Git/SVN.pm#L187-L259 – Vampire Nov 25 '16 at 09:14
  • I don't think this method uses SVN commands, but just reads Git config, but I didn't look too closely. Otherwise I would have written an answer, not a comment wie a link for you to look yourself ;-) – Vampire Nov 25 '16 at 09:25
  • @Vampire thanks will look into it. – Jaimin Ajmeri Nov 25 '16 at 09:28
  • @Vampire l looked into it but didn't find any info. in particular about which svn cmd it uses to fetch the revisions from all remotes. – Jaimin Ajmeri Nov 29 '16 at 03:19
  • Just follow the code. Somewhere it calls the SVN Bindings. Then use the docs of those to possibly find out to which command-line command this corresponds. – Vampire Nov 29 '16 at 07:43

1 Answers1

1

Does it use any svn command ?

It (the perl/Git/SVN.pm# script) uses SVN commands through a Perl module from the Git Perl modules

In particular, Git::SVN::Ra deals with Subversion remote access functions for git-svn, and use the SVN::Client module for actual subversion commands.


But make sure to use Git 2.28 (Q3 2020), in order to make sure any CVS/SVN interface is prepared for SHA-256 transition

See commit 6e9c4d4, commit f3eaa09, commit 05ea93d, commit 66eadd1, commit 94b2ee1, commit ff508e2, commit 9ab3315, commit 148f193 (22 Jun 2020), and commit 3e04b6e, commit bbe0616, commit 407527b, commit 606b974, commit 5aa6877, commit 62814df (19 Jun 2020) by brian m. carlson (bk2204).
(Merged by Junio C Hamano -- gitster -- in commit e7e113a, 06 Jul 2020)

perl: make SVN code hash independent

Signed-off-by: brian m. carlson
Acked-by: Eric Wong

There are several places throughout git svn that use various hard-coded constants.

For matching object IDs, use the $oid variable.

Compute the record size we use for our revision storage based on the object ID.

When parsing the revision map format, use a wildcard in the pack format since we know that the data we're parsing is always exactly the record size.

This lets us continue to use a constant for the pack format.

Finally, update several comments to reflect the fact that an object ID may be of one of multiple sizes.


Git 2.29 (Q4 2020) adds a portability fix.

See commit 6103d58 (06 Aug 2020) by brian m. carlson (bk2204).
(Merged by Junio C Hamano -- gitster -- in commit 092b677, 13 Aug 2020)

git-cvsexportcommit: support Perl before 5.10.1

Signed-off-by: brian m. carlson

The change in 6e9c4d408d ("git-cvsexportcommit: port to SHA-256", 2020-06-22, Git v2.28.0-rc0 -- merge listed in batch #7) added the use of a temporary directory for the index.

However, the form we used doesn't work in versions of Perl before 5.10.1.

For example, version 5.10.0 contains a version of File::Temp from 2007 that doesn't contain "newdir".

In order to make the code work with 5.8.8, which we support, let's change to use the static method "tempdir" with the argument "CLEANUP", which provides the same behavior.


Before Git 2.30 (Q1 2021), a recent oid->hash conversion missed one spot, breaking "git-svn".

See commit 03bb366 (22 Oct 2020) by brian m. carlson (bk2204).
(Merged by Junio C Hamano -- gitster -- in commit 305fcf4, 02 Nov 2020)

svn: use correct variable name for short OID

Reported-by: Nikos Chantziaras
Signed-off-by: brian m. carlson

The commit 9ab33150a0 ("perl: create and switch variables for hash constants", 2020-06-22, Git v2.28.0-rc0 -- merge listed in batch #7) converted each instance of the variable $sha1_short into $oid_short in the Subversion code, since git-svn now understands SHA-256.

However, one conversion was missed.

As a result, Perl complains about the use of this variable:

Use of uninitialized value $sha1_short in regexp compilation at
/usr/lib64/perl5/vendor_perl/5.30.3/Git/SVN/Log.pm line 301, <$fh>
line 6.  

Because we're parsing raw diff output here, the likelihood is very low that we'll actually misparse the data, since the only lines we're going to get starting with colons are the ones we're expecting.
Even if we had a newline in a path, we'd end up with a quoted path.
Our regex is just less strict than we'd like it to be.

However, it's obviously undesirable that our code is emitting Perl warnings, so let's convert it to use the proper variable name.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250