--- a/review/api.py Wed Jul 28 15:48:43 2010 +0200
+++ b/review/api.py Fri Aug 20 16:29:35 2010 +0200
@@ -423,6 +423,16 @@
return ReviewSignoff(**data)
+ def _create_exists_entry(self):
+ path = os.path.join(self.repo.root, self.node)
+ os.mkdir(path)
+ with open(os.path.join(path, '.exists'), 'w') as e:
+ pass
+
+ cmdutil.commit(self.ui, self.repo, _commitfunc,
+ [os.path.join(path, '.exists')],
+ { 'message': 'Initialize review data for changeset %s' % self.node,
+ 'addremove': True, })
def __init__(self, ui, repo, target, node):
"""Initialize a ReviewChangeset.
@@ -455,16 +465,6 @@
self.comments = []
self.signoffs = []
- path = os.path.join(self.repo.root, self.node)
- os.mkdir(path)
- with open(os.path.join(path, '.exists'), 'w') as e:
- pass
-
- cmdutil.commit(ui, self.repo, _commitfunc,
- [os.path.join(path, '.exists')],
- { 'message': 'Initialize review data for changeset %s' % self.node,
- 'addremove': True, })
-
def signoffs_for_user(self, username):
return filter(lambda s: s.author == username, self.signoffs)
@@ -486,6 +486,9 @@
if existing:
raise SignoffExists
+ if not (self.comments or self.signoffs):
+ self._create_exists_entry()
+
signoff = ReviewSignoff(fromlocal(self.ui.username()), util.makedate(),
self.node, opinion, message, style)
signoff._commit(self.ui, self.repo)
@@ -509,6 +512,9 @@
if filename and not ufilename:
ufilename = fromlocal(filename)
+ if not (self.comments or self.signoffs):
+ self._create_exists_entry()
+
comment = ReviewComment(fromlocal(self.ui.username()), util.makedate(),
self.node, ufilename, filename, map(int, lines), message, style)
comment._commit(self.ui, self.repo)