[PATCH 0 of 8 V2 next] more test cleanup

51 views
Skip to first unread message

David Carr

unread,
Nov 3, 2012, 10:58:23 PM11/3/12
to hg-...@googlegroups.com
This is a revised version of my previous test patch series.

* V1 #1,2,4,5 were not re-sent, as they were already accepted
* V1 #3 was re-worked as V2 #1, to require dulwich and git for all tests
* V2 #2-6 are re-sent fundamentally unchanged from V1
(though I did refresh them and re-run the tests)
* V2 #7-8 are new

David Carr

unread,
Nov 3, 2012, 10:58:24 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351984310 14400
# Node ID 675f19af79cafd4a95677bf73c4d2663f5cc8022
# Parent 935c4fb1bbfcce3f3c235b1918c55b1bc1f054b9
tests: extract git command-line client and dulwich requirements into testutil

One or both of these requirements were in almost every test in exactly the same
way. Now, these checks are performed in every test that uses the testutil.
This makes it easier for test authors to add these checks into new tests (just
add a reference to the testutil, which you'd probably want anyway).

We considered having each test declare their requirements (currently, either
"git" or "dulwich"), but in this case, preferred the simplicity of having the
check always performed (even if a particular test doesn't need one or the
other). You can't perform any meaningful testing of Hg-Git without both of
these dependencies properly configured. The main value to checking for them
in the tests (rather than just letting the tests fail) is that it gives a
meaningful error message to help people figure out how to fix their environment.
In the case that either git or dulwich is missing, the information will be
just as clearly conveyed regardless of whether its all the tests that are
skipped, or just most of them.

I didn't add dulwich to hghave (even though this is clearly the sort of thing
that hghave is intended for) because hghave is currently pulled from Mercurial
completely unchanged, and it's probably best to keep it that way.

Tested by running the tests in three configurations:
* No dulwich installed (ran 0, skipped 28, failed 0, output:
Skipped *: missing feature: dulwich)
* Bad git on path (ran 1, skipped 27, failed 0, output:
Skipped *: missing feature: git command line client)
* Working git and correct version of dulwich installed
(ran 28, skipped 0, failed 0)

Thanks to Felipe Contreras for the idea to extract this logic into a library.

diff --git a/tests/test-bookmark-workflow.t b/tests/test-bookmark-workflow.t
--- a/tests/test-bookmark-workflow.t
+++ b/tests/test-bookmark-workflow.t
@@ -12,12 +12,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-Bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
Skip if Mercurial < 2.1; workflow was different before that
$ python -c 'from mercurial import util ; assert \
> util.version() != "unknown" and util.version() >= "2.1"' || exit 80
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-conflict-1.t b/tests/test-conflict-1.t
--- a/tests/test-conflict-1.t
+++ b/tests/test-conflict-1.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ hg init hgrepo1
$ cd hgrepo1
$ echo A > afile
diff --git a/tests/test-conflict-2.t b/tests/test-conflict-2.t
--- a/tests/test-conflict-2.t
+++ b/tests/test-conflict-2.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ hg init hgrepo1
$ cd hgrepo1
$ echo A > afile
diff --git a/tests/test-convergedmerge.t b/tests/test-convergedmerge.t
--- a/tests/test-convergedmerge.t
+++ b/tests/test-convergedmerge.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ hg init hgrepo1
$ cd hgrepo1
$ echo A > afile
diff --git a/tests/test-empty-working-tree.t b/tests/test-empty-working-tree.t
--- a/tests/test-empty-working-tree.t
+++ b/tests/test-empty-working-tree.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -3,12 +3,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
$ GIT_AUTHOR_EMAIL='te...@example.org'; export GIT_AUTHOR_EMAIL
$ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
diff --git a/tests/test-file-removal.t b/tests/test-file-removal.t
--- a/tests/test-file-removal.t
+++ b/tests/test-file-removal.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-git-clone.t b/tests/test-git-clone.t
--- a/tests/test-git-clone.t
+++ b/tests/test-git-clone.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-git-submodules.t b/tests/test-git-submodules.t
--- a/tests/test-git-submodules.t
+++ b/tests/test-git-submodules.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo1
Initialized empty Git repository in $TESTTMP/gitrepo1/.git/
$ cd gitrepo1
diff --git a/tests/test-git-tags.t b/tests/test-git-tags.t
--- a/tests/test-git-tags.t
+++ b/tests/test-git-tags.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-git-workflow.t b/tests/test-git-workflow.t
--- a/tests/test-git-workflow.t
+++ b/tests/test-git-workflow.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ hg init hgrepo
$ cd hgrepo
$ echo alpha > alpha
diff --git a/tests/test-hg-author.t b/tests/test-hg-author.t
--- a/tests/test-hg-author.t
+++ b/tests/test-hg-author.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-hg-branch.t b/tests/test-hg-branch.t
--- a/tests/test-hg-branch.t
+++ b/tests/test-hg-branch.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
TODO stop using this when we're 1.5 only
$ filterhash="sed s/71414c4e3c6f/a31e374801c9/;s/698615204564/d93a72262a83/"
$ filterhash="$filterhash;s/d93a72262a83/05aed681ccb3/"
diff --git a/tests/test-hg-tags.t b/tests/test-hg-tags.t
--- a/tests/test-hg-tags.t
+++ b/tests/test-hg-tags.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-incoming.t b/tests/test-incoming.t
--- a/tests/test-incoming.t
+++ b/tests/test-incoming.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
This test only works on hg 1.7 and later
$ python -c 'from mercurial import util ; assert \
> util.version() != "unknown" and util.version() > "1.7"' || exit 80
diff --git a/tests/test-keywords.t b/tests/test-keywords.t
--- a/tests/test-keywords.t
+++ b/tests/test-keywords.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-merge.t b/tests/test-merge.t
--- a/tests/test-merge.t
+++ b/tests/test-merge.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-octopus.t b/tests/test-octopus.t
--- a/tests/test-octopus.t
+++ b/tests/test-octopus.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-outgoing.t b/tests/test-outgoing.t
--- a/tests/test-outgoing.t
+++ b/tests/test-outgoing.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-pull-after-strip.t b/tests/test-pull-after-strip.t
--- a/tests/test-pull-after-strip.t
+++ b/tests/test-pull-after-strip.t
@@ -1,9 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
this test is busted on hg < 1.5. I'm not sure how to fix it.
$ cat > tmp.py <<EOF
> import sys
@@ -15,9 +12,6 @@

$ hg version | grep version | sed 's/.*(version //' | python tmp.py || exit 80

-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-pull.t b/tests/test-pull.t
--- a/tests/test-pull.t
+++ b/tests/test-pull.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
set up a git repo with some commits, branches and a tag
$ git init -q gitrepo
$ cd gitrepo
diff --git a/tests/test-push-r.t b/tests/test-push-r.t
--- a/tests/test-push-r.t
+++ b/tests/test-push-r.t
@@ -1,9 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ hg init test
$ cd test
$ cat >>afile <<EOF
diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/test-subrepos.t b/tests/test-subrepos.t
--- a/tests/test-subrepos.t
+++ b/tests/test-subrepos.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitsubrepo
Initialized empty Git repository in $TESTTMP/gitsubrepo/.git/
$ cd gitsubrepo
diff --git a/tests/test-tree-decomposition.t b/tests/test-tree-decomposition.t
--- a/tests/test-tree-decomposition.t
+++ b/tests/test-tree-decomposition.t
@@ -1,12 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-bail if the user does not have git command-line client
- $ "$TESTDIR/hghave" git || exit 80
-
-bail if the user does not have dulwich
- $ python -c 'import dulwich, dulwich.repo' || exit 80
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
diff --git a/tests/testutil b/tests/testutil
--- a/tests/testutil
+++ b/tests/testutil
@@ -11,6 +11,15 @@
echo 'graphlog=' >> $HGRCPATH
echo 'mq=' >> $HGRCPATH

+# Standard checks for external dependencies
+# We use the git command-line client and dulwich in pretty much all the tests.
+# Thus, to avoid repetitively declaring that requirement in almost every test,
+# we just call the checks in all tests that include this library.
+python -c 'import dulwich' || {
+ echo "skipped: missing feature: dulwich" && exit 80
+}
+"$TESTDIR/hghave" git || exit 80
+
GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL='te...@example.org'; export GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE

David Carr

unread,
Nov 3, 2012, 10:58:25 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351984328 14400
# Node ID 6cc99298b69e974576e02be1bc9ee801a54c3400
# Parent 675f19af79cafd4a95677bf73c4d2663f5cc8022
tests: avoid changing the current directory

Mercurial allows specifying which repository to use via the -R/--repository
option. Git allows a similar function using the --git-dir option. By using
these options, in many cases we can avoid checking the current directory.
This makes tests easier to understand, as you don't need to remember which
directory you're in to understand what's going on. It also makes tests easier
to write, as you don't need to remember to cd out of a directory when you're
done doing things there.

Thanks to Felipe Contreras for the patch which this was based on.

diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t

@@ -23,8 +23,7 @@
$ hg clone -r alpha gitrepo hgrepo-a | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo-a
- $ hg log --graph | egrep -v ': *(beta|master)'
+ $ hg -R hgrepo-a log --graph | egrep -v ': *(beta|master)'
@ changeset: 0:3442585be8a6
tag: alpha
tag: default/master
@@ -33,15 +32,12 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

-
- $ cd ..
$ echo % clone a branch
% clone a branch
$ hg clone -r beta gitrepo hgrepo-b | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo-b
- $ hg log --graph | egrep -v ': *(beta|master)'
+ $ hg -R hgrepo-b log --graph | egrep -v ': *(beta|master)'
@ changeset: 1:7bcd915dc873
| tag: default/beta
| tag: tip
@@ -56,6 +52,3 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

-
-
- $ cd ..


diff --git a/tests/test-conflict-1.t b/tests/test-conflict-1.t
--- a/tests/test-conflict-1.t
+++ b/tests/test-conflict-1.t

@@ -55,10 +55,9 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
$ echo % expect the same revision ids as above
% expect the same revision ids as above
- $ hg log --graph --style compact | sed 's/\[.*\]//g'
+ $ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 3:1,2 6c53bc0f062f 1970-01-01 00:00 +0000 test
|\ merge to C
| |
@@ -71,5 +70,3 @@
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin

-
- $ cd ..


diff --git a/tests/test-conflict-2.t b/tests/test-conflict-2.t
--- a/tests/test-conflict-2.t
+++ b/tests/test-conflict-2.t

@@ -55,10 +55,9 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
$ echo % expect the same revision ids as above
% expect the same revision ids as above
- $ hg log --graph --style compact | sed 's/\[.*\]//g'
+ $ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 3:1,2 120385945d08 1970-01-01 00:00 +0000 test
|\ merge to B
| |
@@ -71,5 +70,3 @@
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin

-
- $ cd ..


diff --git a/tests/test-convergedmerge.t b/tests/test-convergedmerge.t
--- a/tests/test-convergedmerge.t
+++ b/tests/test-convergedmerge.t

@@ -56,10 +56,9 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
$ echo % expect the same revision ids as above
% expect the same revision ids as above
- $ hg log --graph --style compact | sed 's/\[.*\]//g'
+ $ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 4:1,3 eaa21d002113 1970-01-01 00:00 +0000 test
|\ merge
| |
@@ -75,5 +74,3 @@
o 0 5d1a6b64f9d0 1970-01-01 00:00 +0000 test
origin

-
- $ cd ..


diff --git a/tests/test-empty-working-tree.t b/tests/test-empty-working-tree.t
--- a/tests/test-empty-working-tree.t
+++ b/tests/test-empty-working-tree.t

@@ -22,13 +22,10 @@
$ hg push ../gitrepo2
pushing to ../gitrepo2
searching for changes
-
- $ cd ../gitrepo2
- $ git log --pretty=medium
+ $ cd ..
+ $ git --git-dir=gitrepo2 log --pretty=medium
commit 678256865a8c85ae925bf834369264193c88f8de
Author: test <te...@example.org>
Date: Mon Jan 1 00:00:00 2007 +0000

empty
-
- $ cd ..


diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t

@@ -112,8 +112,8 @@
pushing to ../gitrepo2
searching for changes

- $ cd ../gitrepo2
- $ git log --pretty=medium
+ $ cd ..
+ $ git --git-dir=gitrepo2 log --pretty=medium
commit da0edb01d4f3d1abf08b1be298379b0b2960e680
Author: t\xe9st \xe8nc\xf6d\xeeng <te...@example.org> (esc)
Date: Mon Jan 1 00:00:13 2007 +0000
@@ -137,5 +137,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add älphà
-
- $ cd ..


diff --git a/tests/test-file-removal.t b/tests/test-file-removal.t
--- a/tests/test-file-removal.t
+++ b/tests/test-file-removal.t

@@ -83,8 +83,8 @@
pushing to ../gitrepo2
searching for changes

- $ cd ../gitrepo2
- $ git log --pretty=medium
+ $ cd ..
+ $ git --git-dir=gitrepo2 log --pretty=medium
commit b991de8952c482a7cd51162674ffff8474862218
Author: test <te...@example.org>
Date: Mon Jan 1 00:00:14 2007 +0000
@@ -114,5 +114,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add alpha
-
- $ cd ..


diff --git a/tests/test-git-clone.t b/tests/test-git-clone.t
--- a/tests/test-git-clone.t
+++ b/tests/test-git-clone.t

@@ -16,8 +16,7 @@
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo
- $ hg log --graph | grep -v ': *master'
+ $ hg -R hgrepo log --graph | grep -v ': *master'
@ changeset: 1:7bcd915dc873
| tag: default/master
| tag: tip
@@ -33,5 +32,5 @@

$ echo % we should have some bookmarks
% we should have some bookmarks
- $ hg book
+ $ hg -R hgrepo book
* master 1:7bcd915dc873


diff --git a/tests/test-git-submodules.t b/tests/test-git-submodules.t
--- a/tests/test-git-submodules.t
+++ b/tests/test-git-submodules.t

@@ -52,8 +52,7 @@
$ hg clone gitrepo2 hgrepo | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo
- $ hg log --graph | grep -v ': *master'
+ $ hg -R hgrepo log --graph | grep -v ': *master'
@ changeset: 2:76fda365fbbb
| tag: default/master
| tag: tip
@@ -74,5 +73,5 @@

$ echo % we should have some bookmarks
% we should have some bookmarks
- $ hg book
+ $ hg -R hgrepo book
* master 2:76fda365fbbb


diff --git a/tests/test-hg-author.t b/tests/test-hg-author.t
--- a/tests/test-hg-author.t
+++ b/tests/test-hg-author.t

@@ -127,8 +127,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
8 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
- $ hg log --graph | egrep -v ': *(not-master|master)'
+ $ hg -R hgrepo2 log --graph | egrep -v ': *(not-master|master)'
@ changeset: 8:efec0270e295
| tag: default/master
| tag: tip
@@ -177,10 +176,7 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

-
- $ cd ..
- $ cd gitrepo
- $ git log --pretty=medium master
+ $ git --git-dir=gitrepo/.git log --pretty=medium master
commit 1e03e913eca571b86ee06d3c1ddd795dde9ca917
Author: test ?te...@example.com <test ?te...@example.com>
Date: Mon Jan 1 00:00:18 2007 +0000
@@ -234,5 +230,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add alpha
-
- $ cd ..


diff --git a/tests/test-hg-branch.t b/tests/test-hg-branch.t
--- a/tests/test-hg-branch.t
+++ b/tests/test-hg-branch.t

@@ -60,8 +60,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
- $ hg log --graph | $filterhash | egrep -v ': *(not-master|master)'
+ $ hg -R hgrepo2 log --graph | $filterhash | egrep -v ': *(not-master|master)'
o changeset: 2:05aed681ccb3
| branch: gamma
| tag: default/master
@@ -81,5 +80,3 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

-
- $ cd ..


diff --git a/tests/test-hg-tags.t b/tests/test-hg-tags.t
--- a/tests/test-hg-tags.t
+++ b/tests/test-hg-tags.t

@@ -50,8 +50,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo2
- $ hg log --graph | egrep -v ': *(not-master|master)'
+ $ hg -R hgrepo2 log --graph | egrep -v ': *(not-master|master)'
@ changeset: 1:d529e9229f6d
| tag: default/master
| tag: tip
@@ -69,7 +68,5 @@

$ echo % the tag should be in .hgtags
% the tag should be in .hgtags
- $ cat .hgtags
+ $ cat hgrepo2/.hgtags
3442585be8a60c6cd476bbc4e45755339f2a23ef alpha
-
- $ cd ..


diff --git a/tests/test-incoming.t b/tests/test-incoming.t
--- a/tests/test-incoming.t
+++ b/tests/test-incoming.t

@@ -17,17 +17,16 @@
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

- $ cd hgrepo
- $ hg incoming | grep -v 'no changes found' | grep -v 'bookmark:'
+ $ hg -R hgrepo incoming | grep -v 'no changes found' | grep -v 'bookmark:'
comparing with $TESTTMP/gitrepo

- $ cd ../gitrepo
+ $ cd gitrepo
$ echo beta > beta
$ git add beta
$ fn_git_commit -m 'add beta'
+ $ cd ..

- $ cd ../hgrepo
- $ hg incoming | grep -v 'no changes found' | grep -v 'bookmark:'
+ $ hg -R hgrepo incoming | grep -v 'no changes found' | grep -v 'bookmark:'
comparing with $TESTTMP/gitrepo
changeset: 1:9497a4ee62e1
user: test <te...@example.org>
@@ -35,7 +34,7 @@
summary: add beta


- $ cd ../gitrepo
+ $ cd gitrepo
$ git checkout -b b1 HEAD^
Switched to a new branch 'b1'
$ mkdir d
@@ -47,7 +46,6 @@
$ echo gamma 2 >> d/gamma
$ git add d/gamma
$ fn_git_commit -m'add d/gamma line 2'
-
$ cd ../hgrepo
$ hg incoming -p | grep -v 'no changes found' | grep -v 'bookmark:'
comparing with $TESTTMP/gitrepo


diff --git a/tests/test-merge.t b/tests/test-merge.t
--- a/tests/test-merge.t
+++ b/tests/test-merge.t

@@ -45,10 +45,9 @@
searching for changes

$ cd ..
- $ cd gitrepo2
$ echo % git log in repo pushed from hg
% git log in repo pushed from hg
- $ git log --pretty=medium master | sed 's/\.\.\.//g'
+ $ git --git-dir=gitrepo2 log --pretty=medium master | sed 's/\.\.\.//g'
commit 5806851511aaf3bfe813ae3a86c5027165fa9b96
Merge: e5023f9 9497a4e
Author: test <te...@example.org>
@@ -73,7 +72,7 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add alpha
- $ git log --pretty=medium beta | sed 's/\.\.\.//g'
+ $ git --git-dir=gitrepo2 log --pretty=medium beta | sed 's/\.\.\.//g'
commit 9497a4ee62e16ee641860d7677cdb2589ea15554
Author: test <te...@example.org>
Date: Mon Jan 1 00:00:11 2007 +0000
@@ -85,5 +84,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add alpha
-
- $ cd ..


diff --git a/tests/test-octopus.t b/tests/test-octopus.t
--- a/tests/test-octopus.t
+++ b/tests/test-octopus.t

@@ -69,9 +69,9 @@
$ hg push ../gitrepo2
pushing to ../gitrepo2
searching for changes
+ $ cd ..

- $ cd ../gitrepo2
- $ git log --pretty=medium | sed s/\\.\\.\\.//g
+ $ git --git-dir=gitrepo2 log --pretty=medium | sed s/\\.\\.\\.//g
commit f0c7ec180419a130636d0c333fc34c1462cab4b5
Merge: d8e22dd 9497a4e e5023f9
Author: test <te...@example.org>
@@ -102,5 +102,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

add alpha
-
- $ cd ..


diff --git a/tests/test-pull-after-strip.t b/tests/test-pull-after-strip.t
--- a/tests/test-pull-after-strip.t
+++ b/tests/test-pull-after-strip.t

@@ -34,8 +34,7 @@
$ hg clone -r alpha gitrepo hgrepo-a | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo-a
- $ hg log --graph | egrep -v ': *(beta|master)'
+ $ hg -R hgrepo-a log --graph | egrep -v ': *(beta|master)'
@ changeset: 0:3442585be8a6
tag: alpha
tag: default/master
@@ -44,15 +43,12 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

-
- $ cd ..
$ echo % clone a branch
% clone a branch
$ hg clone -r beta gitrepo hgrepo-b | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ cd hgrepo-b
- $ hg log --graph | egrep -v ': *(beta|master)'
+ $ hg -R hgrepo-b log --graph | egrep -v ': *(beta|master)'
@ changeset: 1:7bcd915dc873
| tag: default/beta
| tag: tip
@@ -67,8 +63,6 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

- $ cd ..
-
$ cd gitrepo
$ echo beta line 2 >> beta
$ git add beta


diff --git a/tests/test-tree-decomposition.t b/tests/test-tree-decomposition.t
--- a/tests/test-tree-decomposition.t
+++ b/tests/test-tree-decomposition.t

@@ -41,9 +41,9 @@
$ hg push ../gitrepo2
pushing to ../gitrepo2
searching for changes
+ $ cd ..

- $ cd ../gitrepo2
- $ git log --pretty=medium
+ $ git --git-dir=gitrepo2 log --pretty=medium
commit 6e0dbd8cd92ed4823c69cb48d8a2b81f904e6e69
Author: test <te...@example.org>
Date: Mon Jan 1 00:00:12 2007 +0000
@@ -61,5 +61,3 @@
Date: Mon Jan 1 00:00:10 2007 +0000

initial
-
- $ cd ..

David Carr

unread,
Nov 3, 2012, 10:58:26 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351984457 14400
# Node ID 52461f71a7829a50ad63ff2cca3351f54375a490
# Parent 6cc99298b69e974576e02be1bc9ee801a54c3400
tests: convert echos to comments

Now that we're in the unified test format, there isn't a need to use echo
to provide context to command output. This technique actually ends up resulting
in redundant output. To preserve the original context, but eliminate the
redundancy, such echo statements have been converted into comment lines.

diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -18,8 +18,7 @@


$ cd ..
- $ echo % clone a tag
- % clone a tag
+clone a tag
$ hg clone -r alpha gitrepo hgrepo-a | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -32,8 +31,7 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

- $ echo % clone a branch
- % clone a branch
+clone a branch
$ hg clone -r beta gitrepo hgrepo-b | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-conflict-1.t b/tests/test-conflict-1.t
--- a/tests/test-conflict-1.t
+++ b/tests/test-conflict-1.t
@@ -55,8 +55,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ echo % expect the same revision ids as above
- % expect the same revision ids as above
+expect the same revision ids as above
$ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 3:1,2 6c53bc0f062f 1970-01-01 00:00 +0000 test
|\ merge to C
diff --git a/tests/test-conflict-2.t b/tests/test-conflict-2.t
--- a/tests/test-conflict-2.t
+++ b/tests/test-conflict-2.t
@@ -55,8 +55,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ echo % expect the same revision ids as above
- % expect the same revision ids as above
+expect the same revision ids as above
$ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 3:1,2 120385945d08 1970-01-01 00:00 +0000 test
|\ merge to B
diff --git a/tests/test-convergedmerge.t b/tests/test-convergedmerge.t
--- a/tests/test-convergedmerge.t
+++ b/tests/test-convergedmerge.t
@@ -56,8 +56,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ echo % expect the same revision ids as above
- % expect the same revision ids as above
+expect the same revision ids as above
$ hg -R hgrepo2 log --graph --style compact | sed 's/\[.*\]//g'
@ 4:1,3 eaa21d002113 1970-01-01 00:00 +0000 test
|\ merge
diff --git a/tests/test-file-removal.t b/tests/test-file-removal.t
--- a/tests/test-file-removal.t
+++ b/tests/test-file-removal.t
@@ -20,8 +20,7 @@
$ git rm foo/bar
rm 'foo/bar'
$ fn_git_commit -m 'remove foo/bar'
- $ echo % final manifest in git is just beta
- % final manifest in git is just beta
+final manifest in git is just beta
$ git ls-files
beta

@@ -62,18 +61,12 @@
summary: add alpha


- $ echo
-
- $ echo % make sure alpha is not in this manifest
- % make sure alpha is not in this manifest
+make sure alpha is not in this manifest
$ hg manifest -r 3
beta
foo/bar

- $ echo
-
- $ echo % make sure that only beta is in the manifest
- % make sure that only beta is in the manifest
+make sure that only beta is in the manifest
$ hg manifest
beta

diff --git a/tests/test-git-clone.t b/tests/test-git-clone.t
--- a/tests/test-git-clone.t
+++ b/tests/test-git-clone.t
@@ -30,7 +30,6 @@
summary: add alpha


- $ echo % we should have some bookmarks
- % we should have some bookmarks
+we should have some bookmarks
$ hg -R hgrepo book
* master 1:7bcd915dc873
diff --git a/tests/test-git-submodules.t b/tests/test-git-submodules.t
--- a/tests/test-git-submodules.t
+++ b/tests/test-git-submodules.t
@@ -71,7 +71,6 @@
summary: add alpha


- $ echo % we should have some bookmarks
- % we should have some bookmarks
+we should have some bookmarks
$ hg -R hgrepo book
* master 2:76fda365fbbb
diff --git a/tests/test-git-workflow.t b/tests/test-git-workflow.t
--- a/tests/test-git-workflow.t
+++ b/tests/test-git-workflow.t
@@ -23,8 +23,7 @@

$ cd ..

- $ echo % configure for use from git
- % configure for use from git
+configure for use from git
$ hg clone hgrepo gitrepo
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -36,8 +35,7 @@
$ echo "intree = True" >> .hg/hgrc
$ hg gexport

- $ echo % do some work
- % do some work
+do some work
$ git config core.bare false
$ git checkout master 2>&1 | sed s/\'/\"/g
Already on "master"
@@ -45,8 +43,7 @@
$ git add beta
$ fn_git_commit -m 'add beta'

- $ echo % get things back to hg
- % get things back to hg
+get things back to hg
$ hg gimport
importing git objects into hg
$ hg log --graph --debug | grep -v ': *master' | grep -v phase:
@@ -75,7 +72,6 @@
add alpha


- $ echo % gimport should have updated the bookmarks as well
- % gimport should have updated the bookmarks as well
+gimport should have updated the bookmarks as well
$ hg bookmarks
master 1:7108ae7bd184
diff --git a/tests/test-hg-tags.t b/tests/test-hg-tags.t
--- a/tests/test-hg-tags.t
+++ b/tests/test-hg-tags.t
@@ -41,8 +41,7 @@

$ cd ..
$ cd gitrepo
- $ echo % git should have the tag alpha
- % git should have the tag alpha
+git should have the tag alpha
$ git tag -l
alpha

@@ -66,7 +65,6 @@
summary: add alpha


- $ echo % the tag should be in .hgtags
- % the tag should be in .hgtags
+the tag should be in .hgtags
$ cat hgrepo2/.hgtags
3442585be8a60c6cd476bbc4e45755339f2a23ef alpha
diff --git a/tests/test-incoming.t b/tests/test-incoming.t
--- a/tests/test-incoming.t
+++ b/tests/test-incoming.t
@@ -86,8 +86,7 @@
+gamma 2


- $ echo % incoming -r
- % incoming -r
+incoming -r
$ hg incoming -r master | grep -v 'no changes found' | grep -v 'bookmark:'
comparing with $TESTTMP/gitrepo
changeset: 1:9497a4ee62e1
@@ -117,8 +116,7 @@
summary: add d/gamma


- $ echo % nothing incoming after pull
- % nothing incoming after pull
+nothing incoming after pull
"adding remote bookmark" message was added in Mercurial 2.3
$ hg pull | grep -v "adding remote bookmark"
pulling from $TESTTMP/gitrepo
@@ -126,6 +124,3 @@
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg incoming | grep -v 'no changes found' | grep -v 'bookmark:'
comparing with $TESTTMP/gitrepo
-
- $ echo 'done'
- done
diff --git a/tests/test-merge.t b/tests/test-merge.t
--- a/tests/test-merge.t
+++ b/tests/test-merge.t
@@ -36,8 +36,7 @@
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd hgrepo

- $ echo % clear the cache to be sure it is regenerated correctly
- % clear the cache to be sure it is regenerated correctly
+clear the cache to be sure it is regenerated correctly
$ hg gclear
clearing out the git cache data
$ hg push ../gitrepo2
@@ -45,8 +44,7 @@
searching for changes

$ cd ..
- $ echo % git log in repo pushed from hg
- % git log in repo pushed from hg
+git log in repo pushed from hg
$ git --git-dir=gitrepo2 log --pretty=medium master | sed 's/\.\.\.//g'
commit 5806851511aaf3bfe813ae3a86c5027165fa9b96
Merge: e5023f9 9497a4e
diff --git a/tests/test-outgoing.t b/tests/test-outgoing.t
--- a/tests/test-outgoing.t
+++ b/tests/test-outgoing.t
@@ -71,8 +71,7 @@

$ cd ..

- $ echo % some more work on master from git
- % some more work on master from git
+some more work on master from git
$ cd gitrepo

Check state of refs after outgoing
@@ -89,14 +88,12 @@
$ cd ..

$ cd hgrepo
- $ echo % this will fail # maybe we should try to make it work
- % this will fail
+this will fail # maybe we should try to make it work
$ hg outgoing
comparing with */gitrepo (glob)
abort: refs/heads/master changed on the server, please pull and merge before pushing
[255]
- $ echo % let\'s pull and try again
- % let's pull and try again
+let's pull and try again
$ hg pull 2>&1 | grep -v 'divergent bookmark'
pulling from */gitrepo (glob)
importing git objects into hg
diff --git a/tests/test-pull-after-strip.t b/tests/test-pull-after-strip.t
--- a/tests/test-pull-after-strip.t
+++ b/tests/test-pull-after-strip.t
@@ -29,8 +29,7 @@


$ cd ..
- $ echo % clone a tag
- % clone a tag
+clone a tag
$ hg clone -r alpha gitrepo hgrepo-a | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -43,8 +42,7 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha

- $ echo % clone a branch
- % clone a branch
+clone a branch
$ hg clone -r beta gitrepo hgrepo-b | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -79,8 +77,7 @@
[255]
$ hg git-cleanup
git commit map cleaned
- $ echo % pull works after \'hg git-cleanup\'
- % pull works after 'hg git-cleanup'
+pull works after 'hg git-cleanup'
"adding remote bookmark" message was added in Mercurial 2.3
$ hg pull -r beta | grep -v "adding remote bookmark"
pulling from $TESTTMP/gitrepo
diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -32,16 +32,14 @@

$ cd ..

- $ echo % should have two different branches
- % should have two different branches
+should have two different branches
$ cd gitrepo
$ git branch -v
beta cffa0e8 add beta
master 7eeab2e add alpha
* not-master 7eeab2e add alpha

- $ echo % some more work on master from git
- % some more work on master from git
+some more work on master from git
$ git checkout master 2>&1 | sed s/\'/\"/g
Switched to branch "master"
$ echo delta > delta
@@ -53,16 +51,14 @@
$ cd ..

$ cd hgrepo
- $ echo % this should fail
- % this should fail
+this should fail
$ hg push -r master
pushing to $TESTTMP/gitrepo
searching for changes
abort: refs/heads/master changed on the server, please pull and merge before pushing
[255]

- $ echo % ... even with -f
- % ... even with -f
+... even with -f
$ hg push -fr master
pushing to $TESTTMP/gitrepo
searching for changes
@@ -76,8 +72,7 @@
TODO shouldn't need to do this since we're (in theory) pushing master explicitly,
which should not implicitly also push the not-master ref.
$ hg book not-master -r default/not-master --force
- $ echo % master and default/master should be diferent
- % master and default/master should be diferent
+master and default/master should be diferent
$ hg log -r master | grep -v ': *master'
changeset: 2:72f56395749d
user: test
@@ -94,22 +89,19 @@
summary: add delta


- $ echo % this should also fail
- % this should also fail
+this should also fail
$ hg push -r master
pushing to $TESTTMP/gitrepo
searching for changes
abort: pushing refs/heads/master overwrites 72f56395749d
[255]

- $ echo % ... but succeed with -f
- % ... but succeed with -f
+... but succeed with -f
$ hg push -fr master
pushing to $TESTTMP/gitrepo
searching for changes

- $ echo % this should fail, no changes to push
- % this should fail, no changes to push
+this should fail, no changes to push
The exit code for this was broken in Mercurial (incorrectly returning 0) until
issue3228 was fixed in 2.1
$ hg push -r master && false
diff --git a/tests/test-subrepos.t b/tests/test-subrepos.t
--- a/tests/test-subrepos.t
+++ b/tests/test-subrepos.t
@@ -27,10 +27,7 @@
allow commits despite working copy presense
$ git config receive.denyCurrentBranch ignore
$ cd ..
- $ echo
-
- $ echo % Ensure gitlinks are transformed to .hgsubstate on hg pull from git
- % Ensure gitlinks are transformed to .hgsubstate on hg pull from git
+Ensure gitlinks are transformed to .hgsubstate on hg pull from git
$ hg clone gitrepo1 hgrepo
importing git objects into hg
updating to branch default
@@ -40,27 +37,20 @@
$ cd hgrepo
$ hg bookmarks -f -r default master
1. Ensure gitlinks are transformed to .hgsubstate on hg <- git pull
- $ echo % .hgsub shall list two [git] subrepos
- % .hgsub shall list two [git] subrepos
+.hgsub shall list two [git] subrepos
$ cat .hgsub
subrepo1 = [git]../gitsubrepo
xyz/subrepo2 = [git]../gitsubrepo
- $ echo % .hgsubstate shall list two idenitcal revisions
- % .hgsubstate shall list two idenitcal revisions
+.hgsubstate shall list two idenitcal revisions
$ cat .hgsubstate
56f0304c5250308f14cfbafdc27bd12d40154d17 subrepo1
56f0304c5250308f14cfbafdc27bd12d40154d17 xyz/subrepo2
- $ echo % hg status shall NOT report .hgsub and .hgsubstate as untracked - either ignored or unmodified
- % hg status shall NOT report .hgsub and .hgsubstate as untracked - either ignored or unmodified
+hg status shall NOT report .hgsub and .hgsubstate as untracked - either ignored or unmodified
$ hg status --unknown .hgsub .hgsubstate
$ hg status --modified .hgsub .hgsubstate
$ cd ..
- $ echo
-

2. Check gitmodules are preserved during hg -> git push
- $ echo % Check gitmodules are preserved during hg push to git
- % Check gitmodules are preserved during hg push to git
$ cd gitsubrepo
$ echo gamma > gamma
$ git add gamma
@@ -84,8 +74,7 @@
searching for changes
$ cd ..
$ cd gitrepo1
- $ echo % there shall be two gitlink entries, with values matching that in .hgsubstate
- % there shall be two gitlink entries, with values matching that in .hgsubstate
+there shall be two gitlink entries, with values matching that in .hgsubstate
$ git ls-tree -r HEAD^{tree} | grep 'commit'
160000 commit 56f0304c5250308f14cfbafdc27bd12d40154d17 subrepo1
160000 commit aabf7cd015089aff0b84596e69aa37b24a3d090a xyz/subrepo2
@@ -93,12 +82,8 @@
$ git reset --hard
HEAD is now at 4663c49 Update subrepo2 from hg
$ cd ..
- $ echo
-

3. Check .hgsub and .hgsubstate from git repository are merged, not overwritten
- $ echo Check .hgsub and .hgsubstate from git repository are merged, not overwritten
- Check .hgsub and .hgsubstate from git repository are merged, not overwritten
$ hg init hgsub
$ cd hgsub
$ echo delta > delta
@@ -118,14 +103,12 @@
cloning subrepo hgsub from $TESTTMP/hgsub
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd ..
- $ echo % pull shall bring .hgsub entry which was added to the git repo
- % pull shall bring .hgsub entry which was added to the git repo
+pull shall bring .hgsub entry which was added to the git repo
$ cat hgrepo/.hgsub
hgsub = $TESTTMP/hgsub
subrepo1 = [git]../gitsubrepo
xyz/subrepo2 = [git]../gitsubrepo
- $ echo % .hgsubstate shall list revision of the subrepo added through git repo
- % .hgsubstate shall list revision of the subrepo added through git repo
+.hgsubstate shall list revision of the subrepo added through git repo
$ cat hgrepo/.hgsubstate
481ec30d580f333ae3a77f94c973ce37b69d5bda hgsub
56f0304c5250308f14cfbafdc27bd12d40154d17 subrepo1

David Carr

unread,
Nov 3, 2012, 10:58:27 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351984839 14400
# Node ID 819e46cffc8417bb521eaf355c1757ec1728d995
# Parent 52461f71a7829a50ad63ff2cca3351f54375a490
tests: remove mercurial version check from test-pull-after-strip.t

This test was being skipped in Mercurial < 1.5. We don't support Mercurial
that old any more, so there isn't a need to worry about it in the tests.

diff --git a/tests/test-pull-after-strip.t b/tests/test-pull-after-strip.t
--- a/tests/test-pull-after-strip.t
+++ b/tests/test-pull-after-strip.t
@@ -1,17 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-this test is busted on hg < 1.5. I'm not sure how to fix it.
- $ cat > tmp.py <<EOF
- > import sys
- > v = sys.stdin.read().strip()[:-1]
- > if v[1] == '.' and ((int(v[0]) == 1 and int(v[2]) > 4) or int(v[0]) > 1):
- > sys.exit(0)
- > sys.exit(1)
- > EOF
-
- $ hg version | grep version | sed 's/.*(version //' | python tmp.py || exit 80

David Carr

unread,
Nov 3, 2012, 10:58:28 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351984852 14400
# Node ID d92439a508370b9f428d70e22cdc0d5e1536754b
# Parent 819e46cffc8417bb521eaf355c1757ec1728d995
tests: remove mercurial version check from test-incoming.t

This test was only running on Mercurial 1.7 or later. Since now we only
support versions that are 1.7 or later, there isn't a need to perform this
check any more.

diff --git a/tests/test-incoming.t b/tests/test-incoming.t
--- a/tests/test-incoming.t
+++ b/tests/test-incoming.t
@@ -1,10 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-This test only works on hg 1.7 and later
- $ python -c 'from mercurial import util ; assert \
- > util.version() != "unknown" and util.version() > "1.7"' || exit 80

David Carr

unread,
Nov 3, 2012, 10:58:29 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351985113 14400
# Node ID 8e8d06e75e742358910274fc30605ccb39473482
# Parent d92439a508370b9f428d70e22cdc0d5e1536754b
tests: remove filterhash from test-incoming.t

This test had some form of legacy hash filtering, marked with a TODO to remove
it when we're only supporting Mercurial 1.5 or later. Well, that time has
come, so I removed it.

diff --git a/tests/test-hg-branch.t b/tests/test-hg-branch.t
--- a/tests/test-hg-branch.t
+++ b/tests/test-hg-branch.t
@@ -1,10 +1,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

-TODO stop using this when we're 1.5 only
- $ filterhash="sed s/71414c4e3c6f/a31e374801c9/;s/698615204564/d93a72262a83/"
- $ filterhash="$filterhash;s/d93a72262a83/05aed681ccb3/"
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
@@ -35,7 +31,7 @@
pushing to $TESTTMP/gitrepo
searching for changes

- $ hg log --graph | $filterhash | egrep -v ': *(not-master|master)'
+ $ hg log --graph | egrep -v ': *(not-master|master)'
@ changeset: 2:05aed681ccb3
| branch: gamma
| tag: default/master
@@ -60,7 +56,7 @@
$ hg clone gitrepo hgrepo2 | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ hg -R hgrepo2 log --graph | $filterhash | egrep -v ': *(not-master|master)'
+ $ hg -R hgrepo2 log --graph | egrep -v ': *(not-master|master)'

David Carr

unread,
Nov 3, 2012, 10:58:30 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351995763 14400
# Node ID fbbdbc8a87853b4bf2f179257f7268371ac73bec
# Parent 8e8d06e75e742358910274fc30605ccb39473482
tests: make test-encoding.t compatible with git 1.8.0

It looks like Git 1.8.0 started silently converting latin1 commit messages to
utf-8. That changed the result of this test. This changeset alters the test
to make it accept both the pre-1.8.0 and post-1.8.0 behaviors.

https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.0.txt

diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t

@@ -28,11 +28,13 @@
$ git add alpha
$ commit -m 'add älphà'

+Create some commits using latin1 encoding
+The warning message changed in Git 1.8.0
$ . $TESTDIR/latin-1-encoding
- Warning: commit message does not conform to UTF-8.
+ Warning: commit message (did|does) not conform to UTF-8. (re)
You may want to amend it after fixing the message, or set the config
variable i18n.commitencoding to the encoding your project uses.
- Warning: commit message does not conform to UTF-8.
+ Warning: commit message (did|does) not conform to UTF-8. (re)
You may want to amend it after fixing the message, or set the config
variable i18n.commitencoding to the encoding your project uses.

@@ -45,48 +47,45 @@
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd hgrepo

- $ HGENCODING=utf-8 hg log --graph --debug | grep -v ': *master' | grep -v phase:
- @ changeset: 3:8549ee7fe0801b2dafc06047ca6f66d36da709f5
+Latin1 commit messages started being automatically converted to UTF-8 in
+Git 1.8.0, so we accept the output of either version.
+ $ HGENCODING=utf-8 hg log --graph --debug | grep -v ': *master' | grep -v 'phase:' | grep -v ': *author=' | grep -v ': *message='
+ @ changeset: 3:(8549ee7fe0801b2dafc06047ca6f66d36da709f5|c3d3e39fc04f7e2e8cdb95f090415ec1ddc1be70) (re)
| tag: default/master
| tag: tip
- | parent: 2:0422fbb4ec39fb69e87b94a3874ac890333de11a
+ | parent: 2:(0422fbb4ec39fb69e87b94a3874ac890333de11a|f8aa41895a3a771a72520ca205a4685b76649fdd) (re)
| parent: -1:0000000000000000000000000000000000000000
| manifest: 3:ea49f93388380ead5601c8fcbfa187516e7c2ed8
| user: tést èncödîng <te...@example.org>
| date: Mon Jan 01 00:00:13 2007 +0000
| files+: delta
- | extra: author=$ \x90\x01\x01\xe9\x91\x03\x03\x01\xe8\x91\x08\x02\x01\xf6\x91\x0c\x01\x01\xee\x91\x0f\x15
| extra: branch=default
| extra: committer=test <te...@example.org> 1167609613 0
| extra: encoding=latin-1
- | extra: message=\x0c\n\x90\x05\x01\xe9\x91\x07\x02\x01\xe0\x91\x0b\x01
| description:
| add déltà
|
|
- o changeset: 2:0422fbb4ec39fb69e87b94a3874ac890333de11a
- | parent: 1:9f6268bfc9eb3956c5ab8752d7b983b0ffe57115
+ o changeset: 2:(0422fbb4ec39fb69e87b94a3874ac890333de11a|f8aa41895a3a771a72520ca205a4685b76649fdd) (re)
+ | parent: 1:(9f6268bfc9eb3956c5ab8752d7b983b0ffe57115|955b24cf6f8f293741d3f39110c6fe554c292533) (re)
| parent: -1:0000000000000000000000000000000000000000
| manifest: 2:f580e7da3673c137370da2b931a1dee83590d7b4
| user: tést èncödîng <te...@example.org>
| date: Mon Jan 01 00:00:12 2007 +0000
| files+: gamma
- | extra: author=$ \x90\x01\x01\xe9\x91\x03\x03\x01\xe8\x91\x08\x02\x01\xf6\x91\x0c\x01\x01\xee\x91\x0f\x15
| extra: branch=default
| extra: committer=test <te...@example.org> 1167609612 0
- | extra: message=\x0c\n\x90\x05\x01\xe4\x91\x07\x02\x01\xe2\x91\x0b\x01
| description:
| add gämmâ
|
|
- o changeset: 1:9f6268bfc9eb3956c5ab8752d7b983b0ffe57115
+ o changeset: 1:(9f6268bfc9eb3956c5ab8752d7b983b0ffe57115|955b24cf6f8f293741d3f39110c6fe554c292533) (re)
| parent: 0:bb7d36568d6188ce0de2392246c43f6f213df954
| parent: -1:0000000000000000000000000000000000000000
| manifest: 1:f0bd6fbafbaebe4bb59c35108428f6fce152431d
| user: tést èncödîng <te...@example.org>
| date: Mon Jan 01 00:00:11 2007 +0000
| files+: beta
- | extra: author=$ \x90\x01\x01\xe9\x91\x03\x03\x01\xe8\x91\x08\x02\x01\xf6\x91\x0c\x01\x01\xee\x91\x0f\x15
| extra: branch=default
| extra: committer=test <te...@example.org> 1167609611 0
| description:
@@ -113,21 +112,23 @@


searching for changes

$ cd ..

+Latin1 commit messages started being automatically converted to UTF-8 in
+Git 1.8.0, so we accept the output of either version.


$ git --git-dir=gitrepo2 log --pretty=medium

- commit da0edb01d4f3d1abf08b1be298379b0b2960e680
+ commit (da0edb01d4f3d1abf08b1be298379b0b2960e680|51c509c1c7eeb8f0a5b20aa3e894e8823f39171f) (re)


Author: t\xe9st \xe8nc\xf6d\xeeng <te...@example.org> (esc)
Date: Mon Jan 1 00:00:13 2007 +0000

add d\xe9lt\xe0 (esc)

- commit 2372b6c8f1b91f2db8ae5eb0f9e0427c318b449c
- Author: t\xe9st \xe8nc\xf6d\xeeng <te...@example.org> (esc)
+ commit (2372b6c8f1b91f2db8ae5eb0f9e0427c318b449c|bd576458238cbda49ffcfbafef5242e103f1bc24) (re)
+ Author: * <te...@example.org> (glob)


Date: Mon Jan 1 00:00:12 2007 +0000

- add g\xe4mm\xe2 (esc)
+ add g*mm* (glob)

- commit 9ef7f6dcffe643b89ba63f3323621b9a923e4802
- Author: t\xe9st \xe8nc\xf6d\xeeng <te...@example.org> (esc)
+ commit (9ef7f6dcffe643b89ba63f3323621b9a923e4802|7a7e86fc1b24db03109c9fe5da28b352de59ce90) (re)
+ Author: * <te...@example.org> (glob)


Date: Mon Jan 1 00:00:11 2007 +0000

add beta

David Carr

unread,
Nov 3, 2012, 10:58:31 PM11/3/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1351996573 14400
# Node ID 24d4741674a651ea63007b1179829905fc130624
# Parent fbbdbc8a87853b4bf2f179257f7268371ac73bec
tests: use fn_git_commit in test-encoding.t

In c4849b2dab87, the "commit" function was extracted into a testutil for re-use.
However, test-encoding.t was skipped over in that changeset, as I was seeing
unexplained test failures. Since those test failures have now been explained
(and fixed), this changeset performs the same extraction on test-encoding.t as
was done on all the other tests.

The version of fn_git_commit that was used in testutil redirected all output
(including errors) to /dev/null, which didn't match the expectations of this
test. The test utility functions for commit/tag now no longer throw away error
output, instead leaving it to individual tests to decide if error output should
be ignored.

diff --git a/tests/latin-1-encoding b/tests/latin-1-encoding
--- a/tests/latin-1-encoding
+++ b/tests/latin-1-encoding
@@ -5,14 +5,14 @@
GIT_AUTHOR_NAME='t�st �nc�d�ng'; export GIT_AUTHOR_NAME
echo beta > beta
git add beta
-commit -m 'add beta'
+fn_git_commit -m 'add beta'

echo gamma > gamma
git add gamma
-commit -m 'add g�mm�'
+fn_git_commit -m 'add g�mm�'

# test the commit encoding field
git config i18n.commitencoding latin-1
echo delta > delta
git add delta
-commit -m 'add d�lt�'
+fn_git_commit -m 'add d�lt�'
diff --git a/tests/test-encoding.t b/tests/test-encoding.t
--- a/tests/test-encoding.t
+++ b/tests/test-encoding.t
@@ -3,22 +3,6 @@
Load commonly used test logic
$ . "$TESTDIR/testutil"

- $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
- $ GIT_AUTHOR_EMAIL='te...@example.org'; export GIT_AUTHOR_EMAIL
- $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
- $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
- $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
- $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
-
- $ count=10
- $ commit()
- > {
- > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
- > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
- > git commit "$@" >/dev/null || echo "git commit error"
- > count=`expr $count + 1`
- > }
-
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
@@ -26,7 +10,7 @@
utf-8 encoded commit message
$ echo alpha > alpha
$ git add alpha
- $ commit -m 'add älphà'
+ $ fn_git_commit -m 'add älphà'

Create some commits using latin1 encoding
The warning message changed in Git 1.8.0
diff --git a/tests/testutil b/tests/testutil
--- a/tests/testutil
+++ b/tests/testutil
@@ -33,25 +33,25 @@
fn_git_commit() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
- git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
+ git commit "$@" >/dev/null || echo "git commit error"
count=`expr $count + 1`
}

fn_hg_commit() {
HGDATE="2007-01-01 00:00:$count +0000"
- hg commit -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error"
+ hg commit -d "$HGDATE" "$@" >/dev/null || echo "hg commit error"
count=`expr $count + 1`
}

fn_git_tag() {
GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
- git tag "$@" >/dev/null 2>/dev/null || echo "git tag error"
+ git tag "$@" >/dev/null || echo "git tag error"
count=`expr $count + 1`
}

fn_hg_tag() {
HGDATE="2007-01-01 00:00:$count +0000"
- hg tag -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg tag error"
+ hg tag -d "$HGDATE" "$@" >/dev/null || echo "hg tag error"
count=`expr $count + 1`
}

Augie Fackler

unread,
Nov 5, 2012, 9:50:13 AM11/5/12
to hg-...@googlegroups.com
These all look good, but I'll need you to push to a URL I can pull from because it looks like groups mangled the patches that touch the test-encoding file.
> --
> You received this message because you are subscribed to the Google Groups "hg-git" group.
> To post to this group, send email to hg-...@googlegroups.com.
> To unsubscribe from this group, send email to hg-git+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hg-git?hl=en.
>

David M. Carr

unread,
Nov 5, 2012, 10:34:20 AM11/5/12
to hg-...@googlegroups.com
K. I'll push them to bitbucket sometime tonight.

--
David M. Carr
da...@carrclan.us

David M. Carr

unread,
Nov 5, 2012, 5:46:46 PM11/5/12
to hg-...@googlegroups.com

Augie Fackler

unread,
Nov 7, 2012, 9:59:47 AM11/7/12
to hg-...@googlegroups.com
Pushed, thanks.
Reply all
Reply to author
Forward
0 new messages