tests/test-bookmarks-pushpull.t
author |
Angel Ezquerra <angel.ezquerra@gmail.com> |
|
Sun, 01 Apr 2012 14:12:14 +0200 |
changeset 16402 |
1fb2f1400ea8 |
parent 16107 |
a3dcc59054ca
|
child 16697 |
c285aae10f6c |
permissions |
-rw-r--r-- |
revset: add "matching" keyword
This keyword can be used to find revisions that "match" one or more fields of a
given set of revisions.
A revision matches another if all the selected fields (description, author,
branch, date, files, phase, parents, substate, user, summary and/or metadata)
match the corresponding values of those fields on the source revision.
By default this keyword looks for revisions that whose metadata match
(description, author and date) making it ideal to look for duplicate revisions.
matching takes 2 arguments (the second being optional):
1.- rev: a revset represeting a _single_ revision (e.g. tip, ., p1(.), etc)
2.- [field(s) to match]: an optional string containing the field or fields
(separated by spaces) to match.
Valid fields are most regular context fields and some special fields:
* regular fields:
- description, author, branch, date, files, phase, parents,
substate, user.
Note that author and user are synonyms.
* special fields: summary, metadata.
- summary: matches the first line of the description.
- metatadata: It is equivalent to matching 'description user date'
(i.e. it matches the main metadata fields).
Examples:
1.- Look for revisions with the same metadata (author, description and date)
as the 11th revision:
hg log -r "matching(11)"
2.- Look for revisions with the same description as the 11th revision:
hg log -r "matching(11, description)"
3.- Look for revisions with the same 'summary' (i.e. same first line on their
description) as the 11th revision:
hg log -r "matching(11, summary)"
4.- Look for revisions with the same author as the current revision:
hg log -r "matching(., author)"
You could use 'user' rather than 'author' to get the same result.
5.- Look for revisions with the same description _AND_ author as the tip of the
repository:
hg log -r "matching(tip, 'author description')"
6.- Look for revisions touching the same files as the parent of the tip of the
repository
hg log -r "matching(p1(tip), files)"
7.- Look for revisions whose subrepos are on the same state as the tip of the
repository or its parent
hg log -r "matching(p1(tip):tip, substate)"
8.- Look for revisions whose author and subrepo states both match those of any
of the revisions on the stable branch:
hg log -r "matching(branch(stable), 'author substate')"
$ "$TESTDIR/hghave" serve || exit 80
initialize
$ hg init a
$ cd a
$ echo 'test' > test
$ hg commit -Am'test'
adding test
set bookmarks
$ hg bookmark X
$ hg bookmark Y
$ hg bookmark Z
import bookmark by name
$ hg init ../b
$ cd ../b
$ hg book Y
$ hg book
* Y -1:000000000000
$ hg pull ../a
pulling from ../a
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
updating bookmark Y
(run 'hg update' to get a working copy)
$ hg bookmarks
Y 0:4e3505fd9583
$ hg debugpushkey ../a namespaces
bookmarks
phases
namespaces
$ hg debugpushkey ../a bookmarks
Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
X 4e3505fd95835d721066b76e75dbb8cc554d7f77
Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
$ hg pull -B X ../a
pulling from ../a
no changes found
importing bookmark X
$ hg bookmark
X 0:4e3505fd9583
Y 0:4e3505fd9583
export bookmark by name
$ hg bookmark W
$ hg bookmark foo
$ hg bookmark foobar
$ hg push -B W ../a
pushing to ../a
searching for changes
no changes found
exporting bookmark W
[1]
$ hg -R ../a bookmarks
W -1:000000000000
X 0:4e3505fd9583
Y 0:4e3505fd9583
* Z 0:4e3505fd9583
delete a remote bookmark
$ hg book -d W
$ hg push -B W ../a
pushing to ../a
searching for changes
no changes found
deleting remote bookmark W
[1]
push/pull name that doesn't exist
$ hg push -B badname ../a
pushing to ../a
searching for changes
no changes found
bookmark badname does not exist on the local or remote repository!
[2]
$ hg pull -B anotherbadname ../a
pulling from ../a
abort: remote bookmark anotherbadname not found!
[255]
divergent bookmarks
$ cd ../a
$ echo c1 > f1
$ hg ci -Am1
adding f1
$ hg book -f X
$ hg book
* X 1:0d2164f0ce0d
Y 0:4e3505fd9583
Z 1:0d2164f0ce0d
$ cd ../b
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updating bookmark foobar
$ echo c2 > f2
$ hg ci -Am2
adding f2
$ hg book -f X
$ hg book
* X 1:9b140be10808
Y 0:4e3505fd9583
foo -1:000000000000
foobar 1:9b140be10808
$ hg pull --config paths.foo=../a foo
pulling from $TESTTMP/a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
divergent bookmark X stored as X@foo
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg book
* X 1:9b140be10808
X@foo 2:0d2164f0ce0d
Y 0:4e3505fd9583
foo -1:000000000000
foobar 1:9b140be10808
$ hg push -f ../a
pushing to ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
$ hg -R ../a book
* X 1:0d2164f0ce0d
Y 0:4e3505fd9583
Z 1:0d2164f0ce0d
hgweb
$ cat <<EOF > .hg/hgrc
> [web]
> push_ssl = false
> allow_push = *
> EOF
$ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
$ cat ../hg.pid >> $DAEMON_PIDS
$ cd ../a
$ hg debugpushkey http://localhost:$HGPORT/ namespaces
bookmarks
phases
namespaces
$ hg debugpushkey http://localhost:$HGPORT/ bookmarks
Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
X 9b140be1080824d768c5a4691a564088eede71f9
foo 0000000000000000000000000000000000000000
foobar 9b140be1080824d768c5a4691a564088eede71f9
$ hg out -B http://localhost:$HGPORT/
comparing with http://localhost:$HGPORT/
searching for changed bookmarks
Z 0d2164f0ce0d
$ hg push -B Z http://localhost:$HGPORT/
pushing to http://localhost:$HGPORT/
searching for changes
no changes found
exporting bookmark Z
[1]
$ hg book -d Z
$ hg in -B http://localhost:$HGPORT/
comparing with http://localhost:$HGPORT/
searching for changed bookmarks
Z 0d2164f0ce0d
foo 000000000000
foobar 9b140be10808
$ hg pull -B Z http://localhost:$HGPORT/
pulling from http://localhost:$HGPORT/
no changes found
divergent bookmark X stored as X@1
importing bookmark Z
$ hg clone http://localhost:$HGPORT/ cloned-bookmarks
requesting all changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 3 files (+1 heads)
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R cloned-bookmarks bookmarks
X 1:9b140be10808
Y 0:4e3505fd9583
Z 2:0d2164f0ce0d
foo -1:000000000000
foobar 1:9b140be10808
$ kill `cat ../hg.pid`