Skip to content

Commit d4da4bc

Browse files
committed
Merge early part of git-svn into maint
* commit 'git-svn/master~1': git-svn: fix processing of decorated commit hashes git-svn: check_cherry_pick should exclude commits already in our history Documentation/git-svn: discourage "noMetadata"
2 parents 2d2ef5e + 8565a56 commit d4da4bc

File tree

3 files changed

+69
-5
lines changed

3 files changed

+69
-5
lines changed

Documentation/git-svn.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ COMMANDS
5656
as well, they take precedence.
5757
--no-metadata;;
5858
Set the 'noMetadata' option in the [svn-remote] config.
59+
This option is not recommended, please read the 'svn.noMetadata'
60+
section of this manpage before using this option.
5961
--use-svm-props;;
6062
Set the 'useSvmProps' option in the [svn-remote] config.
6163
--use-svnsync-props;;
@@ -597,13 +599,22 @@ svn.noMetadata::
597599
svn-remote.<name>.noMetadata::
598600
This gets rid of the 'git-svn-id:' lines at the end of every commit.
599601
+
600-
If you lose your .git/svn/git-svn/.rev_db file, 'git svn' will not
601-
be able to rebuild it and you won't be able to fetch again,
602-
either. This is fine for one-shot imports.
602+
This option can only be used for one-shot imports as 'git svn'
603+
will not be able to fetch again without metadata. Additionally,
604+
if you lose your .git/svn/**/.rev_map.* files, 'git svn' will not
605+
be able to rebuild them.
603606
+
604607
The 'git svn log' command will not work on repositories using
605608
this, either. Using this conflicts with the 'useSvmProps'
606609
option for (hopefully) obvious reasons.
610+
+
611+
This option is NOT recommended as it makes it difficult to track down
612+
old references to SVN revision numbers in existing documentation, bug
613+
reports and archives. If you plan to eventually migrate from SVN to git
614+
and are certain about dropping SVN history, consider
615+
linkgit:git-filter-branch[1] instead. filter-branch also allows
616+
reformating of metadata for ease-of-reading and rewriting authorship
617+
info for non-"svn.authorsFile" users.
607618

608619
svn.useSvmProps::
609620
svn-remote.<name>.useSvmProps::

git-svn.perl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,8 @@ sub cmt_sha2rev_batch {
15131513

15141514
sub working_head_info {
15151515
my ($head, $refs) = @_;
1516-
my @args = ('log', '--no-color', '--first-parent', '--pretty=medium');
1516+
my @args = qw/log --no-color --no-decorate --first-parent
1517+
--pretty=medium/;
15171518
my ($fh, $ctx) = command_output_pipe(@args, $head);
15181519
my $hash;
15191520
my %max;
@@ -3118,9 +3119,10 @@ sub _rev_list {
31183119
sub check_cherry_pick {
31193120
my $base = shift;
31203121
my $tip = shift;
3122+
my $parents = shift;
31213123
my @ranges = @_;
31223124
my %commits = map { $_ => 1 }
3123-
_rev_list("--no-merges", $tip, "--not", $base);
3125+
_rev_list("--no-merges", $tip, "--not", $base, @$parents);
31243126
for my $range ( @ranges ) {
31253127
delete @commits{_rev_list($range)};
31263128
}
@@ -3296,6 +3298,7 @@ sub find_extra_svn_parents {
32963298
# double check that there are no missing non-merge commits
32973299
my (@incomplete) = check_cherry_pick(
32983300
$merge_base, $merge_tip,
3301+
$parents,
32993302
@$ranges,
33003303
);
33013304

t/t9157-git-svn-fetch-merge.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2010 Steven Walter
4+
#
5+
6+
test_description='git svn merge detection'
7+
. ./lib-git-svn.sh
8+
9+
test_expect_success 'initialize source svn repo' '
10+
svn_cmd mkdir -m x "$svnrepo"/trunk &&
11+
svn_cmd mkdir -m x "$svnrepo"/branches &&
12+
svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
13+
(
14+
cd "$SVN_TREE" &&
15+
touch foo &&
16+
svn add foo &&
17+
svn commit -m "initial commit" &&
18+
svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
19+
touch bar &&
20+
svn add bar &&
21+
svn commit -m x &&
22+
svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch2 &&
23+
svn switch "$svnrepo"/branches/branch1 &&
24+
touch baz &&
25+
svn add baz &&
26+
svn commit -m x &&
27+
svn switch "$svnrepo"/trunk &&
28+
svn merge "$svnrepo"/branches/branch1 &&
29+
svn commit -m "merge" &&
30+
svn switch "$svnrepo"/branches/branch1 &&
31+
svn commit -m x &&
32+
svn switch "$svnrepo"/branches/branch2 &&
33+
svn merge "$svnrepo"/branches/branch1 &&
34+
svn commit -m "merge branch1" &&
35+
svn switch "$svnrepo"/trunk &&
36+
svn merge "$svnrepo"/branches/branch2 &&
37+
svn resolved baz &&
38+
svn commit -m "merge branch2"
39+
) &&
40+
rm -rf "$SVN_TREE"
41+
'
42+
43+
test_expect_success 'clone svn repo' '
44+
git svn init -s "$svnrepo" &&
45+
git svn fetch
46+
'
47+
48+
test_expect_success 'verify merge commit' 'git rev-parse HEAD^2'
49+
50+
test_done

0 commit comments

Comments
 (0)