From 18669b744dbc40df9ce025f3db44a28f7aba29ff Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Wed, 29 Aug 2007 11:52:59 +0100 Subject: [PATCH] Add the '--exclusive' option to 'uncommit' This option makes the commits range given by the --to option exclusive, i.e. the last commit is not uncomitted. Signed-off-by: Catalin Marinas --- stgit/commands/uncommit.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/stgit/commands/uncommit.py b/stgit/commands/uncommit.py index e3bf0d8..3cf2f0a 100644 --- a/stgit/commands/uncommit.py +++ b/stgit/commands/uncommit.py @@ -51,7 +51,10 @@ words, you can't uncommit a merge.""" options = [make_option('-n', '--number', type = 'int', help = 'uncommit the specified number of commits'), make_option('-t', '--to', - help = 'uncommit to the specified commit')] + help = 'uncommit to the specified commit'), + make_option('-x', '--exclusive', + help = 'exclude the commit specified by the --to option', + action = 'store_true')] def func(parser, options, args): """Uncommit a number of patches. @@ -106,12 +109,17 @@ def func(parser, options, args): commits.append((commit, commit_id, parent)) next_commit = parent else: - out.start('Uncommitting to %s' % to_commit) + if options.exclusive: + out.start('Uncommitting to %s (exclusive)' % to_commit) + else: + out.start('Uncommitting to %s' % to_commit) while True: commit, commit_id, parent = get_commit(next_commit) - commits.append((commit, commit_id, parent)) if commit_id == to_commit: + if not options.exclusive: + commits.append((commit, commit_id, parent)) break + commits.append((commit, commit_id, parent)) next_commit = parent patch_nr = len(commits) -- 2.11.4.GIT