Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG4bcabb5ae9b6: strip: move checksubstate() to mq (its only caller)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/mq.py (16 lines) | |||
| M | hgext/strip.py (15 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| ccdab63e7ded | 31df2049a463 | Martin von Zweigbergk | Jun 17 2019, 1:53 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| class dummyui(object): | class dummyui(object): | ||||
| def debug(self, msg): | def debug(self, msg): | ||||
| pass | pass | ||||
| def log(self, event, msgfmt, *msgargs, **opts): | def log(self, event, msgfmt, *msgargs, **opts): | ||||
| pass | pass | ||||
| stripext = extensions.load(dummyui(), 'strip', '') | stripext = extensions.load(dummyui(), 'strip', '') | ||||
| strip = stripext.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. | # Patch names looks like unix-file names. | ||||
| # They must be joinable with queue directory and result in the patch path. | # They must be joinable with queue directory and result in the patch path. | ||||
| normname = util.normpath | normname = util.normpath | ||||
| class statusentry(object): | class statusentry(object): | ||||
| def __init__(self, node, name): | def __init__(self, node, name): | ||||
| self.node, self.name = node, name | self.node, self.name = node, name | ||||
| cmdtable = {} | cmdtable = {} | ||||
| command = registrar.command(cmdtable) | command = registrar.command(cmdtable) | ||||
| # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | ||||
| # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | ||||
| # be specifying the version(s) of Mercurial they are tested with, or | # be specifying the version(s) of Mercurial they are tested with, or | ||||
| # leave the attribute unspecified. | # leave the attribute unspecified. | ||||
| testedwith = 'ships-with-hg-core' | 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): | def checklocalchanges(repo, force=False): | ||||
| cmdutil.checkunfinished(repo) | cmdutil.checkunfinished(repo) | ||||
| s = repo.status() | s = repo.status() | ||||
| if not force: | if not force: | ||||
| cmdutil.bailifchanged(repo) | cmdutil.bailifchanged(repo) | ||||
| return s | return s | ||||
| def _findupdatetarget(repo, nodes): | def _findupdatetarget(repo, nodes): | ||||