Patchwork D11529: dirstate-item: use item's property to deal with hgsubstate in mq

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2021, 9:42 a.m.
Message ID <differential-rev-PHID-DREV-rhfvnasfvkfx5eltzjhz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49854/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2021, 9:42 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is clearer than processing the `state`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11529

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -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(