sapling/tests/test-hg-branch.t
David M. Carr d1a4bffd12 tests: extract commonly used commit/tag functions into testutil library
Thanks to Felipe Contreras for the patch which this was based on.

The functions were renamed to make it clearer that these are shell functions
rather than normal git/hg commands, and to make it clearer which tool is being
invoked.

Old name | New name
------------------------
commit   | fn_git_commit
tag      | fn_git_tag
hgcommit | fn_hg_commit
hgtag    | fn_hg_tag

Extraction from test-encoding.t was left for a subsequent patch, as I was seeing
unexpected output changes when I attempted the extraction.

The gitcommit and hgcommit functions in test-bookmark-workflow.t were left
as-is for now, as they have a different behavior than the standard version
(separate counters for each).
2012-10-30 22:59:20 -04:00

94 lines
2.7 KiB
Raku

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/"
$ mkdir gitrepo
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
$ git checkout -b not-master
Switched to a new branch 'not-master'
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd hgrepo
$ hg co master
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg mv alpha beta
$ fn_hg_commit -m 'rename alpha to beta'
$ hg push
pushing to $TESTTMP/gitrepo
searching for changes
$ hg branch gamma | grep -v 'permanent and global'
marked working directory as branch gamma
$ fn_hg_commit -m 'started branch gamma'
$ hg push
pushing to $TESTTMP/gitrepo
searching for changes
$ hg log --graph | $filterhash | egrep -v ': *(not-master|master)'
@ changeset: 2:05aed681ccb3
| branch: gamma
| tag: default/master
| tag: tip
| user: test
| date: Mon Jan 01 00:00:12 2007 +0000
| summary: started branch gamma
|
o changeset: 1:a31e374801c9
| user: test
| date: Mon Jan 01 00:00:11 2007 +0000
| summary: rename alpha to beta
|
o changeset: 0:3442585be8a6
tag: default/not-master
user: test <test@example.org>
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha
$ cd ..
$ 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)'
o changeset: 2:05aed681ccb3
| branch: gamma
| tag: default/master
| tag: tip
| user: test
| date: Mon Jan 01 00:00:12 2007 +0000
| summary: started branch gamma
|
@ changeset: 1:a31e374801c9
| user: test
| date: Mon Jan 01 00:00:11 2007 +0000
| summary: rename alpha to beta
|
o changeset: 0:3442585be8a6
tag: default/not-master
user: test <test@example.org>
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha
$ cd ..