changeset 48092:0dc9ced02a3b

dirstate-item: use item's property to deal with hgsubstate in mq This is clearer than processing the `state`. Differential Revision: https://phab.mercurial-scm.org/D11529
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 14:56:23 +0200
parents bac753df8021
children 5437a0254590
files hgext/mq.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Sep 29 14:56:05 2021 +0200
+++ b/hgext/mq.py	Wed Sep 29 14:56:23 2021 +0200
@@ -1267,9 +1267,9 @@
         if any((b'.hgsubstate' in files for files in mar)):
             return  # already listed up
         # not yet listed up
-        if substatestate in b'a?':
+        if substatestate.added or not substatestate.any_tracked:
             mar[1].append(b'.hgsubstate')
-        elif substatestate in b'r':
+        elif substatestate.removed:
             mar[2].append(b'.hgsubstate')
         else:  # modified
             mar[0].append(b'.hgsubstate')
@@ -1377,7 +1377,7 @@
             self.checkpatchname(patchfn)
         inclsubs = checksubstate(repo)
         if inclsubs:
-            substatestate = repo.dirstate[b'.hgsubstate']
+            substatestate = repo.dirstate.get_entry(b'.hgsubstate')
         if opts.get(b'include') or opts.get(b'exclude') or pats:
             # detect missing files in pats
             def badfn(f, msg):
@@ -1908,7 +1908,7 @@
 
             inclsubs = checksubstate(repo, patchparent)
             if inclsubs:
-                substatestate = repo.dirstate[b'.hgsubstate']
+                substatestate = repo.dirstate.get_entry(b'.hgsubstate')
 
             ph = patchheader(self.join(patchfn), self.plainmode)
             diffopts = self.diffopts(