changeset 2938:9872526fc39f

topic: show the t0 even if topic is not yet touched
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 15 Sep 2017 23:25:38 +0530
parents b54abc7e80e2
children 7759d040d48d
files hgext3rd/topic/stack.py tests/test-topic-stack.t tests/test-topic.t
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Fri Sep 15 23:13:05 2017 +0530
+++ b/hgext3rd/topic/stack.py	Fri Sep 15 23:25:38 2017 +0530
@@ -131,9 +131,12 @@
         # step 3: add t0
         if revs:
             pt1 = self._repo[revs[0]].p1()
-            if pt1.obsolete():
-                pt1 = self._repo[_singlesuccessor(self._repo, pt1)]
-            revs.insert(0, pt1.rev())
+        else:
+            pt1 = self._repo['.']
+
+        if pt1.obsolete():
+            pt1 = self._repo[_singlesuccessor(self._repo, pt1)]
+        revs.insert(0, pt1.rev())
         return revs
 
     @util.propertycache
--- a/tests/test-topic-stack.t	Fri Sep 15 23:13:05 2017 +0530
+++ b/tests/test-topic-stack.t	Fri Sep 15 23:25:38 2017 +0530
@@ -68,6 +68,7 @@
   ### topic: other
   ### branch: default
   (stack is empty)
+  t0^ c_b (base)
 
   $ hg up foo
   switching to topic foo
@@ -227,6 +228,7 @@
   $ hg stack
   ### branch: default
   (stack is empty)
+  b0^ c_f (base)
 
 Test "t#" reference
 -------------------
--- a/tests/test-topic.t	Fri Sep 15 23:13:05 2017 +0530
+++ b/tests/test-topic.t	Fri Sep 15 23:25:38 2017 +0530
@@ -144,6 +144,7 @@
   ### topic: narf
   ### branch: default
   (stack is empty)
+  t0^ Add file delta (base)
 
 Add commits to topic