Skip to content

Commit

Permalink
git-svn: Allow for more argument types for commit (from..to)
Browse files Browse the repository at this point in the history
Allow 'from..to' notation from the command line.

More liberal sha1 parsing when reading from stdin no longer requires the
sha1 to be the first character, so a leading 'commit ' string is OK.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Feb 20, 2006
1 parent 7294293 commit 8de010a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions contrib/git-svn/git-svn
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,21 @@ sub commit {
print "Reading from stdin...\n";
@commits = ();
while (<STDIN>) {
if (/^([a-f\d]{6,40})\b/) {
if (/\b([a-f\d]{6,40})\b/) {
unshift @commits, $1;
}
}
}
my @revs;
foreach (@commits) {
push @revs, (safe_qx('git-rev-parse',$_));
foreach my $c (@commits) {
chomp(my @tmp = safe_qx('git-rev-parse',$c));
if (scalar @tmp == 1) {
push @revs, $tmp[0];
} elsif (scalar @tmp > 1) {
push @revs, reverse (safe_qx('git-rev-list',@tmp));
} else {
die "Failed to rev-parse $c\n";
}
}
chomp @revs;

Expand Down
2 changes: 1 addition & 1 deletion contrib/git-svn/git-svn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Tracking and contributing to an Subversion managed-project:
# Commit only the git commits you want to SVN::
git-svn commit <tree-ish> [<tree-ish_2> ...]
# Commit all the git commits from my-branch that don't exist in SVN::
git rev-list --pretty=oneline git-svn-HEAD..my-branch | git-svn commit
git commit git-svn-HEAD..my-branch
# Something is committed to SVN, pull the latest into your branch::
git-svn fetch && git pull . git-svn-HEAD

Expand Down

0 comments on commit 8de010a

Please sign in to comment.