##// END OF EJS Templates
strip: factor out update target selection...
Paul Morelle -
r34575:05c2a9f3 default
parent child Browse files
Show More
@@ -58,16 +58,21 b' def checklocalchanges(repo, force=False,'
58 raise error.Abort(_("local changed subrepos found" + excsuffix))
58 raise error.Abort(_("local changed subrepos found" + excsuffix))
59 return s
59 return s
60
60
61 def _findupdatetarget(repo, nodes):
62 unode, p2 = repo.changelog.parents(nodes[0])
63
64 if (util.safehasattr(repo, 'mq') and p2 != nullid
65 and p2 in [x.node for x in repo.mq.applied]):
66 unode = p2
67
68 return unode
69
61 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
70 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
62 with repo.wlock(), repo.lock():
71 with repo.wlock(), repo.lock():
63
72
64 if update:
73 if update:
65 checklocalchanges(repo, force=force)
74 checklocalchanges(repo, force=force)
66 urev, p2 = repo.changelog.parents(revs[0])
75 urev = _findupdatetarget(repo, revs)
67 if (util.safehasattr(repo, 'mq') and
68 p2 != nullid
69 and p2 in [x.node for x in repo.mq.applied]):
70 urev = p2
71 hg.clean(repo, urev)
76 hg.clean(repo, urev)
72 repo.dirstate.write(repo.currenttransaction())
77 repo.dirstate.write(repo.currenttransaction())
73
78
@@ -196,10 +201,7 b' def stripcmd(ui, repo, *revs, **opts):'
196
201
197 revs = sorted(rootnodes)
202 revs = sorted(rootnodes)
198 if update and opts.get('keep'):
203 if update and opts.get('keep'):
199 urev, p2 = repo.changelog.parents(revs[0])
204 urev = _findupdatetarget(repo, revs)
200 if (util.safehasattr(repo, 'mq') and p2 != nullid
201 and p2 in [x.node for x in repo.mq.applied]):
202 urev = p2
203 uctx = repo[urev]
205 uctx = repo[urev]
204
206
205 # only reset the dirstate for files that would actually change
207 # only reset the dirstate for files that would actually change
General Comments 0
You need to be logged in to leave comments. Login now