pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Previous patch from Matt demonstrates that `debugtagscache` does not warn 
about
  filenode being invalid which can be caused by a corrupted cache.
  
  We start by showing that it's an invalid node.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-tags.t

CHANGE DETAILS

diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -444,12 +444,12 @@
 
   $ hg debugtagscache | tail -2
   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 
0c04f2a8af31de17fab7422878ee5a2dadbc943d
-  5 8dbfe60eff306a54259cfe007db9e330e7ecf866 
0c04f2a8deadde17fab7422878ee5a2dadbc943d
+  5 8dbfe60eff306a54259cfe007db9e330e7ecf866 
0c04f2a8deadde17fab7422878ee5a2dadbc943d (invalid node)
 
   $ rm -f .hg/cache/tags2-visible
   $ hg debugtagscache | tail -2
   4 0c192d7d5e6b78a714de54a2e9627952a877e25a 
0c04f2a8af31de17fab7422878ee5a2dadbc943d
-  5 8dbfe60eff306a54259cfe007db9e330e7ecf866 
0c04f2a8deadde17fab7422878ee5a2dadbc943d
+  5 8dbfe60eff306a54259cfe007db9e330e7ecf866 
0c04f2a8deadde17fab7422878ee5a2dadbc943d (invalid node)
 
   $ hg tags
   abort: data/.hgtags.i@0c04f2a8deadde17fab7422878ee5a2dadbc943d: no match 
found
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3870,6 +3870,10 @@
         tagsnode = cache.getfnode(node, computemissing=False)
         if tagsnode:
             tagsnodedisplay = hex(tagsnode)
+            try:
+                repo.filectx(b'.hgtags', fileid=tagsnode).data()
+            except error.LookupError:
+                tagsnodedisplay += b' (invalid node)'
         elif tagsnode is None:
             tagsnodedisplay = b'missing'
         else:



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to