diff hgext/mq.py @ 20786:d666da075b91

mq: omit ".hgsubstate" from qnew/qrefresh target list for consistent node hash Before this patch, even if specified file patterns and -I/-X options cause listing ".hgsubstate" up in the target list, qnew/qrefresh put ".hgsubstate" into the target list individually and forcibly. This changes how many times ".hgsubstate" appear in the target list according to run-time conditions, and causes inconsistent node hash, even though revision content is same, because node hash calculation uses the specified target list directly (without duplication check or so). This patch always omits ".hgsubstate" from qnew/qrefresh target list for consistent node hash. This omitting doesn't miss including ".hgsubstate" changes, because: - "localrepository.commit()" puts ".hgsubstate" into the target list for "commitctx()" forcibly if needed - "mq.putsubstate2changes()" puts ".hgsubstate" into the target list for "patch.diff()" if it is not yet listed up
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 20 Mar 2014 00:10:45 +0900
parents 7f7c8ef31c5d
children 49f2d5644f04
line wrap: on
line diff
--- a/hgext/mq.py	Thu Mar 20 00:10:45 2014 +0900
+++ b/hgext/mq.py	Thu Mar 20 00:10:45 2014 +0900
@@ -1035,7 +1035,6 @@
             self.checkpatchname(patchfn)
         inclsubs = checksubstate(repo)
         if inclsubs:
-            inclsubs.append('.hgsubstate')
             substatestate = repo.dirstate['.hgsubstate']
         if opts.get('include') or opts.get('exclude') or pats:
             match = scmutil.match(repo[None], pats, opts)
@@ -1045,14 +1044,14 @@
                     raise util.Abort('%s: %s' % (f, msg))
             match.bad = badfn
             changes = repo.status(match=match)
-            m, a, r, d = changes[:4]
         else:
             changes = self.checklocalchanges(repo, force=True)
-            m, a, r, d = changes
-        match = scmutil.matchfiles(repo, m + a + r + inclsubs)
+        commitfiles = list(inclsubs)
+        for files in changes[:3]:
+            commitfiles.extend([f for f in files if f != '.hgsubstate'])
+        match = scmutil.matchfiles(repo, commitfiles)
         if len(repo[None].parents()) > 1:
             raise util.Abort(_('cannot manage merge changesets'))
-        commitfiles = m + a + r
         self.checktoppatch(repo)
         insert = self.fullseriesend()
         wlock = repo.wlock()
@@ -1492,7 +1491,6 @@
 
             inclsubs = checksubstate(repo, hex(patchparent))
             if inclsubs:
-                inclsubs.append('.hgsubstate')
                 substatestate = repo.dirstate['.hgsubstate']
 
             ph = patchheader(self.join(patchfn), self.plainmode)
@@ -1579,7 +1577,7 @@
 
             files = set(inclsubs)
             for x in refreshchanges:
-                files.update(x)
+                files.update([f for f in x if f != '.hgsubstate'])
             match = scmutil.matchfiles(repo, files)
 
             bmlist = repo[top].bookmarks()