From: Rudolf Polzer Date: Sun, 31 Oct 2010 15:12:21 +0000 (+0100) Subject: git-branch-manager: funny feature --skip that will ignore the content of merged/unmer... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=33e475d056c32eaa031bc3aa73d480177e839c28;p=xonotic%2Fdiv0-gittools.git git-branch-manager: funny feature --skip that will ignore the content of merged/unmerged commits (handle with care) --- diff --git a/git-branch-manager b/git-branch-manager index e251f94..23a38fb 100755 --- a/git-branch-manager +++ b/git-branch-manager @@ -78,6 +78,9 @@ elsif($datefilter ne '') @datefilter = "--since=$datefilter"; } +# if set, don't actually merge/revert changes, just mark as such +my $skip = 0; + our $do_commit = 1; my $logcache = undef; sub reset_to_commit($) @@ -135,9 +138,12 @@ sub merge_commit($) local $ENV{GIT_AUTHOR_NAME} = $author; local $ENV{GIT_AUTHOR_EMAIL} = $email; local $ENV{GIT_AUTHOR_DATE} = $date; - run 'git', 'cherry-pick', '-n', $r - or run 'git', 'mergetool' - or die "git-mergetool: $!"; + if(!$skip) + { + run 'git', 'cherry-pick', '-n', $r + or run 'git', 'mergetool' + or die "git-mergetool: $!"; + } if($do_commit) { run 'git', 'commit', '-F', '.commitmsg' @@ -182,9 +188,12 @@ sub unmerge_commit($) local $ENV{GIT_AUTHOR_NAME} = $author; local $ENV{GIT_AUTHOR_EMAIL} = $email; local $ENV{GIT_AUTHOR_DATE} = $date; - run 'git', 'revert', '-n', $r - or run 'git', 'mergetool' - or die "git-mergetool: $!"; + if(!$skip) + { + run 'git', 'revert', '-n', $r + or run 'git', 'mergetool' + or die "git-mergetool: $!"; + } if($do_commit) { run 'git', 'commit', '-F', '.commitmsg' @@ -632,6 +641,7 @@ my $result = GetOptions( "log|l:s", handler \&opt_list, "outstanding|o:s", handler \&opt_list, "rebase|b=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]]; }, "reset|R=s", handler sub { run_script ['reset', $_[1]]; },