evolve: fix a bug in logic of choosing destination for hg update stable
authorSushil khanchi <sushilkhanchi97@gmail.com>
Fri, 20 Dec 2019 17:31:57 +0530
branchstable
changeset 5024 b1a9d548af52
parent 5023 abefd37c6afa
child 5025 21168e99ba88
evolve: fix a bug in logic of choosing destination for hg update
hgext3rd/topic/destination.py
tests/test-topic-dest.t
--- a/hgext3rd/topic/destination.py	Fri Dec 20 17:17:30 2019 +0530
+++ b/hgext3rd/topic/destination.py	Fri Dec 20 17:31:57 2019 +0530
@@ -66,13 +66,15 @@
         return None, None, None
     movemark = node = None
     topic = repo.currenttopic
+    revs = []
     if topic:
         revs = repo.revs(b'.::topic(%s)', topic)
     else:
-        revs = []
-    if not revs:
         return None, None, None
-    node = revs.last()
+    if revs:
+        node = revs.last()
+    else:
+        node = repo[b'.'].node()
     if bookmarks.isactivewdirparent(repo):
         movemark = repo[b'.'].node()
     return node, movemark, None
--- a/tests/test-topic-dest.t	Fri Dec 20 17:17:30 2019 +0530
+++ b/tests/test-topic-dest.t	Fri Dec 20 17:31:57 2019 +0530
@@ -512,5 +512,6 @@
   adding a
   $ hg topic foo
   marked working directory as topic: foo
-  $ hg up 2>&1 | grep "AssertionError"
-  AssertionError: any branch has at least one head
+  $ hg up
+  clearing empty topic "foo"
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved