Commits

Nicolas Évrard committed e6586a1

Remove review_id file on commit

Comments (0)

Files changed (3)

     Follow mercurial version while keeping compatibility
     Added clean option
     Added nested option
+    Remove review_id file on commit
 
 * Version 0.2 - 2011-11-27
     Initial release

hgreview/__init__.py

 from mercurial.__version__ import version as mercurial_version
 from mercurial import hg, extensions, util
 from mercurial import patch, mdiff, node, commands
+from mercurial import extensions
 
 try:
     test = map(int, mercurial_version.split('.')) >= [1, 9]
         ('', 'fetch', None, 'Fetch patch and apply to repository'),
     ], "hg review [options]"),
 }
+
+
+def review_commit(orig, ui, repo, *pats, **opts):
+    issue_file = _get_issue_file(repo)
+    if os.path.isfile(issue_file):
+        os.unlink(issue_file)
+    orig(ui, repo, *pats, **opts)
+
+
+def uisetup(ui):
+    extensions.wrapcommand(commands.table, 'commit', review_commit)
 
   $ cd ..
   $ diff -x .hg  -r a b
+
+If we do a commit then the file review_id will disappear:
+
+  $ cd a
+  $ hg commit -m 'Commit change'
+  $ test -e .hg/review_id || echo OK
+  OK