13 For more information: |
13 For more information: |
14 http://mercurial.selenic.com/wiki/RebaseExtension |
14 http://mercurial.selenic.com/wiki/RebaseExtension |
15 ''' |
15 ''' |
16 |
16 |
17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks |
17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks |
18 from mercurial import extensions, patch, scmutil, phases |
18 from mercurial import extensions, patch, scmutil, phases, obsolete |
19 from mercurial.commands import templateopts |
19 from mercurial.commands import templateopts |
20 from mercurial.node import nullrev |
20 from mercurial.node import nullrev |
21 from mercurial.lock import release |
21 from mercurial.lock import release |
22 from mercurial.i18n import _ |
22 from mercurial.i18n import _ |
23 import os, errno |
23 import os, errno |
656 state.update(dict.fromkeys(detachset, nullmerge)) |
656 state.update(dict.fromkeys(detachset, nullmerge)) |
657 return repo['.'].rev(), dest.rev(), state |
657 return repo['.'].rev(), dest.rev(), state |
658 |
658 |
659 def clearrebased(ui, repo, state): |
659 def clearrebased(ui, repo, state): |
660 """dispose of rebased revision at the end of the rebase""" |
660 """dispose of rebased revision at the end of the rebase""" |
661 rebased = [rev for rev in state if state[rev] != nullmerge] |
661 if obsolete._enabled: |
662 if rebased: |
662 markers = [] |
663 if set(repo.changelog.descendants([min(rebased)])) - set(state): |
663 for rev, newrev in sorted(state.items()): |
664 ui.warn(_("warning: new changesets detected " |
664 if newrev >= 0: |
665 "on source branch, not stripping\n")) |
665 markers.append((repo[rev], (repo[newrev],))) |
666 else: |
666 if markers: |
667 # backup the old csets by default |
667 obsolete.createmarkers(repo, markers) |
668 repair.strip(ui, repo, repo[min(rebased)].node(), "all") |
668 else: |
|
669 rebased = [rev for rev in state if state[rev] != nullmerge] |
|
670 if rebased: |
|
671 if set(repo.changelog.descendants([min(rebased)])) - set(state): |
|
672 ui.warn(_("warning: new changesets detected " |
|
673 "on source branch, not stripping\n")) |
|
674 else: |
|
675 # backup the old csets by default |
|
676 repair.strip(ui, repo, repo[min(rebased)].node(), "all") |
669 |
677 |
670 |
678 |
671 def pullrebase(orig, ui, repo, *args, **opts): |
679 def pullrebase(orig, ui, repo, *args, **opts): |
672 'Call rebase after pull if the latter has been invoked with --rebase' |
680 'Call rebase after pull if the latter has been invoked with --rebase' |
673 if opts.get('rebase'): |
681 if opts.get('rebase'): |