chiark
/
gitweb
/
~mdw
/
stgit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c4f99b6
)
If any uncommit would fail, don't uncommit anything
author
Karl Hasselström
<kha@treskal.com>
Tue, 15 May 2007 17:10:01 +0000
(18:10 +0100)
committer
Catalin Marinas
<catalin.marinas@gmail.com>
Tue, 15 May 2007 21:13:15 +0000
(22:13 +0100)
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/uncommit.py
patch
|
blob
|
blame
|
history
diff --git
a/stgit/commands/uncommit.py
b/stgit/commands/uncommit.py
index 04c7e52e24b7a9cd5b08a9cb68f69efde732a987..f86af5778bfc0fc25697813bb2197d0b406cd891 100644
(file)
--- a/
stgit/commands/uncommit.py
+++ b/
stgit/commands/uncommit.py
@@
-80,23
+80,26
@@
def func(parser, options, args):
print 'Uncommitting %d patches...' % patch_nr,
sys.stdout.flush()
print 'Uncommitting %d patches...' % patch_nr,
sys.stdout.flush()
- for n in xrange(0, patch_nr):
- # retrieve the commit (only commits with a single parent are allowed)
- commit_id = crt_series.get_base()
+ def get_commit(commit_id):
commit = git.Commit(commit_id)
try:
parent, = commit.get_parents()
except ValueError:
commit = git.Commit(commit_id)
try:
parent, = commit.get_parents()
except ValueError:
- raise CmdException, 'Commit %s does not have exactly one parent' \
- % commit_id
+ raise CmdException('Commit %s does not have exactly one parent'
+ % commit_id)
+ return (commit, commit_id, parent)
+
+ commits = []
+ next_commit = crt_series.get_base()
+ for i in xrange(patch_nr):
+ commit, commit_id, parent = get_commit(next_commit)
+ commits.append((commit, commit_id, parent))
+ next_commit = parent
+
+ for (commit, commit_id, parent), patchname in \
+ zip(commits, patchnames or (None for i in xrange(len(commits)))):
author_name, author_email, author_date = \
name_email_date(commit.get_author())
author_name, author_email, author_date = \
name_email_date(commit.get_author())
-
- if patchnames:
- patchname = patchnames[n]
- else:
- patchname = None
-
crt_series.new_patch(patchname,
can_edit = False, before_existing = True,
top = commit_id, bottom = parent,
crt_series.new_patch(patchname,
can_edit = False, before_existing = True,
top = commit_id, bottom = parent,
@@
-105,4
+108,5
@@
def func(parser, options, args):
author_email = author_email,
author_date = author_date)
author_email = author_email,
author_date = author_date)
+
print 'done'
print 'done'