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): |
61 def _findupdatetarget(repo, nodes): |
62 unode, p2 = repo.changelog.parents(nodes[0]) |
62 unode, p2 = repo.changelog.parents(nodes[0]) |
|
63 currentbranch = repo[None].branch() |
63 |
64 |
64 if (util.safehasattr(repo, 'mq') and p2 != nullid |
65 if (util.safehasattr(repo, 'mq') and p2 != nullid |
65 and p2 in [x.node for x in repo.mq.applied]): |
66 and p2 in [x.node for x in repo.mq.applied]): |
66 unode = p2 |
67 unode = p2 |
|
68 elif currentbranch != repo[unode].branch(): |
|
69 pwdir = 'parents(wdir())' |
|
70 revset = 'max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s))' |
|
71 branchtarget = repo.revs(revset, nodes, pwdir, pwdir, nodes, pwdir, |
|
72 currentbranch) |
|
73 if branchtarget: |
|
74 cl = repo.changelog |
|
75 unode = cl.node(branchtarget.first()) |
67 |
76 |
68 return unode |
77 return unode |
69 |
78 |
70 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None): |
79 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None): |
71 with repo.wlock(), repo.lock(): |
80 with repo.wlock(), repo.lock(): |