Benoît Allard avatar Benoît Allard committed 971a3a6

Only create a .exists file when we add comment or signoff

Comments (0)

Files changed (1)

 
         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.
             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)
 
         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)
         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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.