Patchwork [4,of,7] extdata: ignore ambiguous identifier as well

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 1, 2017, noon
Message ID <18b0ae593fb5f3918785.1506859215@mimosa>
Download mbox | patch
Permalink /patch/24334/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 1, 2017, noon
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1506855401 -3600
#      Sun Oct 01 11:56:41 2017 +0100
# Node ID 18b0ae593fb5f391878567cd0f676c623847614e
# Parent  2b81a9a4752373722a9a568c7031dcf53171cc6b
extdata: ignore ambiguous identifier as well

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1059,9 +1059,10 @@  def extdatasource(repo, source):
                 k, v = l.strip(), ""
 
             k = encoding.tolocal(k)
-            if k in repo:
-                # we ignore data for nodes that don't exist locally
+            try:
                 data[repo[k].rev()] = encoding.tolocal(v)
+            except (error.LookupError, error.RepoLookupError):
+                pass # we ignore data for nodes that don't exist locally
     finally:
         src.close()
 
diff --git a/tests/test-extdata.t b/tests/test-extdata.t
--- a/tests/test-extdata.t
+++ b/tests/test-extdata.t
@@ -1,6 +1,6 @@ 
   $ hg init repo
   $ cd repo
-  $ for n in 0 1 2 3; do
+  $ for n in 0 1 2 3 4 5 6 7 8 9 10 11; do
   >   echo $n > $n
   >   hg ci -qAm $n
   > done
@@ -22,6 +22,7 @@  test revset support
   > e834 this is buggy :(
   > 0625 first post
   > bogusnode gives no error
+  > a ambiguous node gives no error
   > EOF
 
   $ hg log -qr "extdata(filedata)"