Mercurial > hg
comparison hgext/strip.py @ 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 | 12243f15d53e |
comparison
equal
deleted
inserted
replaced
42491:1474f5d84662 | 42492:4bcabb5ae9b6 |
---|---|
28 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 28 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
29 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | 29 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
30 # be specifying the version(s) of Mercurial they are tested with, or | 30 # be specifying the version(s) of Mercurial they are tested with, or |
31 # leave the attribute unspecified. | 31 # leave the attribute unspecified. |
32 testedwith = 'ships-with-hg-core' | 32 testedwith = 'ships-with-hg-core' |
33 | |
34 def checksubstate(repo, baserev=None): | |
35 '''return list of subrepos at a different revision than substate. | |
36 Abort if any subrepos have uncommitted changes.''' | |
37 inclsubs = [] | |
38 wctx = repo[None] | |
39 if baserev: | |
40 bctx = repo[baserev] | |
41 else: | |
42 bctx = wctx.p1() | |
43 for s in sorted(wctx.substate): | |
44 wctx.sub(s).bailifchanged(True) | |
45 if s not in bctx.substate or bctx.sub(s).dirty(): | |
46 inclsubs.append(s) | |
47 return inclsubs | |
48 | 33 |
49 def checklocalchanges(repo, force=False): | 34 def checklocalchanges(repo, force=False): |
50 cmdutil.checkunfinished(repo) | 35 cmdutil.checkunfinished(repo) |
51 s = repo.status() | 36 s = repo.status() |
52 if not force: | 37 if not force: |