topic: add a --topic option to "outgoing" command
authorDenis Laxalde <denis.laxalde@logilab.fr>
Fri, 22 Sep 2017 13:46:41 +0200
changeset 2983 c0de0010ec30
parent 2982 fef934b7ed86
child 2984 30f6030dca8f
topic: add a --topic option to "outgoing" command By symmetry with "push" in the previous changeset.
hgext3rd/topic/__init__.py
tests/test-topic-push.t
--- a/hgext3rd/topic/__init__.py	Fri Sep 22 13:43:38 2017 +0200
+++ b/hgext3rd/topic/__init__.py	Fri Sep 22 13:46:41 2017 +0200
@@ -198,7 +198,12 @@
     entry[1].append(('t', 'topic', '',
                      _("use specified topic"), _('TOPIC')))
 
-    entry = extensions.wrapcommand(commands.table, 'push', pushwrap)
+    entry = extensions.wrapcommand(commands.table, 'push', pushoutgoingwrap)
+    entry[1].append(('t', 'topic', '',
+                     _("topic to push"), _('TOPIC')))
+
+    entry = extensions.wrapcommand(commands.table, 'outgoing',
+                                   pushoutgoingwrap)
     entry[1].append(('t', 'topic', '',
                      _("topic to push"), _('TOPIC')))
 
@@ -828,7 +833,7 @@
                           "\nHG: topic '%s'\nHG: branch" % t)
     return ret
 
-def pushwrap(orig, ui, repo, *args, **opts):
+def pushoutgoingwrap(orig, ui, repo, *args, **opts):
     if opts.get('topic'):
         topicrevs = repo.revs('topic(%s) - obsolete()', opts['topic'])
         opts.setdefault('rev', []).extend(topicrevs)
--- a/tests/test-topic-push.t	Fri Sep 22 13:43:38 2017 +0200
+++ b/tests/test-topic-push.t	Fri Sep 22 13:46:41 2017 +0200
@@ -188,6 +188,10 @@
   |/
   o  0 default  public CA
   
+  $ hg outgoing draft --topic babar
+  comparing with $TESTTMP/draft
+  searching for changes
+  5 default babar draft C'A
   $ hg push draft --topic babar
   pushing to $TESTTMP/draft
   searching for changes