diff hgext/record.py @ 11237:feb2a58fc592 stable

record: check that we are not committing a merge before patch selection It might sound like a good idea to use record to filter changes when merging. If someone attemps this, it's better to tell her "no" right ahead, before the patch generation/line selection, so she does not spend time doing it just to receive a red light after that (sometimes rather long) process.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 31 May 2010 17:13:15 +0900
parents cfa6a726ef6d
children a5922547b5cc
line wrap: on
line diff
--- a/hgext/record.py	Mon May 31 13:43:03 2010 +0200
+++ b/hgext/record.py	Mon May 31 17:13:15 2010 +0900
@@ -379,7 +379,9 @@
       a - record all changes to all remaining files
       q - quit, recording no changes
 
-      ? - display help'''
+      ? - display help
+
+    This command is not available when committing a merge.'''
 
     dorecord(ui, repo, commands.commit, *pats, **opts)
 
@@ -422,6 +424,11 @@
         left in place, so the user can continue his work.
         """
 
+        merge = len(repo[None].parents()) > 1
+        if merge:
+            raise util.Abort(_('cannot partially commit a merge '
+                               '(use hg commit instead)'))
+
         changes = repo.status(match=match)[:3]
         diffopts = mdiff.diffopts(git=True, nodates=True)
         chunks = patch.diff(repo, changes=changes, opts=diffopts)