Mercurial > hg
comparison hgext/mq.py @ 19823:6fb14d21fe9d
strip: move checksubstate from mq to strip
One more step for issue3824
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 26 Sep 2013 23:12:43 +0200 |
parents | a194a33f8cb2 |
children | 237e40b2c1ff |
comparison
equal
deleted
inserted
replaced
19822:a194a33f8cb2 | 19823:6fb14d21fe9d |
---|---|
85 # but I (marmoute) prefer this explicite code. | 85 # but I (marmoute) prefer this explicite code. |
86 class dummyui(object): | 86 class dummyui(object): |
87 def debug(self, msg): | 87 def debug(self, msg): |
88 pass | 88 pass |
89 stripext = extensions.load(dummyui(), 'strip', '') | 89 stripext = extensions.load(dummyui(), 'strip', '') |
90 | |
91 checksubstate = stripext.checksubstate | |
90 | 92 |
91 # Patch names looks like unix-file names. | 93 # Patch names looks like unix-file names. |
92 # They must be joinable with queue directory and result in the patch path. | 94 # They must be joinable with queue directory and result in the patch path. |
93 normname = util.normpath | 95 normname = util.normpath |
94 | 96 |
2905 del q.applied[:] | 2907 del q.applied[:] |
2906 q.applieddirty = True | 2908 q.applieddirty = True |
2907 q.savedirty() | 2909 q.savedirty() |
2908 return 0 | 2910 return 0 |
2909 | 2911 |
2910 def checksubstate(repo, baserev=None): | |
2911 '''return list of subrepos at a different revision than substate. | |
2912 Abort if any subrepos have uncommitted changes.''' | |
2913 inclsubs = [] | |
2914 wctx = repo[None] | |
2915 if baserev: | |
2916 bctx = repo[baserev] | |
2917 else: | |
2918 bctx = wctx.parents()[0] | |
2919 for s in sorted(wctx.substate): | |
2920 if wctx.sub(s).dirty(True): | |
2921 raise util.Abort( | |
2922 _("uncommitted changes in subrepository %s") % s) | |
2923 elif s not in bctx.substate or bctx.sub(s).dirty(): | |
2924 inclsubs.append(s) | |
2925 return inclsubs | |
2926 | |
2927 def checklocalchanges(repo, force=False, excsuffix=''): | 2912 def checklocalchanges(repo, force=False, excsuffix=''): |
2928 cmdutil.checkunfinished(repo) | 2913 cmdutil.checkunfinished(repo) |
2929 m, a, r, d = repo.status()[:4] | 2914 m, a, r, d = repo.status()[:4] |
2930 if not force: | 2915 if not force: |
2931 if (m or a or r or d): | 2916 if (m or a or r or d): |