changeset 42492:4bcabb5ae9b6

strip: move checksubstate() to mq (its only caller) Differential Revision: https://phab.mercurial-scm.org/D6536
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 17 Jun 2019 10:53:00 -0700
parents 1474f5d84662
children 9f7cb777b654
files hgext/mq.py hgext/strip.py
diffstat 2 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Jun 17 10:19:41 2019 -0700
+++ b/hgext/mq.py	Mon Jun 17 10:53:00 2019 -0700
@@ -144,7 +144,21 @@
     stripext = extensions.load(dummyui(), 'strip', '')
 
 strip = stripext.strip
-checksubstate = stripext.checksubstate
+
+def checksubstate(repo, baserev=None):
+    '''return list of subrepos at a different revision than substate.
+    Abort if any subrepos have uncommitted changes.'''
+    inclsubs = []
+    wctx = repo[None]
+    if baserev:
+        bctx = repo[baserev]
+    else:
+        bctx = wctx.p1()
+    for s in sorted(wctx.substate):
+        wctx.sub(s).bailifchanged(True)
+        if s not in bctx.substate or bctx.sub(s).dirty():
+            inclsubs.append(s)
+    return inclsubs
 
 # Patch names looks like unix-file names.
 # They must be joinable with queue directory and result in the patch path.
--- a/hgext/strip.py	Mon Jun 17 10:19:41 2019 -0700
+++ b/hgext/strip.py	Mon Jun 17 10:53:00 2019 -0700
@@ -31,21 +31,6 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
-def checksubstate(repo, baserev=None):
-    '''return list of subrepos at a different revision than substate.
-    Abort if any subrepos have uncommitted changes.'''
-    inclsubs = []
-    wctx = repo[None]
-    if baserev:
-        bctx = repo[baserev]
-    else:
-        bctx = wctx.p1()
-    for s in sorted(wctx.substate):
-        wctx.sub(s).bailifchanged(True)
-        if s not in bctx.substate or bctx.sub(s).dirty():
-            inclsubs.append(s)
-    return inclsubs
-
 def checklocalchanges(repo, force=False):
     cmdutil.checkunfinished(repo)
     s = repo.status()