Show More
@@ -15,7 +15,7 http://mercurial.selenic.com/wiki/Rebase | |||
|
15 | 15 | ''' |
|
16 | 16 | |
|
17 | 17 | from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks |
|
18 |
from mercurial import extensions, patch |
|
|
18 | from mercurial import extensions, patch | |
|
19 | 19 | from mercurial.commands import templateopts |
|
20 | 20 | from mercurial.node import nullrev |
|
21 | 21 | from mercurial.lock import release |
@@ -184,31 +184,18 def rebase(ui, repo, **opts): | |||
|
184 | 184 | else: |
|
185 | 185 | dest = repo[destf] |
|
186 | 186 | |
|
187 | rebaseset = None | |
|
188 | if srcf: | |
|
189 | revsetargs = ('(%r)::', srcf) | |
|
190 | elif revf: | |
|
191 | rebaseset = scmutil.revrange(repo, revf) | |
|
192 | if not keepf and rebaseset: | |
|
193 | try: | |
|
194 | repo.set('children(%ld) - %ld', | |
|
195 | rebaseset, rebaseset).next() | |
|
196 | except StopIteration: | |
|
197 | pass # empty revset is what we look for | |
|
198 | else: | |
|
199 | msg = _("can't remove original changesets with" | |
|
200 | " unrebased descendants") | |
|
201 | hint = _('use --keep to keep original changesets') | |
|
202 | raise util.Abort(msg, hint=hint) | |
|
187 | if revf: | |
|
188 | revgen = repo.set('%lr', revf) | |
|
189 | elif srcf: | |
|
190 | revgen = repo.set('(%r)::', srcf) | |
|
203 | 191 | else: |
|
204 | 192 | base = basef or '.' |
|
205 |
rev |
|
|
193 | revgen = repo.set('(children(ancestor(%r, %d)) and ::(%r))::', | |
|
206 | 194 | base, dest, base) |
|
207 | if rebaseset is None: | |
|
208 |
|
|
|
209 | if rebaseset: | |
|
210 | result = buildstate(repo, dest, rebaseset, detachf) | |
|
211 | else: | |
|
195 | ||
|
196 | rebaseset = [c.rev() for c in revgen] | |
|
197 | ||
|
198 | if not rebaseset: | |
|
212 | 199 | repo.ui.debug('base is ancestor of destination') |
|
213 | 200 | result = None |
|
214 | 201 | if not result: |
@@ -581,7 +568,7 def buildstate(repo, dest, rebaseset, de | |||
|
581 | 568 | if commonbase == dest: |
|
582 | 569 | samebranch = root.branch() == dest.branch() |
|
583 | 570 | if samebranch and root in dest.children(): |
|
584 |
repo.ui.debug( |
|
|
571 | repo.ui.debug('source is a child of destination') | |
|
585 | 572 | return None |
|
586 | 573 | # rebase on ancestor, force detach |
|
587 | 574 | detach = True |
General Comments 0
You need to be logged in to leave comments.
Login now