changeset 5454:e31e7618cad4 stable

topic: substitute current topic when `--topic .` is used for outgoing/push This special case is similar to `hg outgoing/push -B .`, where currently active bookmark is used instead of `.`.
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 12 Jun 2020 15:42:43 +0800
parents 7f80558c9b8d
children fb543438704b 8848e64fd431
files CHANGELOG hgext3rd/topic/__init__.py tests/test-topic-push.t
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Thu Jun 11 18:50:29 2020 +0800
+++ b/CHANGELOG	Fri Jun 12 15:42:43 2020 +0800
@@ -16,6 +16,7 @@
 
   * topic: hg push --topic does-not-exist now doesn't try to push unrelated
     changesets and aborts instead
+  * topic: hg outgoing/push --topic . will use current topic
 
 10.0.0 -- 2020-05-09
 --------------------
--- a/hgext3rd/topic/__init__.py	Thu Jun 11 18:50:29 2020 +0800
+++ b/hgext3rd/topic/__init__.py	Fri Jun 12 15:42:43 2020 +0800
@@ -1269,7 +1269,10 @@
 
 def pushoutgoingwrap(orig, ui, repo, *args, **opts):
     if opts.get('topic'):
-        topic = b'literal:' + opts['topic']
+        topic = opts['topic']
+        if topic == b'.':
+            topic = repo.currenttopic
+        topic = b'literal:' + topic
         topicrevs = repo.revs(b'topic(%s) - obsolete()', topic)
         opts.setdefault('rev', []).extend(topicrevs)
     return orig(ui, repo, *args, **opts)
--- a/tests/test-topic-push.t	Thu Jun 11 18:50:29 2020 +0800
+++ b/tests/test-topic-push.t	Fri Jun 12 15:42:43 2020 +0800
@@ -200,6 +200,14 @@
   abort: topic 'nonexistent' does not exist!
   [255]
 
+  $ hg up babar
+  switching to topic babar
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg outgoing draft --topic .
+  comparing with $TESTTMP/draft
+  searching for changes
+  5 default babar draft C'A
+
   $ hg outgoing draft --topic babar
   comparing with $TESTTMP/draft
   searching for changes