test: use `hg log` in the `getid` function stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 25 Jul 2014 14:27:16 +0200
branchstable
changeset 1025 b96c9af18453
parent 1012 205d549a972f
child 1026 35adaf02b777
test: use `hg log` in the `getid` function using `hg id` to retrieve full lenght node requires to use --debug. This may include debug output (regarding branch cache invalidation for example) that breaks the test. We now use `hg log` with a custom template. This is a simple, clean and robust solution.
hgext/drophack.py
tests/_exc-util.sh
tests/test-exchange-A5.t
tests/test-exchange-C4.t
tests/test-exchange-D4.t
--- a/hgext/drophack.py	Wed Jul 30 13:38:33 2014 -0700
+++ b/hgext/drophack.py	Fri Jul 25 14:27:16 2014 +0200
@@ -106,7 +106,7 @@
     # lock from the beginning to prevent race
     wlock = lock = None
     try:
-        lock = repo.wlock()
+        wlock = repo.wlock()
         lock = repo.lock()
         # check they have no children
         if repo.revs('%ld and public()', revs):
--- a/tests/_exc-util.sh	Wed Jul 30 13:38:33 2014 -0700
+++ b/tests/_exc-util.sh	Fri Jul 25 14:27:16 2014 +0200
@@ -20,7 +20,7 @@
    hg ci -m "$1"
 }
 getid() {
-   hg id --hidden --debug -ir "$1"
+   hg log --hidden --template '{node}\n' --rev "$1"
 }
 
 setuprepos() {
--- a/tests/test-exchange-A5.t	Wed Jul 30 13:38:33 2014 -0700
+++ b/tests/test-exchange-A5.t	Fri Jul 25 14:27:16 2014 +0200
@@ -54,7 +54,6 @@
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A0)'`
   $ hg debugobsolete `getid 'desc(B0)'` `getid 'desc(B1)'`
   $ hg debugobsolete `getid 'desc(A0)'` `getid 'desc(A1)'`
-  invalid branchheads cache (served): tip differs
   $ hg log -G --hidden
   @  8c0a98c83722 (draft): A1
   |
--- a/tests/test-exchange-C4.t	Wed Jul 30 13:38:33 2014 -0700
+++ b/tests/test-exchange-C4.t	Fri Jul 25 14:27:16 2014 +0200
@@ -56,7 +56,6 @@
   created new head
   $ hg debugobsolete --hidden `getid 'desc(A)'` `getid 'desc(B)'`
   $ hg debugobsolete --hidden `getid 'desc(A)'` `getid 'desc(C)'`
-  invalid branchheads cache (served): tip differs
   $ hg prune -qd '0 0' .
   $ hg log -G --hidden
   x  7f7f229b13a6 (draft): C
--- a/tests/test-exchange-D4.t	Wed Jul 30 13:38:33 2014 -0700
+++ b/tests/test-exchange-D4.t	Fri Jul 25 14:27:16 2014 +0200
@@ -49,7 +49,6 @@
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A1)'`
   $ hg debugobsolete `getid 'desc(B0)'` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb `getid 'desc(B1)'`
-  invalid branchheads cache (served): tip differs
   $ hg log -G --hidden
   @  069b05c3876d (draft): B1
   |