Commit fef934b7 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

topic: add a --topic option to "push" command

This is symmetrical with --bookmark or --branch; it selects changesets in
specified topic as revisions to push.
parent 86be70ae38b9
......@@ -137,6 +137,7 @@
* topic: add a new 'debugconvertbookmark' commands.
It helps migrating from bookmark feature branch to topic feature branch.
* topic: small clarification and cleanup on various output
* push: add a --topic option to mirror --bookmark and --branch.
6.6.0 -- 2017-07-25
-------------------
......
......@@ -198,6 +198,10 @@
entry[1].append(('t', 'topic', '',
_("use specified topic"), _('TOPIC')))
entry = extensions.wrapcommand(commands.table, 'push', pushwrap)
entry[1].append(('t', 'topic', '',
_("topic to push"), _('TOPIC')))
extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
extensions.wrapfunction(merge, 'update', mergeupdatewrap)
# We need to check whether t0 or b0 is passed to override the default update
......@@ -824,6 +828,12 @@
"\nHG: topic '%s'\nHG: branch" % t)
return ret
def pushwrap(orig, ui, repo, *args, **opts):
if opts.get('topic'):
topicrevs = repo.revs('topic(%s) - obsolete()', opts['topic'])
opts.setdefault('rev', []).extend(topicrevs)
return orig(ui, repo, *args, **opts)
def mergeupdatewrap(orig, repo, node, branchmerge, force, *args, **kwargs):
matcher = kwargs.get('matcher')
partial = not (matcher is None or matcher.always())
......
......@@ -157,6 +157,57 @@
|/
o 0 default public CA
push --topic
$ hg log -G -R $TESTTMP/draft
o 3 default babar draft CD
|
| o 2 mountain public CC
|/
| o 1 default public CB
|/
o 0 default public CA
$ echo bbb >> aaa
$ hg commit -m "C'A"
$ hg up 1
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg topic --clear
$ echo bbb >> bbb
$ hg commit -m "C'B"
$ hg log -G
@ 6 default draft C'B
|
| o 5 default babar draft C'A
| |
| o 4 default babar draft CD
| |
| | o 3 mountain public CC
| |/
o | 1 default public CB
|/
o 0 default public CA
$ hg push draft --topic babar
pushing to $TESTTMP/draft
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
$ hg log -G -R $TESTTMP/draft
o 4 default babar draft C'A
|
o 3 default babar draft CD
|
| o 2 mountain public CC
|/
| o 1 default public CB
|/
o 0 default public CA
$ hg strip --config extensions.strip= --no-backup -r 5: --quiet
$ hg strip --config extensions.strip= -R $TESTTMP/draft --no-backup -r 4: --quiet
Pushing a new topic to a publishing server should be seen as a new head
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment