##// 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 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, obsolete, error
18 from mercurial import extensions, patch, scmutil, phases, obsolete, error
19 from mercurial import copies, repoview
19 from mercurial import copies, repoview, revset
20 from mercurial.commands import templateopts
20 from mercurial.commands import templateopts
21 from mercurial.node import nullrev, nullid, hex, short
21 from mercurial.node import nullrev, nullid, hex, short
22 from mercurial.lock import release
22 from mercurial.lock import release
@@ -54,6 +54,21 b' def _makeextrafn(copiers):'
54 c(ctx, extra)
54 c(ctx, extra)
55 return extrafn
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 @command('rebase',
72 @command('rebase',
58 [('s', 'source', '',
73 [('s', 'source', '',
59 _('rebase the specified changeset and descendants'), _('REV')),
74 _('rebase the specified changeset and descendants'), _('REV')),
@@ -252,12 +267,8 b' def rebase(ui, repo, **opts):'
252 cmdutil.bailifchanged(repo)
267 cmdutil.bailifchanged(repo)
253
268
254 if not destf:
269 if not destf:
255 # Destination defaults to the latest revision in the
270 destf = '_rebasedefaultdest()'
256 # current branch
271 dest = scmutil.revsingle(repo, destf)
257 branch = repo[None].branch()
258 dest = repo[branch]
259 else:
260 dest = scmutil.revsingle(repo, destf)
261
272
262 if revf:
273 if revf:
263 rebaseset = scmutil.revrange(repo, revf)
274 rebaseset = scmutil.revrange(repo, revf)
@@ -1126,3 +1137,4 b' def uisetup(ui):'
1126 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1137 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1127 # ensure rebased rev are not hidden
1138 # ensure rebased rev are not hidden
1128 extensions.wrapfunction(repoview, '_getdynamicblockers', _rebasedvisible)
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