Patchwork D3161: convert: look up branch only among branches

login
register
mail settings
Submitter phabricator
Date April 6, 2018, 5:47 p.m.
Message ID <differential-rev-PHID-DREV-adw4zceeqslbzi6hfhqv-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30445/
State Superseded
Headers show

Comments

phabricator - April 6, 2018, 5:47 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  repo[<branch name>] can find something that's not a branch, which is
  not good.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3161

AFFECTED FILES
  hgext/convert/hg.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -363,10 +363,8 @@ 
         return p2
 
     def puttags(self, tags):
-        try:
-            tagparent = self.repo[self.tagsbranch].node()
-        except error.RepoError:
-            tagparent = nodemod.nullid
+        tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True)
+        tagparent = tagparent or nodemod.nullid
 
         oldlines = set()
         for branch, heads in self.repo.branchmap().iteritems():