##// END OF EJS Templates
tests: load with "ext =" instead of "hgext.ext ="
Martin Geisler -
r10119:bb5ea667 default
parent child Browse files
Show More
@@ -1,113 +1,113
1 #!/bin/sh
1 #!/bin/sh
2
2
3 do_push()
3 do_push()
4 {
4 {
5 user=$1
5 user=$1
6 shift
6 shift
7
7
8 echo "Pushing as user $user"
8 echo "Pushing as user $user"
9 echo 'hgrc = """'
9 echo 'hgrc = """'
10 sed -e 1,2d b/.hg/hgrc
10 sed -e 1,2d b/.hg/hgrc
11 echo '"""'
11 echo '"""'
12 if test -f acl.config; then
12 if test -f acl.config; then
13 echo 'acl.config = """'
13 echo 'acl.config = """'
14 cat acl.config
14 cat acl.config
15 echo '"""'
15 echo '"""'
16 fi
16 fi
17 # On AIX /etc/profile sets LOGNAME read-only. So
17 # On AIX /etc/profile sets LOGNAME read-only. So
18 # LOGNAME=$user hg --cws a --debug push ../b
18 # LOGNAME=$user hg --cws a --debug push ../b
19 # fails with "This variable is read only."
19 # fails with "This variable is read only."
20 # Use env to work around this.
20 # Use env to work around this.
21 env LOGNAME=$user hg --cwd a --debug push ../b
21 env LOGNAME=$user hg --cwd a --debug push ../b
22 hg --cwd b rollback
22 hg --cwd b rollback
23 hg --cwd b --quiet tip
23 hg --cwd b --quiet tip
24 echo
24 echo
25 }
25 }
26
26
27 hg init a
27 hg init a
28 cd a
28 cd a
29 mkdir foo foo/Bar quux
29 mkdir foo foo/Bar quux
30 echo 'in foo' > foo/file.txt
30 echo 'in foo' > foo/file.txt
31 echo 'in foo/Bar' > foo/Bar/file.txt
31 echo 'in foo/Bar' > foo/Bar/file.txt
32 echo 'in quux' > quux/file.py
32 echo 'in quux' > quux/file.py
33 hg add -q
33 hg add -q
34 hg ci -m 'add files' -d '1000000 0'
34 hg ci -m 'add files' -d '1000000 0'
35 echo >> foo/file.txt
35 echo >> foo/file.txt
36 hg ci -m 'change foo/file' -d '1000001 0'
36 hg ci -m 'change foo/file' -d '1000001 0'
37 echo >> foo/Bar/file.txt
37 echo >> foo/Bar/file.txt
38 hg ci -m 'change foo/Bar/file' -d '1000002 0'
38 hg ci -m 'change foo/Bar/file' -d '1000002 0'
39 echo >> quux/file.py
39 echo >> quux/file.py
40 hg ci -m 'change quux/file' -d '1000003 0'
40 hg ci -m 'change quux/file' -d '1000003 0'
41 hg tip --quiet
41 hg tip --quiet
42
42
43 cd ..
43 cd ..
44 hg clone -r 0 a b
44 hg clone -r 0 a b
45
45
46 echo '[extensions]' >> $HGRCPATH
46 echo '[extensions]' >> $HGRCPATH
47 echo 'hgext.acl =' >> $HGRCPATH
47 echo 'acl =' >> $HGRCPATH
48
48
49 config=b/.hg/hgrc
49 config=b/.hg/hgrc
50
50
51 echo
51 echo
52
52
53 echo 'Extension disabled for lack of a hook'
53 echo 'Extension disabled for lack of a hook'
54 do_push fred
54 do_push fred
55
55
56 echo '[hooks]' >> $config
56 echo '[hooks]' >> $config
57 echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config
57 echo 'pretxnchangegroup.acl = python:hgext.acl.hook' >> $config
58
58
59 echo 'Extension disabled for lack of acl.sources'
59 echo 'Extension disabled for lack of acl.sources'
60 do_push fred
60 do_push fred
61
61
62 echo 'No [acl.allow]/[acl.deny]'
62 echo 'No [acl.allow]/[acl.deny]'
63 echo '[acl]' >> $config
63 echo '[acl]' >> $config
64 echo 'sources = push' >> $config
64 echo 'sources = push' >> $config
65 do_push fred
65 do_push fred
66
66
67 echo 'Empty [acl.allow]'
67 echo 'Empty [acl.allow]'
68 echo '[acl.allow]' >> $config
68 echo '[acl.allow]' >> $config
69 do_push fred
69 do_push fred
70
70
71 echo 'fred is allowed inside foo/'
71 echo 'fred is allowed inside foo/'
72 echo 'foo/** = fred' >> $config
72 echo 'foo/** = fred' >> $config
73 do_push fred
73 do_push fred
74
74
75 echo 'Empty [acl.deny]'
75 echo 'Empty [acl.deny]'
76 echo '[acl.deny]' >> $config
76 echo '[acl.deny]' >> $config
77 do_push barney
77 do_push barney
78
78
79 echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)'
79 echo 'fred is allowed inside foo/, but not foo/bar/ (case matters)'
80 echo 'foo/bar/** = fred' >> $config
80 echo 'foo/bar/** = fred' >> $config
81 do_push fred
81 do_push fred
82
82
83 echo 'fred is allowed inside foo/, but not foo/Bar/'
83 echo 'fred is allowed inside foo/, but not foo/Bar/'
84 echo 'foo/Bar/** = fred' >> $config
84 echo 'foo/Bar/** = fred' >> $config
85 do_push fred
85 do_push fred
86
86
87 echo 'barney is not mentioned => not allowed anywhere'
87 echo 'barney is not mentioned => not allowed anywhere'
88 do_push barney
88 do_push barney
89
89
90 echo 'barney is allowed everywhere'
90 echo 'barney is allowed everywhere'
91 echo '[acl.allow]' >> $config
91 echo '[acl.allow]' >> $config
92 echo '** = barney' >> $config
92 echo '** = barney' >> $config
93 do_push barney
93 do_push barney
94
94
95 echo 'wilma can change files with a .txt extension'
95 echo 'wilma can change files with a .txt extension'
96 echo '**/*.txt = wilma' >> $config
96 echo '**/*.txt = wilma' >> $config
97 do_push wilma
97 do_push wilma
98
98
99 echo 'file specified by acl.config does not exist'
99 echo 'file specified by acl.config does not exist'
100 echo '[acl]' >> $config
100 echo '[acl]' >> $config
101 echo 'config = ../acl.config' >> $config
101 echo 'config = ../acl.config' >> $config
102 do_push barney
102 do_push barney
103
103
104 echo 'betty is allowed inside foo/ by a acl.config file'
104 echo 'betty is allowed inside foo/ by a acl.config file'
105 echo '[acl.allow]' >> acl.config
105 echo '[acl.allow]' >> acl.config
106 echo 'foo/** = betty' >> acl.config
106 echo 'foo/** = betty' >> acl.config
107 do_push betty
107 do_push betty
108
108
109 echo 'acl.config can set only [acl.allow]/[acl.deny]'
109 echo 'acl.config can set only [acl.allow]/[acl.deny]'
110 echo '[hooks]' >> acl.config
110 echo '[hooks]' >> acl.config
111 echo 'changegroup.acl = false' >> acl.config
111 echo 'changegroup.acl = false' >> acl.config
112 do_push barney
112 do_push barney
113
113
@@ -1,59 +1,59
1 #!/bin/sh
1 #!/bin/sh
2 # test children command
2 # test children command
3
3
4 cat <<EOF >> $HGRCPATH
4 cat <<EOF >> $HGRCPATH
5 [extensions]
5 [extensions]
6 hgext.children=
6 children =
7 EOF
7 EOF
8
8
9 echo "% init"
9 echo "% init"
10 hg init t
10 hg init t
11 cd t
11 cd t
12
12
13 echo "% no working directory"
13 echo "% no working directory"
14 hg children
14 hg children
15
15
16 echo % setup
16 echo % setup
17 echo 0 > file0
17 echo 0 > file0
18 hg ci -qAm 0 -d '0 0'
18 hg ci -qAm 0 -d '0 0'
19
19
20 echo 1 > file1
20 echo 1 > file1
21 hg ci -qAm 1 -d '1 0'
21 hg ci -qAm 1 -d '1 0'
22
22
23 echo 2 >> file0
23 echo 2 >> file0
24 hg ci -qAm 2 -d '2 0'
24 hg ci -qAm 2 -d '2 0'
25
25
26 hg co null
26 hg co null
27 echo 3 > file3
27 echo 3 > file3
28 hg ci -qAm 3 -d '3 0'
28 hg ci -qAm 3 -d '3 0'
29
29
30 echo "% hg children at revision 3 (tip)"
30 echo "% hg children at revision 3 (tip)"
31 hg children
31 hg children
32
32
33 hg co null
33 hg co null
34 echo "% hg children at nullrev (should be 0 and 3)"
34 echo "% hg children at nullrev (should be 0 and 3)"
35 hg children
35 hg children
36
36
37 hg co 1
37 hg co 1
38 echo "% hg children at revision 1 (should be 2)"
38 echo "% hg children at revision 1 (should be 2)"
39 hg children
39 hg children
40
40
41 hg co 2
41 hg co 2
42 echo "% hg children at revision 2 (other head)"
42 echo "% hg children at revision 2 (other head)"
43 hg children
43 hg children
44
44
45 for i in null 0 1 2 3; do
45 for i in null 0 1 2 3; do
46 echo "% hg children -r $i"
46 echo "% hg children -r $i"
47 hg children -r $i
47 hg children -r $i
48 done
48 done
49
49
50 echo "% hg children -r 0 file0 (should be 2)"
50 echo "% hg children -r 0 file0 (should be 2)"
51 hg children -r 0 file0
51 hg children -r 0 file0
52
52
53 echo "% hg children -r 1 file0 (should be 2)"
53 echo "% hg children -r 1 file0 (should be 2)"
54 hg children -r 1 file0
54 hg children -r 1 file0
55
55
56 hg co 0
56 hg co 0
57 echo "% hg children file0 at revision 0 (should be 2)"
57 echo "% hg children file0 at revision 0 (should be 2)"
58 hg children file0
58 hg children file0
59
59
@@ -1,83 +1,83
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" baz || exit 80
3 "$TESTDIR/hghave" baz || exit 80
4
4
5 mkdir do_not_use_HOME_baz
5 mkdir do_not_use_HOME_baz
6 cd do_not_use_HOME_baz
6 cd do_not_use_HOME_baz
7 HOME=`pwd`; export HOME
7 HOME=`pwd`; export HOME
8 cd ..
8 cd ..
9 baz my-id "mercurial <mercurial@selenic.com>"
9 baz my-id "mercurial <mercurial@selenic.com>"
10
10
11 echo "[extensions]" >> $HGRCPATH
11 echo "[extensions]" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
13 echo 'hgext.graphlog =' >> $HGRCPATH
13 echo 'graphlog =' >> $HGRCPATH
14
14
15 echo % create baz archive
15 echo % create baz archive
16 baz make-archive baz@mercurial--convert hg-test-convert-baz
16 baz make-archive baz@mercurial--convert hg-test-convert-baz
17
17
18 echo % initialize baz repo
18 echo % initialize baz repo
19 mkdir baz-repo
19 mkdir baz-repo
20 cd baz-repo/
20 cd baz-repo/
21 baz init-tree baz@mercurial--convert/baz--test--0
21 baz init-tree baz@mercurial--convert/baz--test--0
22 baz import
22 baz import
23
23
24 echo % create initial files
24 echo % create initial files
25 echo 'this is a file' > a
25 echo 'this is a file' > a
26 baz add a
26 baz add a
27 mkdir src
27 mkdir src
28 baz add src
28 baz add src
29 cd src
29 cd src
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
31 baz add b
31 baz add b
32 # HACK: hide GNU tar-1.22 "tar: The --preserve option is deprecated, use --preserve-permissions --preserve-order instead"
32 # HACK: hide GNU tar-1.22 "tar: The --preserve option is deprecated, use --preserve-permissions --preserve-order instead"
33 baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v ^tar
33 baz commit -s "added a file, src and src/b (binary)" 2>&1 | grep -v ^tar
34
34
35 echo % create link file and modify a
35 echo % create link file and modify a
36 ln -s ../a a-link
36 ln -s ../a a-link
37 baz add a-link
37 baz add a-link
38 echo 'this a modification to a' >> ../a
38 echo 'this a modification to a' >> ../a
39 baz commit -s "added link to a and modify a"
39 baz commit -s "added link to a and modify a"
40
40
41 echo % create second link and modify b
41 echo % create second link and modify b
42 ln -s ../a a-link-2
42 ln -s ../a a-link-2
43 baz add a-link-2
43 baz add a-link-2
44 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
44 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
45 baz commit -s "added second link and modify b"
45 baz commit -s "added second link and modify b"
46
46
47 echo % b file to link and a-link-2 to regular file
47 echo % b file to link and a-link-2 to regular file
48 rm -f a-link-2
48 rm -f a-link-2
49 echo 'this is now a regular file' > a-link-2
49 echo 'this is now a regular file' > a-link-2
50 ln -sf ../a b
50 ln -sf ../a b
51 baz commit -s "file to link and link to file test"
51 baz commit -s "file to link and link to file test"
52
52
53 echo % move a-link-2 file and src directory
53 echo % move a-link-2 file and src directory
54 cd ..
54 cd ..
55 baz mv src/a-link-2 c
55 baz mv src/a-link-2 c
56 baz mv src test
56 baz mv src test
57 baz commit -s "move and rename a-link-2 file and src directory"
57 baz commit -s "move and rename a-link-2 file and src directory"
58
58
59 echo % move and add the moved file again
59 echo % move and add the moved file again
60 echo e > e
60 echo e > e
61 baz add e
61 baz add e
62 baz commit -s "add e"
62 baz commit -s "add e"
63 baz mv e f
63 baz mv e f
64 echo ee > e
64 echo ee > e
65 baz add e
65 baz add e
66 baz commit -s "move e and recreate it again"
66 baz commit -s "move e and recreate it again"
67 cd ..
67 cd ..
68
68
69 echo % converting baz repo to Mercurial
69 echo % converting baz repo to Mercurial
70 hg convert baz-repo baz-repo-hg
70 hg convert baz-repo baz-repo-hg
71
71
72 baz register-archive -d baz@mercurial--convert
72 baz register-archive -d baz@mercurial--convert
73
73
74 glog()
74 glog()
75 {
75 {
76 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
76 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
77 }
77 }
78
78
79 echo % show graph log
79 echo % show graph log
80 glog -R baz-repo-hg
80 glog -R baz-repo-hg
81 hg up -q -R baz-repo-hg
81 hg up -q -R baz-repo-hg
82 hg -R baz-repo-hg manifest --debug
82 hg -R baz-repo-hg manifest --debug
83 hg -R baz-repo-hg log -r 5 -r 7 -C --debug | grep copies
83 hg -R baz-repo-hg log -r 5 -r 7 -C --debug | grep copies
@@ -1,54 +1,54
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "hgext.convert = " >> $HGRCPATH
4 echo "convert = " >> $HGRCPATH
5 echo "[convert]" >> $HGRCPATH
5 echo "[convert]" >> $HGRCPATH
6 echo "hg.tagsbranch=0" >> $HGRCPATH
6 echo "hg.tagsbranch=0" >> $HGRCPATH
7
7
8 hg init source
8 hg init source
9 cd source
9 cd source
10 echo a > a
10 echo a > a
11 hg ci -qAm adda
11 hg ci -qAm adda
12 # Add a merge with one parent in the same branch
12 # Add a merge with one parent in the same branch
13 echo a >> a
13 echo a >> a
14 hg ci -qAm changea
14 hg ci -qAm changea
15 hg up -qC 0
15 hg up -qC 0
16 hg branch branch0
16 hg branch branch0
17 echo b > b
17 echo b > b
18 hg ci -qAm addb
18 hg ci -qAm addb
19 hg up -qC
19 hg up -qC
20 hg merge default
20 hg merge default
21 hg ci -qm mergeab
21 hg ci -qm mergeab
22 hg tag -ql mergeab
22 hg tag -ql mergeab
23 cd ..
23 cd ..
24
24
25 # Miss perl... sometimes
25 # Miss perl... sometimes
26 cat > filter.py <<EOF
26 cat > filter.py <<EOF
27 import sys, re
27 import sys, re
28
28
29 r = re.compile(r'^(?:\d+|pulling from)')
29 r = re.compile(r'^(?:\d+|pulling from)')
30 sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
30 sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
31 EOF
31 EOF
32
32
33 echo % convert
33 echo % convert
34 hg convert -v --config convert.hg.clonebranches=1 source dest |
34 hg convert -v --config convert.hg.clonebranches=1 source dest |
35 python filter.py
35 python filter.py
36
36
37 # Add a merge with both parents and child in different branches
37 # Add a merge with both parents and child in different branches
38 cd source
38 cd source
39 hg branch branch1
39 hg branch branch1
40 echo a > file1
40 echo a > file1
41 hg ci -qAm c1
41 hg ci -qAm c1
42 hg up -qC mergeab
42 hg up -qC mergeab
43 hg branch branch2
43 hg branch branch2
44 echo a > file2
44 echo a > file2
45 hg ci -qAm c2
45 hg ci -qAm c2
46 hg merge branch1
46 hg merge branch1
47 hg branch branch3
47 hg branch branch3
48 hg ci -qAm c3
48 hg ci -qAm c3
49 cd ..
49 cd ..
50
50
51 echo % incremental conversion
51 echo % incremental conversion
52 hg convert -v --config convert.hg.clonebranches=1 source dest |
52 hg convert -v --config convert.hg.clonebranches=1 source dest |
53 python filter.py
53 python filter.py
54
54
@@ -1,75 +1,75
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" darcs || exit 80
3 "$TESTDIR/hghave" darcs || exit 80
4
4
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH
6 echo "convert=" >> $HGRCPATH
7 echo 'hgext.graphlog =' >> $HGRCPATH
7 echo 'graphlog =' >> $HGRCPATH
8
8
9 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
9 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
10 HOME=`pwd`/do_not_use_HOME_darcs; export HOME
10 HOME=`pwd`/do_not_use_HOME_darcs; export HOME
11
11
12 # skip if we can't import elementtree
12 # skip if we can't import elementtree
13 mkdir dummy
13 mkdir dummy
14 mkdir dummy/_darcs
14 mkdir dummy/_darcs
15 if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
15 if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
16 echo 'skipped: missing feature: elementtree module'
16 echo 'skipped: missing feature: elementtree module'
17 exit 80
17 exit 80
18 fi
18 fi
19
19
20 echo % initialize darcs repo
20 echo % initialize darcs repo
21 mkdir darcs-repo
21 mkdir darcs-repo
22 cd darcs-repo
22 cd darcs-repo
23 darcs init
23 darcs init
24 echo a > a
24 echo a > a
25 darcs record -a -l -m p0
25 darcs record -a -l -m p0
26 cd ..
26 cd ..
27
27
28 echo % branch and update
28 echo % branch and update
29 darcs get darcs-repo darcs-clone >/dev/null
29 darcs get darcs-repo darcs-clone >/dev/null
30 cd darcs-clone
30 cd darcs-clone
31 echo c >> a
31 echo c >> a
32 echo c > c
32 echo c > c
33 darcs record -a -l -m p1.1
33 darcs record -a -l -m p1.1
34 cd ..
34 cd ..
35
35
36 echo % update source
36 echo % update source
37 cd darcs-repo
37 cd darcs-repo
38 echo b >> a
38 echo b >> a
39 echo b > b
39 echo b > b
40 darcs record -a -l -m p1.2
40 darcs record -a -l -m p1.2
41
41
42 echo % merge branch
42 echo % merge branch
43 darcs pull -a ../darcs-clone
43 darcs pull -a ../darcs-clone
44 sleep 1
44 sleep 1
45 echo e > a
45 echo e > a
46 echo f > f
46 echo f > f
47 mkdir dir
47 mkdir dir
48 echo d > dir/d
48 echo d > dir/d
49 echo d > dir/d2
49 echo d > dir/d2
50 darcs record -a -l -m p2
50 darcs record -a -l -m p2
51
51
52 echo % test file and directory move
52 echo % test file and directory move
53 darcs mv f ff
53 darcs mv f ff
54 # Test remove + move
54 # Test remove + move
55 darcs remove dir/d2
55 darcs remove dir/d2
56 rm dir/d2
56 rm dir/d2
57 darcs mv dir dir2
57 darcs mv dir dir2
58 darcs record -a -l -m p3
58 darcs record -a -l -m p3
59 cd ..
59 cd ..
60
60
61 glog()
61 glog()
62 {
62 {
63 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
63 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
64 }
64 }
65
65
66 hg convert darcs-repo darcs-repo-hg
66 hg convert darcs-repo darcs-repo-hg
67 # The converter does not currently handle patch conflicts very well.
67 # The converter does not currently handle patch conflicts very well.
68 # When they occur, it reverts *all* changes and moves forward,
68 # When they occur, it reverts *all* changes and moves forward,
69 # letting the conflict resolving patch fix collisions.
69 # letting the conflict resolving patch fix collisions.
70 # Unfortunately, non-conflicting changes, like the addition of the
70 # Unfortunately, non-conflicting changes, like the addition of the
71 # "c" file in p1.1 patch are reverted too.
71 # "c" file in p1.1 patch are reverted too.
72 # Just to say that manifest not listing "c" here is a bug.
72 # Just to say that manifest not listing "c" here is a bug.
73 glog -R darcs-repo-hg
73 glog -R darcs-repo-hg
74 hg up -q -R darcs-repo-hg
74 hg up -q -R darcs-repo-hg
75 hg -R darcs-repo-hg manifest --debug
75 hg -R darcs-repo-hg manifest --debug
@@ -1,130 +1,130
1 #!/bin/sh
1 #!/bin/sh
2
2
3 HGMERGE=true; export HGMERGE
3 HGMERGE=true; export HGMERGE
4
4
5 echo '[extensions]' >> $HGRCPATH
5 echo '[extensions]' >> $HGRCPATH
6 echo 'hgext.graphlog =' >> $HGRCPATH
6 echo 'graphlog =' >> $HGRCPATH
7 echo 'hgext.convert =' >> $HGRCPATH
7 echo 'convert =' >> $HGRCPATH
8
8
9 glog()
9 glog()
10 {
10 {
11 hg glog --template '{rev} "{desc}" files: {files}\n' "$@"
11 hg glog --template '{rev} "{desc}" files: {files}\n' "$@"
12 }
12 }
13
13
14 hg init source
14 hg init source
15 cd source
15 cd source
16
16
17 echo foo > foo
17 echo foo > foo
18 echo baz > baz
18 echo baz > baz
19 mkdir -p dir/subdir
19 mkdir -p dir/subdir
20 echo dir/file >> dir/file
20 echo dir/file >> dir/file
21 echo dir/file2 >> dir/file2
21 echo dir/file2 >> dir/file2
22 echo dir/subdir/file3 >> dir/subdir/file3
22 echo dir/subdir/file3 >> dir/subdir/file3
23 echo dir/subdir/file4 >> dir/subdir/file4
23 echo dir/subdir/file4 >> dir/subdir/file4
24 hg ci -d '0 0' -qAm '0: add foo baz dir/'
24 hg ci -d '0 0' -qAm '0: add foo baz dir/'
25
25
26 echo bar > bar
26 echo bar > bar
27 echo quux > quux
27 echo quux > quux
28 hg copy foo copied
28 hg copy foo copied
29 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
29 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
30
30
31 echo >> foo
31 echo >> foo
32 hg ci -d '2 0' -m '2: change foo'
32 hg ci -d '2 0' -m '2: change foo'
33
33
34 hg up -qC 1
34 hg up -qC 1
35 echo >> bar
35 echo >> bar
36 echo >> quux
36 echo >> quux
37 hg ci -d '3 0' -m '3: change bar quux'
37 hg ci -d '3 0' -m '3: change bar quux'
38
38
39 hg up -qC 2
39 hg up -qC 2
40 hg merge -qr 3
40 hg merge -qr 3
41 echo >> bar
41 echo >> bar
42 echo >> baz
42 echo >> baz
43 hg ci -d '4 0' -m '4: first merge; change bar baz'
43 hg ci -d '4 0' -m '4: first merge; change bar baz'
44
44
45 echo >> bar
45 echo >> bar
46 echo 1 >> baz
46 echo 1 >> baz
47 echo >> quux
47 echo >> quux
48 hg ci -d '5 0' -m '5: change bar baz quux'
48 hg ci -d '5 0' -m '5: change bar baz quux'
49
49
50 hg up -qC 4
50 hg up -qC 4
51 echo >> foo
51 echo >> foo
52 echo 2 >> baz
52 echo 2 >> baz
53 hg ci -d '6 0' -m '6: change foo baz'
53 hg ci -d '6 0' -m '6: change foo baz'
54
54
55 hg up -qC 5
55 hg up -qC 5
56 hg merge -qr 6
56 hg merge -qr 6
57 echo >> bar
57 echo >> bar
58 hg ci -d '7 0' -m '7: second merge; change bar'
58 hg ci -d '7 0' -m '7: second merge; change bar'
59
59
60 echo >> foo
60 echo >> foo
61 hg ci -m '8: change foo'
61 hg ci -m '8: change foo'
62
62
63 glog
63 glog
64
64
65 echo '% final file versions in this repo:'
65 echo '% final file versions in this repo:'
66 hg manifest --debug
66 hg manifest --debug
67 hg debugrename copied
67 hg debugrename copied
68 echo
68 echo
69
69
70 cd ..
70 cd ..
71
71
72 splitrepo()
72 splitrepo()
73 {
73 {
74 msg="$1"
74 msg="$1"
75 files="$2"
75 files="$2"
76 opts=$3
76 opts=$3
77 echo "% $files: $msg"
77 echo "% $files: $msg"
78 prefix=`echo "$files" | sed -e 's/ /-/g'`
78 prefix=`echo "$files" | sed -e 's/ /-/g'`
79 fmap="$prefix.fmap"
79 fmap="$prefix.fmap"
80 repo="$prefix.repo"
80 repo="$prefix.repo"
81 for i in $files; do
81 for i in $files; do
82 echo "include $i" >> "$fmap"
82 echo "include $i" >> "$fmap"
83 done
83 done
84 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
84 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
85 hg up -q -R "$repo"
85 hg up -q -R "$repo"
86 glog -R "$repo"
86 glog -R "$repo"
87 hg -R "$repo" manifest --debug
87 hg -R "$repo" manifest --debug
88 }
88 }
89
89
90 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
90 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
91
91
92 splitrepo 'merges are not merges anymore' bar
92 splitrepo 'merges are not merges anymore' bar
93
93
94 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
94 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
95
95
96 splitrepo 'we add additional merges when they are interesting' 'foo quux'
96 splitrepo 'we add additional merges when they are interesting' 'foo quux'
97
97
98 splitrepo 'partial conversion' 'bar quux' '-r 3'
98 splitrepo 'partial conversion' 'bar quux' '-r 3'
99 splitrepo 'complete the partial conversion' 'bar quux'
99 splitrepo 'complete the partial conversion' 'bar quux'
100
100
101 rm -r foo.repo
101 rm -r foo.repo
102 splitrepo 'partial conversion' 'foo' '-r 3'
102 splitrepo 'partial conversion' 'foo' '-r 3'
103 splitrepo 'complete the partial conversion' 'foo'
103 splitrepo 'complete the partial conversion' 'foo'
104
104
105 splitrepo 'copied file; source not included in new repo' copied
105 splitrepo 'copied file; source not included in new repo' copied
106 hg --cwd copied.repo debugrename copied
106 hg --cwd copied.repo debugrename copied
107
107
108 splitrepo 'copied file; source included in new repo' 'foo copied'
108 splitrepo 'copied file; source included in new repo' 'foo copied'
109 hg --cwd foo-copied.repo debugrename copied
109 hg --cwd foo-copied.repo debugrename copied
110
110
111 cat > renames.fmap <<EOF
111 cat > renames.fmap <<EOF
112 include dir
112 include dir
113 exclude dir/file2
113 exclude dir/file2
114 rename dir dir2
114 rename dir dir2
115 include foo
115 include foo
116 include copied
116 include copied
117 rename foo foo2
117 rename foo foo2
118 rename copied copied2
118 rename copied copied2
119 exclude dir/subdir
119 exclude dir/subdir
120 include dir/subdir/file3
120 include dir/subdir/file3
121 EOF
121 EOF
122 hg -q convert --filemap renames.fmap --datesort source renames.repo
122 hg -q convert --filemap renames.fmap --datesort source renames.repo
123 hg up -q -R renames.repo
123 hg up -q -R renames.repo
124 glog -R renames.repo
124 glog -R renames.repo
125 hg -R renames.repo manifest --debug
125 hg -R renames.repo manifest --debug
126 hg --cwd renames.repo debugrename copied2
126 hg --cwd renames.repo debugrename copied2
127 echo 'copied:'
127 echo 'copied:'
128 hg --cwd source cat copied
128 hg --cwd source cat copied
129 echo 'copied2:'
129 echo 'copied2:'
130 hg --cwd renames.repo cat copied2
130 hg --cwd renames.repo cat copied2
@@ -1,61 +1,61
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo '[extensions]' >> $HGRCPATH
3 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.graphlog =' >> $HGRCPATH
4 echo 'graphlog =' >> $HGRCPATH
5 echo 'hgext.convert =' >> $HGRCPATH
5 echo 'convert =' >> $HGRCPATH
6
6
7 glog()
7 glog()
8 {
8 {
9 hg -R "$1" glog --template '{rev} "{desc}" files: {files}\n'
9 hg -R "$1" glog --template '{rev} "{desc}" files: {files}\n'
10 }
10 }
11
11
12 hg init source
12 hg init source
13 cd source
13 cd source
14
14
15 echo a > a
15 echo a > a
16 echo b > b
16 echo b > b
17 hg ci -d '0 0' -qAm '0: add a b'
17 hg ci -d '0 0' -qAm '0: add a b'
18 echo c > c
18 echo c > c
19 hg ci -d '1 0' -qAm '1: add c'
19 hg ci -d '1 0' -qAm '1: add c'
20 hg copy a e
20 hg copy a e
21 echo b >> b
21 echo b >> b
22 hg ci -d '2 0' -qAm '2: copy e from a, change b'
22 hg ci -d '2 0' -qAm '2: copy e from a, change b'
23 hg up -C 0
23 hg up -C 0
24 echo a >> a
24 echo a >> a
25 hg ci -d '3 0' -qAm '3: change a'
25 hg ci -d '3 0' -qAm '3: change a'
26 hg merge
26 hg merge
27 hg copy b d
27 hg copy b d
28 hg ci -d '4 0' -qAm '4: merge 2 and 3, copy d from b'
28 hg ci -d '4 0' -qAm '4: merge 2 and 3, copy d from b'
29 echo a >> a
29 echo a >> a
30 hg ci -d '5 0' -qAm '5: change a'
30 hg ci -d '5 0' -qAm '5: change a'
31 cd ..
31 cd ..
32
32
33 echo % convert from null revision
33 echo % convert from null revision
34 hg convert --config convert.hg.startrev=null source empty
34 hg convert --config convert.hg.startrev=null source empty
35 glog empty
35 glog empty
36
36
37 echo % convert from zero revision
37 echo % convert from zero revision
38 hg convert --config convert.hg.startrev=0 source full
38 hg convert --config convert.hg.startrev=0 source full
39 glog full
39 glog full
40
40
41 echo % convert from merge parent
41 echo % convert from merge parent
42 hg convert --config convert.hg.startrev=1 source conv1
42 hg convert --config convert.hg.startrev=1 source conv1
43 glog conv1
43 glog conv1
44 cd conv1
44 cd conv1
45 echo % check copy preservation
45 echo % check copy preservation
46 hg log --follow --copies e
46 hg log --follow --copies e
47 echo % check copy removal on missing parent
47 echo % check copy removal on missing parent
48 hg log --follow --copies d
48 hg log --follow --copies d
49 hg cat -r tip a b
49 hg cat -r tip a b
50 hg -q verify
50 hg -q verify
51 cd ..
51 cd ..
52
52
53 echo % convert from merge
53 echo % convert from merge
54 hg convert --config convert.hg.startrev=4 source conv4
54 hg convert --config convert.hg.startrev=4 source conv4
55 glog conv4
55 glog conv4
56 cd conv4
56 cd conv4
57 hg up -C
57 hg up -C
58 hg cat -r tip a b
58 hg cat -r tip a b
59 hg -q verify
59 hg -q verify
60 cd ..
60 cd ..
61
61
@@ -1,146 +1,146
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" mtn || exit 80
3 "$TESTDIR/hghave" mtn || exit 80
4
4
5 # Monotone directory is called .monotone on *nix and monotone
5 # Monotone directory is called .monotone on *nix and monotone
6 # on Windows. Having a variable here ease test patching.
6 # on Windows. Having a variable here ease test patching.
7 mtndir=.monotone
7 mtndir=.monotone
8 echo "[extensions]" >> $HGRCPATH
8 echo "[extensions]" >> $HGRCPATH
9 echo "convert=" >> $HGRCPATH
9 echo "convert=" >> $HGRCPATH
10 echo 'hgext.graphlog =' >> $HGRCPATH
10 echo 'graphlog =' >> $HGRCPATH
11
11
12 HOME=`pwd`/do_not_use_HOME_mtn; export HOME
12 HOME=`pwd`/do_not_use_HOME_mtn; export HOME
13 # Windows version of monotone home
13 # Windows version of monotone home
14 APPDATA=$HOME; export APPDATA
14 APPDATA=$HOME; export APPDATA
15
15
16 echo % tedious monotone keys configuration
16 echo % tedious monotone keys configuration
17 # The /dev/null redirection is necessary under Windows, or
17 # The /dev/null redirection is necessary under Windows, or
18 # it complains about home directory permissions
18 # it complains about home directory permissions
19 mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
19 mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
20 passphrase
20 passphrase
21 passphrase
21 passphrase
22 EOF
22 EOF
23 cat >> $HOME/$mtndir/monotonerc <<EOF
23 cat >> $HOME/$mtndir/monotonerc <<EOF
24 function get_passphrase(keypair_id)
24 function get_passphrase(keypair_id)
25 return "passphrase"
25 return "passphrase"
26 end
26 end
27 EOF
27 EOF
28
28
29 echo % create monotone repository
29 echo % create monotone repository
30 mtn db init --db=repo.mtn
30 mtn db init --db=repo.mtn
31 mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
31 mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
32 cd workingdir
32 cd workingdir
33 echo a > a
33 echo a > a
34 mkdir dir
34 mkdir dir
35 echo b > dir/b
35 echo b > dir/b
36 echo d > dir/d
36 echo d > dir/d
37 python -c 'file("bin", "wb").write("a\\x00b")'
37 python -c 'file("bin", "wb").write("a\\x00b")'
38 echo c > c
38 echo c > c
39 mtn add a dir/b dir/d c bin
39 mtn add a dir/b dir/d c bin
40 mtn ci -m initialize
40 mtn ci -m initialize
41 echo % update monotone working directory
41 echo % update monotone working directory
42 mtn mv a dir/a
42 mtn mv a dir/a
43 echo a >> dir/a
43 echo a >> dir/a
44 echo b >> dir/b
44 echo b >> dir/b
45 mtn drop c
45 mtn drop c
46 python -c 'file("bin", "wb").write("b\\x00c")'
46 python -c 'file("bin", "wb").write("b\\x00c")'
47 mtn ci -m update1
47 mtn ci -m update1
48 cd ..
48 cd ..
49
49
50 echo % convert once
50 echo % convert once
51 hg convert -s mtn repo.mtn
51 hg convert -s mtn repo.mtn
52
52
53 cd workingdir
53 cd workingdir
54 echo e > e
54 echo e > e
55 mtn add e
55 mtn add e
56 mtn drop dir/b
56 mtn drop dir/b
57 mtn mv bin bin2
57 mtn mv bin bin2
58 mtn ci -m 'update2 "with" quotes'
58 mtn ci -m 'update2 "with" quotes'
59 echo '% test directory move'
59 echo '% test directory move'
60 mkdir -p dir1/subdir1
60 mkdir -p dir1/subdir1
61 mkdir -p dir1/subdir2_other
61 mkdir -p dir1/subdir2_other
62 echo file1 > dir1/subdir1/file1
62 echo file1 > dir1/subdir1/file1
63 echo file2 > dir1/subdir2_other/file1
63 echo file2 > dir1/subdir2_other/file1
64 mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
64 mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
65 mtn ci -m createdir1
65 mtn ci -m createdir1
66 mtn rename dir1/subdir1 dir1/subdir2
66 mtn rename dir1/subdir1 dir1/subdir2
67 mtn ci -m movedir1
67 mtn ci -m movedir1
68 echo '% test subdirectory move'
68 echo '% test subdirectory move'
69 mtn mv dir dir2
69 mtn mv dir dir2
70 echo newfile > dir2/newfile
70 echo newfile > dir2/newfile
71 mtn drop dir2/d
71 mtn drop dir2/d
72 mtn add dir2/newfile
72 mtn add dir2/newfile
73 mtn ci -m movedir
73 mtn ci -m movedir
74 # Test directory removal with empty directory
74 # Test directory removal with empty directory
75 mkdir dir2/dir
75 mkdir dir2/dir
76 mkdir dir2/dir/subdir
76 mkdir dir2/dir/subdir
77 echo f > dir2/dir/subdir/f
77 echo f > dir2/dir/subdir/f
78 mkdir dir2/dir/emptydir
78 mkdir dir2/dir/emptydir
79 mtn add --quiet -R dir2/dir
79 mtn add --quiet -R dir2/dir
80 mtn ci -m emptydir
80 mtn ci -m emptydir
81 mtn drop -R dir2/dir
81 mtn drop -R dir2/dir
82 mtn ci -m dropdirectory
82 mtn ci -m dropdirectory
83 echo '% test directory and file move'
83 echo '% test directory and file move'
84 mkdir -p dir3/d1
84 mkdir -p dir3/d1
85 echo a > dir3/a
85 echo a > dir3/a
86 mtn add dir3/a dir3/d1
86 mtn add dir3/a dir3/d1
87 mtn ci -m dirfilemove
87 mtn ci -m dirfilemove
88 mtn mv dir3/a dir3/d1/a
88 mtn mv dir3/a dir3/d1/a
89 mtn mv dir3/d1 dir3/d2
89 mtn mv dir3/d1 dir3/d2
90 mtn ci -m dirfilemove2
90 mtn ci -m dirfilemove2
91 echo '% test directory move into another directory move'
91 echo '% test directory move into another directory move'
92 mkdir dir4
92 mkdir dir4
93 mkdir dir5
93 mkdir dir5
94 echo a > dir4/a
94 echo a > dir4/a
95 mtn add dir4/a dir5
95 mtn add dir4/a dir5
96 mtn ci -m dirdirmove
96 mtn ci -m dirdirmove
97 mtn mv dir5 dir6
97 mtn mv dir5 dir6
98 mtn mv dir4 dir6/dir4
98 mtn mv dir4 dir6/dir4
99 mtn ci -m dirdirmove2
99 mtn ci -m dirdirmove2
100 echo '% test diverging directory moves'
100 echo '% test diverging directory moves'
101 mkdir -p dir7/dir9/dir8
101 mkdir -p dir7/dir9/dir8
102 echo a > dir7/dir9/dir8/a
102 echo a > dir7/dir9/dir8/a
103 echo b > dir7/dir9/b
103 echo b > dir7/dir9/b
104 echo c > dir7/c
104 echo c > dir7/c
105 mtn add -R dir7
105 mtn add -R dir7
106 mtn ci -m divergentdirmove
106 mtn ci -m divergentdirmove
107 mtn mv dir7 dir7-2
107 mtn mv dir7 dir7-2
108 mtn mv dir7-2/dir9 dir9-2
108 mtn mv dir7-2/dir9 dir9-2
109 mtn mv dir9-2/dir8 dir8-2
109 mtn mv dir9-2/dir8 dir8-2
110 mtn ci -m divergentdirmove2
110 mtn ci -m divergentdirmove2
111 cd ..
111 cd ..
112
112
113 echo % convert incrementally
113 echo % convert incrementally
114 hg convert -s mtn repo.mtn
114 hg convert -s mtn repo.mtn
115
115
116 glog()
116 glog()
117 {
117 {
118 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
118 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
119 }
119 }
120
120
121 cd repo.mtn-hg
121 cd repo.mtn-hg
122 hg up -C
122 hg up -C
123 glog
123 glog
124 echo % manifest
124 echo % manifest
125 hg manifest
125 hg manifest
126 echo % contents
126 echo % contents
127 cat dir2/a
127 cat dir2/a
128 test -d dir2/dir && echo 'removed dir2/dir is still there!'
128 test -d dir2/dir && echo 'removed dir2/dir is still there!'
129
129
130 echo % file move
130 echo % file move
131 hg log -v -C -r 1 | grep copies
131 hg log -v -C -r 1 | grep copies
132 echo % check directory move
132 echo % check directory move
133 hg manifest -r 4
133 hg manifest -r 4
134 test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
134 test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
135 test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
135 test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
136 hg log -v -C -r 4 | grep copies
136 hg log -v -C -r 4 | grep copies
137 echo % check file remove with directory move
137 echo % check file remove with directory move
138 hg manifest -r 5
138 hg manifest -r 5
139 echo % check file move with directory move
139 echo % check file move with directory move
140 hg manifest -r 9
140 hg manifest -r 9
141 echo % check file directory directory move
141 echo % check file directory directory move
142 hg manifest -r 11
142 hg manifest -r 11
143 echo % check divergent directory moves
143 echo % check divergent directory moves
144 hg manifest -r 13
144 hg manifest -r 13
145 exit 0
145 exit 0
146
146
@@ -1,51 +1,51
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "convert=" >> $HGRCPATH
4 echo "convert=" >> $HGRCPATH
5 echo 'hgext.graphlog =' >> $HGRCPATH
5 echo 'graphlog =' >> $HGRCPATH
6
6
7 glog()
7 glog()
8 {
8 {
9 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
9 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
10 }
10 }
11
11
12 hg init repo1
12 hg init repo1
13 cd repo1
13 cd repo1
14 echo a > a
14 echo a > a
15 hg ci -Am adda
15 hg ci -Am adda
16 echo b > b
16 echo b > b
17 echo a >> a
17 echo a >> a
18 hg ci -Am addb
18 hg ci -Am addb
19 PARENTID1=`hg id --debug -i`
19 PARENTID1=`hg id --debug -i`
20 echo c > c
20 echo c > c
21 hg ci -Am addc
21 hg ci -Am addc
22 PARENTID2=`hg id --debug -i`
22 PARENTID2=`hg id --debug -i`
23 cd ..
23 cd ..
24
24
25 hg init repo2
25 hg init repo2
26 cd repo2
26 cd repo2
27 echo b > a
27 echo b > a
28 echo d > d
28 echo d > d
29 hg ci -Am addaandd
29 hg ci -Am addaandd
30 CHILDID1=`hg id --debug -i`
30 CHILDID1=`hg id --debug -i`
31 echo d >> d
31 echo d >> d
32 hg ci -Am changed
32 hg ci -Am changed
33 CHILDID2=`hg id --debug -i`
33 CHILDID2=`hg id --debug -i`
34 echo e > e
34 echo e > e
35 hg ci -Am adde
35 hg ci -Am adde
36 cd ..
36 cd ..
37
37
38 echo '% test invalid splicemap'
38 echo '% test invalid splicemap'
39 cat > splicemap <<EOF
39 cat > splicemap <<EOF
40 $CHILDID2
40 $CHILDID2
41 EOF
41 EOF
42 hg convert --splicemap splicemap repo2 repo1
42 hg convert --splicemap splicemap repo2 repo1
43
43
44 echo '% splice repo2 on repo1'
44 echo '% splice repo2 on repo1'
45 cat > splicemap <<EOF
45 cat > splicemap <<EOF
46 $CHILDID1 $PARENTID1
46 $CHILDID1 $PARENTID1
47 $CHILDID2 $PARENTID2,$CHILDID1
47 $CHILDID2 $PARENTID2,$CHILDID1
48 EOF
48 EOF
49 hg clone repo1 target1
49 hg clone repo1 target1
50 hg convert --splicemap splicemap repo2 target1
50 hg convert --splicemap splicemap repo2 target1
51 glog -R target1
51 glog -R target1
@@ -1,34 +1,34
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
12 echo "hgext.graphlog =" >> $HGRCPATH
12 echo "graphlog =" >> $HGRCPATH
13
13
14 svnadmin create svn-repo
14 svnadmin create svn-repo
15 cat "$TESTDIR/svn/branches.svndump" | svnadmin load svn-repo > /dev/null
15 cat "$TESTDIR/svn/branches.svndump" | svnadmin load svn-repo > /dev/null
16
16
17 echo % convert trunk and branches
17 echo % convert trunk and branches
18 cat >branchmap <<EOF
18 cat >branchmap <<EOF
19 old3 newbranch
19 old3 newbranch
20 EOF
20 EOF
21 hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
21 hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
22
22
23 echo % convert again
23 echo % convert again
24 hg convert --branchmap=branchmap --datesort svn-repo A-hg
24 hg convert --branchmap=branchmap --datesort svn-repo A-hg
25
25
26 cd A-hg
26 cd A-hg
27 hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
27 hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
28 hg branches | sed 's/:.*/:/'
28 hg branches | sed 's/:.*/:/'
29 hg tags -q
29 hg tags -q
30 cd ..
30 cd ..
31
31
32 echo '% test hg failing to call itself'
32 echo '% test hg failing to call itself'
33 HG=foobar hg convert svn-repo B-hg 2>&1 | grep -v foobar
33 HG=foobar hg convert svn-repo B-hg 2>&1 | grep -v foobar
34
34
@@ -1,89 +1,89
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
12 echo 'hgext.graphlog =' >> $HGRCPATH
12 echo 'graphlog =' >> $HGRCPATH
13
13
14 svnadmin create svn-repo
14 svnadmin create svn-repo
15
15
16 svnpath=`pwd | fix_path`
16 svnpath=`pwd | fix_path`
17 # SVN wants all paths to start with a slash. Unfortunately,
17 # SVN wants all paths to start with a slash. Unfortunately,
18 # Windows ones don't. Handle that.
18 # Windows ones don't. Handle that.
19 expr $svnpath : "\/" > /dev/null
19 expr $svnpath : "\/" > /dev/null
20 if [ $? -ne 0 ]; then
20 if [ $? -ne 0 ]; then
21 svnpath='/'$svnpath
21 svnpath='/'$svnpath
22 fi
22 fi
23
23
24 echo "# now tests that it works with trunk/tags layout, but no branches yet"
24 echo "# now tests that it works with trunk/tags layout, but no branches yet"
25 echo
25 echo
26 echo % initial svn import
26 echo % initial svn import
27 mkdir projB
27 mkdir projB
28 cd projB
28 cd projB
29 mkdir trunk
29 mkdir trunk
30 mkdir tags
30 mkdir tags
31 cd ..
31 cd ..
32
32
33 svnurl=file://$svnpath/svn-repo/proj%20B
33 svnurl=file://$svnpath/svn-repo/proj%20B
34 svn import -m "init projB" projB $svnurl | fix_path
34 svn import -m "init projB" projB $svnurl | fix_path
35
35
36
36
37 echo % update svn repository
37 echo % update svn repository
38 svn co $svnurl/trunk B | fix_path
38 svn co $svnurl/trunk B | fix_path
39 cd B
39 cd B
40 echo hello > 'letter .txt'
40 echo hello > 'letter .txt'
41 svn add 'letter .txt'
41 svn add 'letter .txt'
42 svn ci -m hello
42 svn ci -m hello
43
43
44 "$TESTDIR/svn-safe-append.py" world 'letter .txt'
44 "$TESTDIR/svn-safe-append.py" world 'letter .txt'
45 svn ci -m world
45 svn ci -m world
46
46
47 svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
47 svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1
48
48
49 "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
49 "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
50 svn ci -m "nice day"
50 svn ci -m "nice day"
51 cd ..
51 cd ..
52
52
53 echo % convert to hg once
53 echo % convert to hg once
54 hg convert $svnurl B-hg
54 hg convert $svnurl B-hg
55
55
56 echo % update svn repository again
56 echo % update svn repository again
57 cd B
57 cd B
58 "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
58 "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
59 echo "nice to meet you" > letter2.txt
59 echo "nice to meet you" > letter2.txt
60 svn add letter2.txt
60 svn add letter2.txt
61 svn ci -m "second letter"
61 svn ci -m "second letter"
62
62
63 svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
63 svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2
64
64
65 "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
65 "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
66 svn ci -m "work in progress"
66 svn ci -m "work in progress"
67 cd ..
67 cd ..
68
68
69 ########################################
69 ########################################
70
70
71 echo % test incremental conversion
71 echo % test incremental conversion
72 hg convert $svnurl B-hg
72 hg convert $svnurl B-hg
73
73
74 cd B-hg
74 cd B-hg
75 hg glog --template '{rev} {desc|firstline} files: {files}\n'
75 hg glog --template '{rev} {desc|firstline} files: {files}\n'
76 hg tags -q
76 hg tags -q
77 cd ..
77 cd ..
78
78
79 echo % test filemap
79 echo % test filemap
80 echo 'include letter2.txt' > filemap
80 echo 'include letter2.txt' > filemap
81 hg convert --filemap filemap $svnurl/trunk fmap
81 hg convert --filemap filemap $svnurl/trunk fmap
82 hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
82 hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
83
83
84 echo % test stop revision
84 echo % test stop revision
85 hg convert --rev 1 $svnurl/trunk stoprev
85 hg convert --rev 1 $svnurl/trunk stoprev
86 # Check convert_revision extra-records.
86 # Check convert_revision extra-records.
87 # This is also the only place testing more than one extra field
87 # This is also the only place testing more than one extra field
88 # in a revision.
88 # in a revision.
89 hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'
89 hg --cwd stoprev tip --debug | grep extra | sed 's/=.*/=/'
@@ -1,37 +1,37
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
12 echo "hgext.graphlog =" >> $HGRCPATH
12 echo "graphlog =" >> $HGRCPATH
13
13
14 svnadmin create svn-repo
14 svnadmin create svn-repo
15 cat "$TESTDIR/svn/startrev.svndump" | svnadmin load svn-repo > /dev/null
15 cat "$TESTDIR/svn/startrev.svndump" | svnadmin load svn-repo > /dev/null
16
16
17 convert()
17 convert()
18 {
18 {
19 startrev=$1
19 startrev=$1
20 repopath=A-r$startrev-hg
20 repopath=A-r$startrev-hg
21 hg convert --config convert.svn.startrev=$startrev \
21 hg convert --config convert.svn.startrev=$startrev \
22 --config convert.svn.trunk=branches/branch1 \
22 --config convert.svn.trunk=branches/branch1 \
23 --config convert.svn.branches=" " \
23 --config convert.svn.branches=" " \
24 --config convert.svn.tags= \
24 --config convert.svn.tags= \
25 --datesort svn-repo $repopath
25 --datesort svn-repo $repopath
26 hg -R $repopath glog --template '{rev} {desc|firstline} files: {files}\n'
26 hg -R $repopath glog --template '{rev} {desc|firstline} files: {files}\n'
27 echo
27 echo
28 }
28 }
29
29
30 echo % convert before branching point
30 echo % convert before branching point
31 convert 3
31 convert 3
32 echo % convert before branching point
32 echo % convert before branching point
33 convert 4
33 convert 4
34 echo % convert at branching point
34 echo % convert at branching point
35 convert 5
35 convert 5
36 echo % convert last revision only
36 echo % convert last revision only
37 convert 6
37 convert 6
@@ -1,28 +1,28
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
12 echo "hgext.graphlog =" >> $HGRCPATH
12 echo "graphlog =" >> $HGRCPATH
13
13
14 svnadmin create svn-repo
14 svnadmin create svn-repo
15 cat "$TESTDIR/svn/tags.svndump" | svnadmin load svn-repo > /dev/null
15 cat "$TESTDIR/svn/tags.svndump" | svnadmin load svn-repo > /dev/null
16
16
17 echo % convert
17 echo % convert
18 hg convert --datesort svn-repo A-hg
18 hg convert --datesort svn-repo A-hg
19
19
20 cd A-hg
20 cd A-hg
21 hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
21 hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
22 hg tags | sed 's/:.*/:/'
22 hg tags | sed 's/:.*/:/'
23 cd ..
23 cd ..
24
24
25 echo % convert without tags
25 echo % convert without tags
26 hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
26 hg convert --datesort --config convert.svn.tags= svn-repo A-notags-hg
27 hg -R A-notags-hg tags -q
27 hg -R A-notags-hg tags -q
28
28
@@ -1,73 +1,73
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" tla || exit 80
3 "$TESTDIR/hghave" tla || exit 80
4
4
5 mkdir do_not_use_HOME_tla
5 mkdir do_not_use_HOME_tla
6 cd do_not_use_HOME_tla
6 cd do_not_use_HOME_tla
7 HOME=`pwd`; export HOME
7 HOME=`pwd`; export HOME
8 cd ..
8 cd ..
9 tla my-id "mercurial <mercurial@selenic.com>"
9 tla my-id "mercurial <mercurial@selenic.com>"
10
10
11 echo "[extensions]" >> $HGRCPATH
11 echo "[extensions]" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
13 echo 'hgext.graphlog =' >> $HGRCPATH
13 echo 'graphlog =' >> $HGRCPATH
14
14
15 echo % create tla archive
15 echo % create tla archive
16 tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
16 tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
17
17
18 echo % initialize tla repo
18 echo % initialize tla repo
19 mkdir tla-repo
19 mkdir tla-repo
20 cd tla-repo/
20 cd tla-repo/
21 tla init-tree tla@mercurial--convert/tla--test--0
21 tla init-tree tla@mercurial--convert/tla--test--0
22 tla import
22 tla import
23
23
24 echo % create initial files
24 echo % create initial files
25 echo 'this is a file' > a
25 echo 'this is a file' > a
26 tla add a
26 tla add a
27 mkdir src
27 mkdir src
28 tla add src
28 tla add src
29 cd src
29 cd src
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
31 tla add b
31 tla add b
32 tla commit -s "added a file, src and src/b (binary)"
32 tla commit -s "added a file, src and src/b (binary)"
33
33
34 echo % create link file and modify a
34 echo % create link file and modify a
35 ln -s ../a a-link
35 ln -s ../a a-link
36 tla add a-link
36 tla add a-link
37 echo 'this a modification to a' >> ../a
37 echo 'this a modification to a' >> ../a
38 tla commit -s "added link to a and modify a"
38 tla commit -s "added link to a and modify a"
39
39
40 echo % create second link and modify b
40 echo % create second link and modify b
41 ln -s ../a a-link-2
41 ln -s ../a a-link-2
42 tla add a-link-2
42 tla add a-link-2
43 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
43 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
44 tla commit -s "added second link and modify b"
44 tla commit -s "added second link and modify b"
45
45
46 echo % b file to link and a-link-2 to regular file
46 echo % b file to link and a-link-2 to regular file
47 rm -f a-link-2
47 rm -f a-link-2
48 echo 'this is now a regular file' > a-link-2
48 echo 'this is now a regular file' > a-link-2
49 ln -sf ../a b
49 ln -sf ../a b
50 tla commit -s "file to link and link to file test"
50 tla commit -s "file to link and link to file test"
51
51
52 echo % move a-link-2 file and src directory
52 echo % move a-link-2 file and src directory
53 cd ..
53 cd ..
54 tla mv src/a-link-2 c
54 tla mv src/a-link-2 c
55 tla mv src test
55 tla mv src test
56 tla commit -s "move and rename a-link-2 file and src directory"
56 tla commit -s "move and rename a-link-2 file and src directory"
57
57
58 cd ..
58 cd ..
59
59
60 echo % converting tla repo to Mercurial
60 echo % converting tla repo to Mercurial
61 hg convert tla-repo tla-repo-hg
61 hg convert tla-repo tla-repo-hg
62
62
63 tla register-archive -d tla@mercurial--convert
63 tla register-archive -d tla@mercurial--convert
64
64
65 glog()
65 glog()
66 {
66 {
67 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
67 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
68 }
68 }
69
69
70 echo % show graph log
70 echo % show graph log
71 glog -R tla-repo-hg
71 glog -R tla-repo-hg
72 hg up -q -R tla-repo-hg
72 hg up -q -R tla-repo-hg
73 hg -R tla-repo-hg manifest --debug
73 hg -R tla-repo-hg manifest --debug
@@ -1,78 +1,78
1 #!/bin/sh
1 #!/bin/sh
2
2
3 branches=.hg/branchheads.cache
3 branches=.hg/branchheads.cache
4 echo '[extensions]' >> $HGRCPATH
4 echo '[extensions]' >> $HGRCPATH
5 echo 'hgext.mq=' >> $HGRCPATH
5 echo 'mq =' >> $HGRCPATH
6
6
7 show_branch_cache()
7 show_branch_cache()
8 {
8 {
9 # force cache (re)generation
9 # force cache (re)generation
10 hg log -r does-not-exist 2> /dev/null
10 hg log -r does-not-exist 2> /dev/null
11 hg log -r tip --template 'tip: {rev}\n'
11 hg log -r tip --template 'tip: {rev}\n'
12 if [ -f $branches ]; then
12 if [ -f $branches ]; then
13 sort $branches
13 sort $branches
14 else
14 else
15 echo No branch cache
15 echo No branch cache
16 fi
16 fi
17 if [ "$1" = 1 ]; then
17 if [ "$1" = 1 ]; then
18 for b in foo bar; do
18 for b in foo bar; do
19 hg log -r $b --template "branch $b: "'{rev}\n'
19 hg log -r $b --template "branch $b: "'{rev}\n'
20 done
20 done
21 fi
21 fi
22 }
22 }
23
23
24 hg init a
24 hg init a
25 cd a
25 cd a
26 hg qinit -c
26 hg qinit -c
27
27
28 echo '# mq patch on an empty repo'
28 echo '# mq patch on an empty repo'
29 hg qnew p1
29 hg qnew p1
30 show_branch_cache
30 show_branch_cache
31
31
32 echo > pfile
32 echo > pfile
33 hg add pfile
33 hg add pfile
34 hg qrefresh -m 'patch 1'
34 hg qrefresh -m 'patch 1'
35 show_branch_cache
35 show_branch_cache
36
36
37 echo
37 echo
38 echo '# some regular revisions'
38 echo '# some regular revisions'
39 hg qpop
39 hg qpop
40 echo foo > foo
40 echo foo > foo
41 hg add foo
41 hg add foo
42 echo foo > .hg/branch
42 echo foo > .hg/branch
43 hg ci -m 'branch foo' -d '1000000 0'
43 hg ci -m 'branch foo' -d '1000000 0'
44
44
45 echo bar > bar
45 echo bar > bar
46 hg add bar
46 hg add bar
47 echo bar > .hg/branch
47 echo bar > .hg/branch
48 hg ci -m 'branch bar' -d '1000000 0'
48 hg ci -m 'branch bar' -d '1000000 0'
49 show_branch_cache
49 show_branch_cache
50
50
51 echo
51 echo
52 echo '# add some mq patches'
52 echo '# add some mq patches'
53 hg qpush
53 hg qpush
54 show_branch_cache
54 show_branch_cache
55
55
56 hg qnew p2
56 hg qnew p2
57 echo foo > .hg/branch
57 echo foo > .hg/branch
58 echo foo2 >> foo
58 echo foo2 >> foo
59 hg qrefresh -m 'patch 2'
59 hg qrefresh -m 'patch 2'
60 show_branch_cache 1
60 show_branch_cache 1
61
61
62 echo
62 echo
63 echo '# removing the cache'
63 echo '# removing the cache'
64 rm $branches
64 rm $branches
65 show_branch_cache 1
65 show_branch_cache 1
66
66
67 echo
67 echo
68 echo '# importing rev 1 (the cache now ends in one of the patches)'
68 echo '# importing rev 1 (the cache now ends in one of the patches)'
69 hg qimport -r 1 -n p0
69 hg qimport -r 1 -n p0
70 show_branch_cache 1
70 show_branch_cache 1
71 hg log -r qbase --template 'qbase: {rev}\n'
71 hg log -r qbase --template 'qbase: {rev}\n'
72
72
73 echo
73 echo
74 echo '# detect an invalid cache'
74 echo '# detect an invalid cache'
75 hg qpop -a
75 hg qpop -a
76 hg qpush -a
76 hg qpush -a
77 show_branch_cache
77 show_branch_cache
78
78
@@ -1,73 +1,73
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # Test issue 529 - mq aborts when merging patch deleting files
3 # Test issue 529 - mq aborts when merging patch deleting files
4
4
5 rewrite_path()
5 rewrite_path()
6 {
6 {
7 sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g'
7 sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g'
8 }
8 }
9
9
10 checkundo()
10 checkundo()
11 {
11 {
12 if [ -f .hg/store/undo ]; then
12 if [ -f .hg/store/undo ]; then
13 echo ".hg/store/undo still exists after $1"
13 echo ".hg/store/undo still exists after $1"
14 fi
14 fi
15 }
15 }
16
16
17 echo "[extensions]" >> $HGRCPATH
17 echo "[extensions]" >> $HGRCPATH
18 echo "hgext.mq=" >> $HGRCPATH
18 echo "mq =" >> $HGRCPATH
19
19
20 # Commit two dummy files in "init" changeset
20 # Commit two dummy files in "init" changeset
21 hg init t
21 hg init t
22 cd t
22 cd t
23 echo a > a
23 echo a > a
24 echo b > b
24 echo b > b
25 hg ci -Am init
25 hg ci -Am init
26 hg tag -l init
26 hg tag -l init
27
27
28 # Create a patch removing a
28 # Create a patch removing a
29 hg qnew rm_a
29 hg qnew rm_a
30 hg rm a
30 hg rm a
31 hg qrefresh -m "rm a"
31 hg qrefresh -m "rm a"
32
32
33 # Save the patch queue so we can merge it later
33 # Save the patch queue so we can merge it later
34 hg qsave -c -e 2>&1 | rewrite_path
34 hg qsave -c -e 2>&1 | rewrite_path
35 checkundo qsave
35 checkundo qsave
36
36
37 # Update b and commit in an "update" changeset
37 # Update b and commit in an "update" changeset
38 hg up -C init
38 hg up -C init
39 echo b >> b
39 echo b >> b
40 hg st
40 hg st
41 hg ci -m update
41 hg ci -m update
42
42
43 # Here, qpush used to abort with :
43 # Here, qpush used to abort with :
44 # The system cannot find the file specified => a
44 # The system cannot find the file specified => a
45 hg manifest
45 hg manifest
46 hg qpush -a -m 2>&1 | rewrite_path
46 hg qpush -a -m 2>&1 | rewrite_path
47 checkundo 'qpush -m'
47 checkundo 'qpush -m'
48 hg manifest
48 hg manifest
49
49
50 # ensure status is correct after merge
50 # ensure status is correct after merge
51 hg qpop -a
51 hg qpop -a
52 cd ..
52 cd ..
53
53
54 # Classic MQ merge sequence *with an explicit named queue*
54 # Classic MQ merge sequence *with an explicit named queue*
55 echo
55 echo
56 echo % init t2
56 echo % init t2
57 hg init t2
57 hg init t2
58 cd t2
58 cd t2
59 echo a > a
59 echo a > a
60 hg ci -Am init
60 hg ci -Am init
61 echo b >> a
61 echo b >> a
62 hg ci -m changea
62 hg ci -m changea
63 hg up -C 0
63 hg up -C 0
64 echo c >> a
64 echo c >> a
65 hg qnew -f -e patcha
65 hg qnew -f -e patcha
66 echo % create the reference queue
66 echo % create the reference queue
67 hg qsave -c -e -n refqueue 2> /dev/null
67 hg qsave -c -e -n refqueue 2> /dev/null
68 hg up -C 1
68 hg up -C 1
69 echo % merge
69 echo % merge
70 hg qpush -m -n refqueue 2>&1 | \
70 hg qpush -m -n refqueue 2>&1 | \
71 sed 's/merging with queue at.*refqueue/merging with queue at refqueue/'
71 sed 's/merging with queue at.*refqueue/merging with queue at refqueue/'
72 cd ..
72 cd ..
73
73
@@ -1,44 +1,44
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo '[extensions]' >> $HGRCPATH
3 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.mq =' >> $HGRCPATH
4 echo 'mq =' >> $HGRCPATH
5
5
6 hg init repo
6 hg init repo
7 cd repo
7 cd repo
8
8
9 echo foo > foo
9 echo foo > foo
10 hg ci -qAm 'add a file'
10 hg ci -qAm 'add a file'
11
11
12 hg qinit
12 hg qinit
13
13
14 hg qnew foo
14 hg qnew foo
15 echo foo >> foo
15 echo foo >> foo
16 hg qrefresh -m 'append foo'
16 hg qrefresh -m 'append foo'
17
17
18 hg qnew bar
18 hg qnew bar
19 echo bar >> foo
19 echo bar >> foo
20 hg qrefresh -m 'append bar'
20 hg qrefresh -m 'append bar'
21
21
22 echo '% try to commit on top of a patch'
22 echo '% try to commit on top of a patch'
23 echo quux >> foo
23 echo quux >> foo
24 hg ci -m 'append quux'
24 hg ci -m 'append quux'
25
25
26 # cheat a bit...
26 # cheat a bit...
27 mv .hg/patches .hg/patches2
27 mv .hg/patches .hg/patches2
28 hg ci -m 'append quux'
28 hg ci -m 'append quux'
29 mv .hg/patches2 .hg/patches
29 mv .hg/patches2 .hg/patches
30
30
31 echo '% qpop/qrefresh on the wrong revision'
31 echo '% qpop/qrefresh on the wrong revision'
32 hg qpop
32 hg qpop
33 hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/'
33 hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/'
34 hg qrefresh
34 hg qrefresh
35
35
36 hg up -C qtip
36 hg up -C qtip
37 echo '% qpop'
37 echo '% qpop'
38 hg qpop
38 hg qpop
39
39
40 echo '% qrefresh'
40 echo '% qrefresh'
41 hg qrefresh
41 hg qrefresh
42
42
43 echo '% tip:'
43 echo '% tip:'
44 hg tip --template '{rev} {desc}\n'
44 hg tip --template '{rev} {desc}\n'
@@ -1,69 +1,69
1 #!/bin/sh
1 #!/bin/sh
2
2
3 commit()
3 commit()
4 {
4 {
5 msg=$1
5 msg=$1
6 p1=$2
6 p1=$2
7 p2=$3
7 p2=$3
8
8
9 if [ "$p1" ]; then
9 if [ "$p1" ]; then
10 hg up -qC $p1
10 hg up -qC $p1
11 fi
11 fi
12
12
13 if [ "$p2" ]; then
13 if [ "$p2" ]; then
14 HGMERGE=true hg merge -q $p2
14 HGMERGE=true hg merge -q $p2
15 fi
15 fi
16
16
17 echo >> foo
17 echo >> foo
18
18
19 hg commit -qAm "$msg"
19 hg commit -qAm "$msg"
20 }
20 }
21
21
22 hg init repo
22 hg init repo
23 cd repo
23 cd repo
24
24
25 echo '[extensions]' > .hg/hgrc
25 echo '[extensions]' > .hg/hgrc
26 echo 'hgext.parentrevspec =' >> .hg/hgrc
26 echo 'parentrevspec =' >> .hg/hgrc
27
27
28 commit '0: add foo'
28 commit '0: add foo'
29 commit '1: change foo 1'
29 commit '1: change foo 1'
30 commit '2: change foo 2a'
30 commit '2: change foo 2a'
31 commit '3: change foo 3a'
31 commit '3: change foo 3a'
32 commit '4: change foo 2b' 1
32 commit '4: change foo 2b' 1
33 commit '5: merge' 3 4
33 commit '5: merge' 3 4
34 commit '6: change foo again'
34 commit '6: change foo again'
35
35
36 hg log --template '{rev}:{node|short} {parents}\n'
36 hg log --template '{rev}:{node|short} {parents}\n'
37 echo
37 echo
38
38
39 lookup()
39 lookup()
40 {
40 {
41 for rev in "$@"; do
41 for rev in "$@"; do
42 printf "$rev: "
42 printf "$rev: "
43 hg id -nr $rev
43 hg id -nr $rev
44 done
44 done
45 true
45 true
46 }
46 }
47
47
48 tipnode=`hg id -ir tip`
48 tipnode=`hg id -ir tip`
49
49
50 echo 'should work with tag/branch/node/rev'
50 echo 'should work with tag/branch/node/rev'
51 for r in tip default $tipnode 6; do
51 for r in tip default $tipnode 6; do
52 lookup "$r^"
52 lookup "$r^"
53 done
53 done
54 echo
54 echo
55
55
56 echo 'some random lookups'
56 echo 'some random lookups'
57 lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3"
57 lookup "6^^" "6^^^" "6^^^^" "6^^^^^" "6^^^^^^" "6^1" "6^2" "6^^2" "6^1^2" "6^^3"
58 lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2"
58 lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2"
59 echo
59 echo
60
60
61 echo 'with a tag "6^" pointing to rev 1'
61 echo 'with a tag "6^" pointing to rev 1'
62 hg tag -l -r 1 "6^"
62 hg tag -l -r 1 "6^"
63 lookup "6^" "6^1" "6~1" "6^^"
63 lookup "6^" "6^1" "6~1" "6^^"
64 echo
64 echo
65
65
66 echo 'with a tag "foo^bar" pointing to rev 2'
66 echo 'with a tag "foo^bar" pointing to rev 2'
67 hg tag -l -r 2 "foo^bar"
67 hg tag -l -r 2 "foo^bar"
68 lookup "foo^bar" "foo^bar^"
68 lookup "foo^bar" "foo^bar^"
69
69
@@ -1,138 +1,138
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<EOF >> $HGRCPATH
3 cat <<EOF >> $HGRCPATH
4 [extensions]
4 [extensions]
5 hgext.purge=
5 purge =
6 EOF
6 EOF
7
7
8 echo % init
8 echo % init
9 hg init t
9 hg init t
10 cd t
10 cd t
11
11
12 echo % setup
12 echo % setup
13 echo r1 > r1
13 echo r1 > r1
14 hg ci -qAmr1 -d'0 0'
14 hg ci -qAmr1 -d'0 0'
15 mkdir directory
15 mkdir directory
16 echo r2 > directory/r2
16 echo r2 > directory/r2
17 hg ci -qAmr2 -d'1 0'
17 hg ci -qAmr2 -d'1 0'
18 echo 'ignored' > .hgignore
18 echo 'ignored' > .hgignore
19 hg ci -qAmr3 -d'2 0'
19 hg ci -qAmr3 -d'2 0'
20
20
21 echo % delete an empty directory
21 echo % delete an empty directory
22 mkdir empty_dir
22 mkdir empty_dir
23 hg purge -p
23 hg purge -p
24 hg purge -v
24 hg purge -v
25 ls
25 ls
26
26
27 echo % delete an untracked directory
27 echo % delete an untracked directory
28 mkdir untracked_dir
28 mkdir untracked_dir
29 touch untracked_dir/untracked_file1
29 touch untracked_dir/untracked_file1
30 touch untracked_dir/untracked_file2
30 touch untracked_dir/untracked_file2
31 hg purge -p
31 hg purge -p
32 hg purge -v
32 hg purge -v
33 ls
33 ls
34
34
35 echo % delete an untracked file
35 echo % delete an untracked file
36 touch untracked_file
36 touch untracked_file
37 touch untracked_file_readonly
37 touch untracked_file_readonly
38 python <<EOF
38 python <<EOF
39 import os, stat
39 import os, stat
40 f= 'untracked_file_readonly'
40 f= 'untracked_file_readonly'
41 os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
41 os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE)
42 EOF
42 EOF
43 hg purge -p
43 hg purge -p
44 hg purge -v
44 hg purge -v
45 ls
45 ls
46
46
47 echo % delete an untracked file in a tracked directory
47 echo % delete an untracked file in a tracked directory
48 touch directory/untracked_file
48 touch directory/untracked_file
49 hg purge -p
49 hg purge -p
50 hg purge -v
50 hg purge -v
51 ls
51 ls
52
52
53 echo % delete nested directories
53 echo % delete nested directories
54 mkdir -p untracked_directory/nested_directory
54 mkdir -p untracked_directory/nested_directory
55 hg purge -p
55 hg purge -p
56 hg purge -v
56 hg purge -v
57 ls
57 ls
58
58
59 echo % delete nested directories from a subdir
59 echo % delete nested directories from a subdir
60 mkdir -p untracked_directory/nested_directory
60 mkdir -p untracked_directory/nested_directory
61 cd directory
61 cd directory
62 hg purge -p
62 hg purge -p
63 hg purge -v
63 hg purge -v
64 cd ..
64 cd ..
65 ls
65 ls
66
66
67 echo % delete only part of the tree
67 echo % delete only part of the tree
68 mkdir -p untracked_directory/nested_directory
68 mkdir -p untracked_directory/nested_directory
69 touch directory/untracked_file
69 touch directory/untracked_file
70 cd directory
70 cd directory
71 hg purge -p ../untracked_directory
71 hg purge -p ../untracked_directory
72 hg purge -v ../untracked_directory
72 hg purge -v ../untracked_directory
73 cd ..
73 cd ..
74 ls
74 ls
75 ls directory/untracked_file
75 ls directory/untracked_file
76 rm directory/untracked_file
76 rm directory/untracked_file
77
77
78 echo % skip ignored files if --all not specified
78 echo % skip ignored files if --all not specified
79 touch ignored
79 touch ignored
80 hg purge -p
80 hg purge -p
81 hg purge -v
81 hg purge -v
82 ls
82 ls
83 hg purge -p --all
83 hg purge -p --all
84 hg purge -v --all
84 hg purge -v --all
85 ls
85 ls
86
86
87 echo % abort with missing files until we support name mangling filesystems
87 echo % abort with missing files until we support name mangling filesystems
88 touch untracked_file
88 touch untracked_file
89 rm r1
89 rm r1
90 # hide error messages to avoid changing the output when the text changes
90 # hide error messages to avoid changing the output when the text changes
91 hg purge -p 2> /dev/null
91 hg purge -p 2> /dev/null
92 hg st
92 hg st
93
93
94 hg purge -p
94 hg purge -p
95 hg purge -v 2> /dev/null
95 hg purge -v 2> /dev/null
96 hg st
96 hg st
97
97
98 hg purge -v
98 hg purge -v
99 hg revert --all --quiet
99 hg revert --all --quiet
100 hg st -a
100 hg st -a
101
101
102 echo '% tracked file in ignored directory (issue621)'
102 echo '% tracked file in ignored directory (issue621)'
103 echo directory >> .hgignore
103 echo directory >> .hgignore
104 hg ci -m 'ignore directory'
104 hg ci -m 'ignore directory'
105 touch untracked_file
105 touch untracked_file
106 hg purge -p
106 hg purge -p
107 hg purge -v
107 hg purge -v
108
108
109 echo % skip excluded files
109 echo % skip excluded files
110 touch excluded_file
110 touch excluded_file
111 hg purge -p -X excluded_file
111 hg purge -p -X excluded_file
112 hg purge -v -X excluded_file
112 hg purge -v -X excluded_file
113 ls
113 ls
114 rm excluded_file
114 rm excluded_file
115
115
116 echo % skip files in excluded dirs
116 echo % skip files in excluded dirs
117 mkdir excluded_dir
117 mkdir excluded_dir
118 touch excluded_dir/file
118 touch excluded_dir/file
119 hg purge -p -X excluded_dir
119 hg purge -p -X excluded_dir
120 hg purge -v -X excluded_dir
120 hg purge -v -X excluded_dir
121 ls
121 ls
122 ls excluded_dir
122 ls excluded_dir
123 rm -R excluded_dir
123 rm -R excluded_dir
124
124
125 echo % skip excluded empty dirs
125 echo % skip excluded empty dirs
126 mkdir excluded_dir
126 mkdir excluded_dir
127 hg purge -p -X excluded_dir
127 hg purge -p -X excluded_dir
128 hg purge -v -X excluded_dir
128 hg purge -v -X excluded_dir
129 ls
129 ls
130 rmdir excluded_dir
130 rmdir excluded_dir
131
131
132 echo % skip patterns
132 echo % skip patterns
133 mkdir .svn
133 mkdir .svn
134 touch .svn/foo
134 touch .svn/foo
135 mkdir directory/.svn
135 mkdir directory/.svn
136 touch directory/.svn/foo
136 touch directory/.svn/foo
137 hg purge -p -X .svn -X '*/.svn'
137 hg purge -p -X .svn -X '*/.svn'
138 hg purge -p -X re:.*.svn
138 hg purge -p -X re:.*.svn
General Comments 0
You need to be logged in to leave comments. Login now