##// END OF EJS Templates
rebase: move destination computation in a revset...
Pierre-Yves David -
r26301:3f8c5c28 default
parent child Browse files
Show More
@@ -16,7 +16,7 b' http://mercurial.selenic.com/wiki/Rebase'
16 16
17 17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks
18 18 from mercurial import extensions, patch, scmutil, phases, obsolete, error
19 from mercurial import copies, repoview
19 from mercurial import copies, repoview, revset
20 20 from mercurial.commands import templateopts
21 21 from mercurial.node import nullrev, nullid, hex, short
22 22 from mercurial.lock import release
@@ -54,6 +54,21 b' def _makeextrafn(copiers):'
54 54 c(ctx, extra)
55 55 return extrafn
56 56
57 def _rebasedefaultdest(repo, subset, x):
58 # ``_rebasedefaultdest()``
59
60 # default destination for rebase.
61 # # XXX: Currently private because I expect the signature to change.
62 # # XXX: - taking rev as arguments,
63 # # XXX: - bailing out in case of ambiguity vs returning all data.
64 # # XXX: - probably merging with the merge destination.
65 # i18n: "_rebasedefaultdest" is a keyword
66 revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments"))
67 # Destination defaults to the latest revision in the
68 # current branch
69 branch = repo[None].branch()
70 return subset & revset.baseset([repo[branch].rev()])
71
57 72 @command('rebase',
58 73 [('s', 'source', '',
59 74 _('rebase the specified changeset and descendants'), _('REV')),
@@ -252,11 +267,7 b' def rebase(ui, repo, **opts):'
252 267 cmdutil.bailifchanged(repo)
253 268
254 269 if not destf:
255 # Destination defaults to the latest revision in the
256 # current branch
257 branch = repo[None].branch()
258 dest = repo[branch]
259 else:
270 destf = '_rebasedefaultdest()'
260 271 dest = scmutil.revsingle(repo, destf)
261 272
262 273 if revf:
@@ -1126,3 +1137,4 b' def uisetup(ui):'
1126 1137 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1127 1138 # ensure rebased rev are not hidden
1128 1139 extensions.wrapfunction(repoview, '_getdynamicblockers', _rebasedvisible)
1140 revset.symbols['_rebasedefaultdest'] = _rebasedefaultdest
General Comments 0
You need to be logged in to leave comments. Login now