[PATCH] test-obsolete: use 'log -T {node}' instead of 'id --debug -i' to lookup hash

Matt Harbison mharbison72 at gmail.com
Sat Feb 28 06:28:33 UTC 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1425103974 18000
#      Sat Feb 28 01:12:54 2015 -0500
# Node ID bc662fcdfcd2e4b91fb98b82695db9e0a4502383
# Parent  7a21944731557cd18dc5c53969318d80ec547e2d
test-obsolete: use 'log -T {node}' instead of 'id --debug -i' to lookup hash

I ran into a case when adding a test where there were cryptic hg command line
errors.  I eventually traced it back to 'hg id' printing debug messages before
the hash:

    invalid branchheads cache (served): tip differs <hash>

This method should eliminate any other output except the node.

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -11,7 +11,7 @@
   >    hg ci -m "add $1"
   > }
   $ getid() {
-  >    hg id --debug --hidden -ir "desc('$1')"
+  >    hg log -T "{node}\n" --hidden -r "desc('$1')"
   > }
 
   $ cat > debugkeys.py <<EOF
@@ -621,7 +621,7 @@
 
 check filelog view
 
-  $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
+  $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg log -r . -T "{node}"`/'babar'
   200 Script output follows
 
   $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'rev/68'


More information about the Mercurial-devel mailing list