git-branch-manager: cleanup features
authorRudolf Polzer <divverent@alientrap.org>
Tue, 3 Jan 2012 23:59:43 +0000 (00:59 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 3 Jan 2012 23:59:43 +0000 (00:59 +0100)
git-branch-manager

index a43225d..42cea14 100755 (executable)
@@ -654,13 +654,24 @@ sub opt_rebase($$)
        my $commit_id = $1;
        my $l = rebase_log $r, parse_log();
        local $pebkac = 0;
-       local $do_commit = 0;
        eval
        {
-               reset_to_commit $r;
-               run_script @{$l->{log}};
-               run 'git', 'commit', '--allow-empty', '-m', "::stable-branch::rebase=$r"
-                       or die "git-commit: $!";
+               if($cmd eq 'rebase')
+               {
+                       local $do_commit = 0;
+                       reset_to_commit $r;
+                       run_script @{$l->{log}};
+                       run 'git', 'commit', '--allow-empty', '-m', "::stable-branch::rebase=$r"
+                               or die "git-commit: $!";
+               }
+               elsif($cmd eq 'resetrebase')
+               {
+                       run_script ['reset', $r], @{$l->{log}};
+               }
+               elsif($cmd eq 'hardresetrebase')
+               {
+                       run_script ['hardreset', $r], @{$l->{log}};
+               }
                1;
        }
        or do
@@ -768,6 +779,8 @@ Usage:
        $0 {--reset|-R} revision-hash
        $0 {--hardreset|-H} revision-hash
        $0 {--rebase|-b} revision-hash
+       $0 {--resetrebase|-B} revision-hash
+       $0 {--hardresetrebase} revision-hash
 EOF
        exit 1;
 }
@@ -798,6 +811,8 @@ my $result = GetOptions(
        "log|l:s", handler \&opt_list,
        "outstanding|o:s", handler \&opt_list,
        "rebase|b=s", handler \&opt_rebase,
+       "resetrebase|B=s", handler \&opt_rebase,
+       "hardresetrebase=s", handler \&opt_rebase,
        "skip", handler \$skip,
        "merge|m=s{,}", handler sub { run_script ['merge', $_[1]]; },
        "unmerge|u=s{,}", handler sub { run_script ['unmerge', $_[1]]; },