@matheusbsbs / matheus-bagliano / commits / 8de010ad28
Fork 0

git-svn: Allow for more argument types for commit (from..to)

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>

Eric Wong committed Feb 20, 2006 at 10:57 UTC 8de010ad2802e0718b36f394322c6f25542612d6
2 files changed +11 -4
contrib/git-svn/git-svn
+10 -3
@@ -216,14 +216,21 @@ sub commit {
216 print "Reading from stdin...\n";
217 @commits = ();
218 while (<STDIN>) {
219 - if (/^([a-f\d]{6,40})\b/) {
219 + if (/\b([a-f\d]{6,40})\b/) {
220 unshift @commits, $1;
221 }
222 }
223 }
224 my @revs;
225 - foreach (@commits) {
226 - push @revs, (safe_qx('git-rev-parse',$_));
225 + foreach my $c (@commits) {
226 + chomp(my @tmp = safe_qx('git-rev-parse',$c));
227 + if (scalar @tmp == 1) {
228 + push @revs, $tmp[0];
229 + } elsif (scalar @tmp > 1) {
230 + push @revs, reverse (safe_qx('git-rev-list',@tmp));
231 + } else {
232 + die "Failed to rev-parse $c\n";
233 + }
234 }
235 chomp @revs;
236
contrib/git-svn/git-svn.txt
+1 -1
@@ -149,7 +149,7 @@ Tracking and contributing to an Subversion managed-project:
149 # Commit only the git commits you want to SVN::
150 git-svn commit <tree-ish> [<tree-ish_2> ...]
151 # Commit all the git commits from my-branch that don't exist in SVN::
152 - git rev-list --pretty=oneline git-svn-HEAD..my-branch | git-svn commit
152 + git commit git-svn-HEAD..my-branch
153 # Something is committed to SVN, pull the latest into your branch::
154 git-svn fetch && git pull . git-svn-HEAD
155