changeset 5024:b1a9d548af52 stable

evolve: fix a bug in logic of choosing destination for hg update
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Fri, 20 Dec 2019 17:31:57 +0530
parents abefd37c6afa
children 21168e99ba88
files hgext3rd/topic/destination.py tests/test-topic-dest.t
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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