annotate tests/test-rebase-check-restore @ 8849:80cc4b1a62d0

compare grep result between target and its parent I found that typical case is that grep target is added at (*) revision in the tree shown below. +--- 1(*) --- 3 0 +--- 2 ------ 4 Now, I expect 'hg grep --all' to show only rev:1 which is first appearance of target line. But 'hg grep --all' will tell: target line dis-appeared at 3 => 4 target line appeared at 2 => 3 target line dis-appeared at 1 => 2 target line appeared at 0 => 1 because current 'hg grep' implementation compares not between target revision and its parent, but between neighbor revisions in walkthrough order. I checked performance of this patch by "hg grep --follow --all walkchangerevs" on whole Mercurial repo, and patched version could complete as fast as un-patched one.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 19 May 2009 16:49:54 +0900
parents 8766fee6f225
children b345b1cc124f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
1 #!/bin/sh
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
2
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
3 echo "[extensions]" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
4 echo "graphlog=" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
5 echo "rebase=" >> $HGRCPATH
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
6
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
7 BASE=`pwd`
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
8
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
9 addcommit () {
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
10 echo $1 > $1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
11 hg add $1
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7952
diff changeset
12 hg commit -d "${2} 0" -m $1
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
13 }
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
14
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
15 commit () {
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7952
diff changeset
16 hg commit -d "${2} 0" -m $1
7952
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
17 }
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
18
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
19 createrepo () {
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
20 cd $BASE
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
21 rm -rf a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
22 hg init a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
23 cd a
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
24 addcommit "A" 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
25 addcommit "B" 1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
26 echo "C" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
27 commit "C" 2
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
28
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
29 hg update -C 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
30 echo "D" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
31 commit "D" 3
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
32 addcommit "E" 4
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
33
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
34 hg update -C 0
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
35 hg branch 'notdefault'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
36 echo "F" >> A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
37 commit "F" 5
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
38 }
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
39
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
40 echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
41 echo "% - Rebasing B onto E - check keep"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
42 createrepo > /dev/null 2>&1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
43 hg glog --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
44 hg rebase -s 1 -d 4 --keep 2>&1 | sed 's/\(saving bundle to \).*/\1/'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
45
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
46 echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
47 echo "% - Solve the conflict and go on"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
48 echo 'conflict solved' > A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
49 rm A.orig
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
50 hg resolve -m A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
51 hg rebase --continue 2>&1 | sed 's/\(saving bundle to \).*/\1/'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
52 hg glog --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
53
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
54 echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
55 echo "% - Rebase F onto E - check keepbranches"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
56 createrepo > /dev/null 2>&1
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
57 hg glog --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
58 hg rebase -s 5 -d 4 --keepbranches 2>&1 | sed 's/\(saving bundle to \).*/\1/'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
59
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
60 echo
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
61 echo "% - Solve the conflict and go on"
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
62 echo 'conflict solved' > A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
63 rm A.orig
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
64 hg resolve -m A
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
65 hg rebase --continue 2>&1 | sed 's/\(saving bundle to \).*/\1/'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
66 hg glog --template '{rev}:{desc}:{branches}\n'
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
67
b214066b7e1d rebase: store/restore arguments correctly
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
diff changeset
68 exit 0