[PATCH] mq: substate check ommits if no sub-repo changes poped: i.e .hgsubstate not changed

alexraynepe196 at gmail.com alexraynepe196 at gmail.com
Mon Nov 27 20:48:45 UTC 2023


# HG changeset patch
# User alexrayne
# Date 1700855978 -10800
#      Fri Nov 24 22:59:38 2023 +0300
# Branch work-ar
# Node ID a180cc1a9c673cb67a46549b2ed1cac69d4aa48f
# Parent  516fe864bd4a33235e94a87579fc426a6138872d
mq: substate check ommits if no sub-repo changes poped: i.e .hgsubstate not changed.

* sub-repo check may be very expensive, avoid it if poped patch not affects sub-repops

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1821,6 +1821,7 @@
 
             # we know there are no local changes, so we can make a simplified
             # form of hg.update.
+            toupdate = set()
             if update:
                 qp = self.qparents(repo, rev)
                 ctx = repo[qp]
@@ -1829,7 +1830,8 @@
                 if d:
                     raise error.Abort(_(b"deletions found between repo revs"))
 
-                tobackup = set(a + m + r) & tobackup
+                toupdate.update(a + m + r) 
+                tobackup = toupdate & tobackup
                 if keepchanges and tobackup:
                     raise error.Abort(_(b"local changes found, qrefresh first"))
                 self.backup(repo, tobackup)
@@ -1850,8 +1852,9 @@
                 self.ui.status(_(b"popping %s\n") % patch.name)
             del self.applied[start:end]
             strip(self.ui, repo, [rev], update=False, backup=False)
-            for s, state in repo[b'.'].substate.items():
-                repo[b'.'].sub(s).get(state)
+            if b'.hgsubstate' in toupdate:
+                for s, state in repo[b'.'].substate.items():
+                    repo[b'.'].sub(s).get(state)
             if self.applied:
                 self.ui.write(_(b"now at: %s\n") % self.applied[-1].name)
             else:



More information about the Mercurial-devel mailing list