##// END OF EJS Templates
tests: replace #...# syntax with {...}
Martin Geisler -
r8523:5b7da468 default
parent child Browse files
Show More
@@ -1,19 +1,19 b''
1 # this file holds the definitions that are used in various bzr tests
1 # this file holds the definitions that are used in various bzr tests
2
2
3 "$TESTDIR/hghave" bzr || exit 80
3 "$TESTDIR/hghave" bzr || exit 80
4
4
5 export TERM=dumb
5 export TERM=dumb
6 echo '[extensions]' >> $HGRCPATH
6 echo '[extensions]' >> $HGRCPATH
7 echo 'convert = ' >> $HGRCPATH
7 echo 'convert = ' >> $HGRCPATH
8 echo 'hgext.graphlog = ' >> $HGRCPATH
8 echo 'hgext.graphlog = ' >> $HGRCPATH
9
9
10 glog()
10 glog()
11 {
11 {
12 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
12 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
13 }
13 }
14
14
15 manifest()
15 manifest()
16 {
16 {
17 echo "% manifest of $2"
17 echo "% manifest of $2"
18 hg -R $1 manifest -v -r $2
18 hg -R $1 manifest -v -r $2
19 }
19 }
@@ -1,113 +1,113 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 heads()
3 heads()
4 {
4 {
5 hg heads --template '#rev#: #desc|firstline|strip#\n' "$@"
5 hg heads --template '{rev}: {desc|firstline|strip}\n' "$@"
6 }
6 }
7
7
8 hg init a
8 hg init a
9 cd a
9 cd a
10 echo 'root' >root
10 echo 'root' >root
11 hg add root
11 hg add root
12 hg commit -m "Adding root node"
12 hg commit -m "Adding root node"
13 heads
13 heads
14 echo '-------'
14 echo '-------'
15 heads .
15 heads .
16
16
17 echo '======='
17 echo '======='
18 echo 'a' >a
18 echo 'a' >a
19 hg add a
19 hg add a
20 hg branch a
20 hg branch a
21 hg commit -m "Adding a branch"
21 hg commit -m "Adding a branch"
22 heads
22 heads
23 echo '-------'
23 echo '-------'
24 heads .
24 heads .
25
25
26 echo '======='
26 echo '======='
27 hg update -C 0
27 hg update -C 0
28 echo 'b' >b
28 echo 'b' >b
29 hg add b
29 hg add b
30 hg branch b
30 hg branch b
31 hg commit -m "Adding b branch"
31 hg commit -m "Adding b branch"
32 heads
32 heads
33 echo '-------'
33 echo '-------'
34 heads .
34 heads .
35
35
36 echo '======='
36 echo '======='
37 echo 'bh1' >bh1
37 echo 'bh1' >bh1
38 hg add bh1
38 hg add bh1
39 hg commit -m "Adding b branch head 1"
39 hg commit -m "Adding b branch head 1"
40 heads
40 heads
41 echo '-------'
41 echo '-------'
42 heads .
42 heads .
43
43
44 echo '======='
44 echo '======='
45 hg update -C 2
45 hg update -C 2
46 echo 'bh2' >bh2
46 echo 'bh2' >bh2
47 hg add bh2
47 hg add bh2
48 hg commit -m "Adding b branch head 2"
48 hg commit -m "Adding b branch head 2"
49 heads
49 heads
50 echo '-------'
50 echo '-------'
51 heads .
51 heads .
52
52
53 echo '======='
53 echo '======='
54 hg update -C 2
54 hg update -C 2
55 echo 'bh3' >bh3
55 echo 'bh3' >bh3
56 hg add bh3
56 hg add bh3
57 hg commit -m "Adding b branch head 3"
57 hg commit -m "Adding b branch head 3"
58 heads
58 heads
59 echo '-------'
59 echo '-------'
60 heads .
60 heads .
61
61
62 echo '======='
62 echo '======='
63 hg merge 4
63 hg merge 4
64 hg commit -m "Merging b branch head 2 and b branch head 3"
64 hg commit -m "Merging b branch head 2 and b branch head 3"
65 heads
65 heads
66 echo '-------'
66 echo '-------'
67 heads .
67 heads .
68
68
69 echo '======='
69 echo '======='
70 echo 'c' >c
70 echo 'c' >c
71 hg add c
71 hg add c
72 hg branch c
72 hg branch c
73 hg commit -m "Adding c branch"
73 hg commit -m "Adding c branch"
74 heads
74 heads
75 echo '-------'
75 echo '-------'
76 heads .
76 heads .
77
77
78 echo '======='
78 echo '======='
79 heads -r 3 .
79 heads -r 3 .
80 echo $?
80 echo $?
81 echo '-------'
81 echo '-------'
82 heads -r 2 .
82 heads -r 2 .
83 echo $?
83 echo $?
84 echo '-------'
84 echo '-------'
85 hg update -C 4
85 hg update -C 4
86 echo $?
86 echo $?
87 echo '-------'
87 echo '-------'
88 heads -r 3 .
88 heads -r 3 .
89 echo $?
89 echo $?
90 echo '-------'
90 echo '-------'
91 heads -r 2 .
91 heads -r 2 .
92 echo $?
92 echo $?
93 echo '-------'
93 echo '-------'
94 heads -r 7 .
94 heads -r 7 .
95 echo $?
95 echo $?
96
96
97 echo '======='
97 echo '======='
98 for i in 0 1 2 3 4 5 6 7; do
98 for i in 0 1 2 3 4 5 6 7; do
99 hg update -C "$i"
99 hg update -C "$i"
100 heads
100 heads
101 echo '-------'
101 echo '-------'
102 heads .
102 heads .
103 echo '-------'
103 echo '-------'
104 done
104 done
105
105
106 echo '======='
106 echo '======='
107 for i in a b c z; do
107 for i in a b c z; do
108 heads "$i"
108 heads "$i"
109 echo '-------'
109 echo '-------'
110 done
110 done
111
111
112 echo '======='
112 echo '======='
113 heads 0 1 2 3 4 5 6 7
113 heads 0 1 2 3 4 5 6 7
@@ -1,130 +1,130 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 cd a
4 cd a
5 echo a > a
5 echo a > a
6 hg add a
6 hg add a
7 echo line 1 > b
7 echo line 1 > b
8 echo line 2 >> b
8 echo line 2 >> b
9 hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
9 hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
10 hg add b
10 hg add b
11 echo other 1 > c
11 echo other 1 > c
12 echo other 2 >> c
12 echo other 2 >> c
13 echo >> c
13 echo >> c
14 echo other 3 >> c
14 echo other 3 >> c
15 hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
15 hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
16 hg add c
16 hg add c
17 hg commit -m 'no person' -d '1200000 0' -u 'other@place'
17 hg commit -m 'no person' -d '1200000 0' -u 'other@place'
18 echo c >> c
18 echo c >> c
19 hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
19 hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
20 echo foo > .hg/branch
20 echo foo > .hg/branch
21 hg commit -m 'new branch' -d '1400000 0' -u 'person'
21 hg commit -m 'new branch' -d '1400000 0' -u 'person'
22 hg co -q 3
22 hg co -q 3
23 echo other 4 >> d
23 echo other 4 >> d
24 hg add d
24 hg add d
25 hg commit -m 'new head' -d '1500000 0' -u 'person'
25 hg commit -m 'new head' -d '1500000 0' -u 'person'
26 hg merge -q foo
26 hg merge -q foo
27 hg commit -m 'merge' -d '1500001 0' -u 'person'
27 hg commit -m 'merge' -d '1500001 0' -u 'person'
28 # second branch starting at nullrev
28 # second branch starting at nullrev
29 hg update null
29 hg update null
30 echo second > second
30 echo second > second
31 hg add second
31 hg add second
32 hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
32 hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
33 echo third > third
33 echo third > third
34 hg add third
34 hg add third
35 hg commit -m third -d "2020-01-01 10:01"
35 hg commit -m third -d "2020-01-01 10:01"
36
36
37 # make sure user/global hgrc does not affect tests
37 # make sure user/global hgrc does not affect tests
38 echo '[ui]' > .hg/hgrc
38 echo '[ui]' > .hg/hgrc
39 echo 'logtemplate =' >> .hg/hgrc
39 echo 'logtemplate =' >> .hg/hgrc
40 echo 'style =' >> .hg/hgrc
40 echo 'style =' >> .hg/hgrc
41
41
42 echo '# default style is like normal output'
42 echo '# default style is like normal output'
43 echo '# normal'
43 echo '# normal'
44 hg log > log.out
44 hg log > log.out
45 hg log --style default > style.out
45 hg log --style default > style.out
46 diff -u log.out style.out
46 diff -u log.out style.out
47 echo '# verbose'
47 echo '# verbose'
48 hg log -v > log.out
48 hg log -v > log.out
49 hg log -v --style default > style.out
49 hg log -v --style default > style.out
50 diff -u log.out style.out
50 diff -u log.out style.out
51 echo '# debug'
51 echo '# debug'
52 hg log --debug > log.out
52 hg log --debug > log.out
53 hg log --debug --style default > style.out
53 hg log --debug --style default > style.out
54 diff -u log.out style.out
54 diff -u log.out style.out
55
55
56 echo '# revision with no copies (used to print a traceback)'
56 echo '# revision with no copies (used to print a traceback)'
57 hg tip -v --template '\n'
57 hg tip -v --template '\n'
58
58
59 echo '# compact style works'
59 echo '# compact style works'
60 hg log --style compact
60 hg log --style compact
61 hg log -v --style compact
61 hg log -v --style compact
62 hg log --debug --style compact
62 hg log --debug --style compact
63
63
64 echo '# error if style not readable'
64 echo '# error if style not readable'
65 touch q
65 touch q
66 chmod 0 q
66 chmod 0 q
67 hg log --style ./q
67 hg log --style ./q
68
68
69 echo '# error if no style'
69 echo '# error if no style'
70 hg log --style notexist
70 hg log --style notexist
71
71
72 echo '# error if style missing key'
72 echo '# error if style missing key'
73 echo 'q = q' > t
73 echo 'q = q' > t
74 hg log --style ./t
74 hg log --style ./t
75
75
76 echo '# error if include fails'
76 echo '# error if include fails'
77 echo 'changeset = q' >> t
77 echo 'changeset = q' >> t
78 hg log --style ./t
78 hg log --style ./t
79
79
80 echo '# include works'
80 echo '# include works'
81 rm q
81 rm q
82 echo '{rev}' > q
82 echo '{rev}' > q
83 hg log --style ./t
83 hg log --style ./t
84
84
85 echo '# ui.style works'
85 echo '# ui.style works'
86 echo '[ui]' > .hg/hgrc
86 echo '[ui]' > .hg/hgrc
87 echo 'style = t' >> .hg/hgrc
87 echo 'style = t' >> .hg/hgrc
88 hg log
88 hg log
89
89
90 echo '# issue338'
90 echo '# issue338'
91 hg log --style=changelog > changelog
91 hg log --style=changelog > changelog
92 cat changelog
92 cat changelog
93
93
94 echo "# keys work"
94 echo "# keys work"
95 for key in author branches date desc file_adds file_dels file_mods \
95 for key in author branches date desc file_adds file_dels file_mods \
96 files manifest node parents rev tags diffstat; do
96 files manifest node parents rev tags diffstat; do
97 for mode in '' --verbose --debug; do
97 for mode in '' --verbose --debug; do
98 hg log $mode --template "$key$mode: {$key}\n"
98 hg log $mode --template "$key$mode: {$key}\n"
99 done
99 done
100 done
100 done
101
101
102 echo '# filters work'
102 echo '# filters work'
103 hg log --template '{author|domain}\n'
103 hg log --template '{author|domain}\n'
104 hg log --template '{author|person}\n'
104 hg log --template '{author|person}\n'
105 hg log --template '{author|user}\n'
105 hg log --template '{author|user}\n'
106 hg log --template '{date|age}\n' > /dev/null || exit 1
106 hg log --template '{date|age}\n' > /dev/null || exit 1
107 hg log -l1 --template '{date|age}\n'
107 hg log -l1 --template '{date|age}\n'
108 hg log --template '{date|date}\n'
108 hg log --template '{date|date}\n'
109 hg log --template '{date|isodate}\n'
109 hg log --template '{date|isodate}\n'
110 hg log --template '{date|isodatesec}\n'
110 hg log --template '{date|isodatesec}\n'
111 hg log --template '{date|rfc822date}\n'
111 hg log --template '{date|rfc822date}\n'
112 hg log --template '{desc|firstline}\n'
112 hg log --template '{desc|firstline}\n'
113 hg log --template '{node|short}\n'
113 hg log --template '{node|short}\n'
114 hg log --template '<changeset author="{author|xmlescape}"/>\n'
114 hg log --template '<changeset author="{author|xmlescape}"/>\n'
115
115
116 echo '# formatnode filter works'
116 echo '# formatnode filter works'
117 echo '# quiet'
117 echo '# quiet'
118 hg -q log -r 0 --template '#node|formatnode#\n'
118 hg -q log -r 0 --template '{node|formatnode}\n'
119 echo '# normal'
119 echo '# normal'
120 hg log -r 0 --template '#node|formatnode#\n'
120 hg log -r 0 --template '{node|formatnode}\n'
121 echo '# verbose'
121 echo '# verbose'
122 hg -v log -r 0 --template '#node|formatnode#\n'
122 hg -v log -r 0 --template '{node|formatnode}\n'
123 echo '# debug'
123 echo '# debug'
124 hg --debug log -r 0 --template '#node|formatnode#\n'
124 hg --debug log -r 0 --template '{node|formatnode}\n'
125
125
126 echo '# error on syntax'
126 echo '# error on syntax'
127 echo 'x = "f' >> t
127 echo 'x = "f' >> t
128 hg log
128 hg log
129
129
130 echo '# done'
130 echo '# done'
@@ -1,83 +1,83 b''
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 'hgext.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,105 +1,105 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" cvs cvsps || exit 80
3 "$TESTDIR/hghave" cvs cvsps || exit 80
4
4
5 cvscall()
5 cvscall()
6 {
6 {
7 cvs -f $@
7 cvs -f $@
8 }
8 }
9
9
10 hgcat()
10 hgcat()
11 {
11 {
12 hg --cwd src-hg cat -r tip "$1"
12 hg --cwd src-hg cat -r tip "$1"
13 }
13 }
14
14
15 # Test legacy configuration with external cvsps
15 # Test legacy configuration with external cvsps
16 echo "[extensions]" >> $HGRCPATH
16 echo "[extensions]" >> $HGRCPATH
17 echo "convert = " >> $HGRCPATH
17 echo "convert = " >> $HGRCPATH
18 echo "graphlog = " >> $HGRCPATH
18 echo "graphlog = " >> $HGRCPATH
19 echo "[convert]" >> $HGRCPATH
19 echo "[convert]" >> $HGRCPATH
20 echo "cvsps=cvsps -A -u --cvs-direct -q" >> $HGRCPATH
20 echo "cvsps=cvsps -A -u --cvs-direct -q" >> $HGRCPATH
21
21
22 echo % create cvs repository
22 echo % create cvs repository
23 mkdir cvsrepo
23 mkdir cvsrepo
24 cd cvsrepo
24 cd cvsrepo
25 CVSROOT=`pwd`
25 CVSROOT=`pwd`
26 export CVSROOT
26 export CVSROOT
27 CVS_OPTIONS=-f
27 CVS_OPTIONS=-f
28 export CVS_OPTIONS
28 export CVS_OPTIONS
29 cd ..
29 cd ..
30
30
31 cvscall -q -d "$CVSROOT" init
31 cvscall -q -d "$CVSROOT" init
32
32
33 echo % create source directory
33 echo % create source directory
34 mkdir src-temp
34 mkdir src-temp
35 cd src-temp
35 cd src-temp
36 echo a > a
36 echo a > a
37 mkdir b
37 mkdir b
38 cd b
38 cd b
39 echo c > c
39 echo c > c
40 cd ..
40 cd ..
41
41
42 echo % import source directory
42 echo % import source directory
43 cvscall -q import -m import src INITIAL start
43 cvscall -q import -m import src INITIAL start
44 cd ..
44 cd ..
45
45
46 echo % checkout source directory
46 echo % checkout source directory
47 cvscall -q checkout src
47 cvscall -q checkout src
48
48
49 echo % commit a new revision changing b/c
49 echo % commit a new revision changing b/c
50 cd src
50 cd src
51 sleep 1
51 sleep 1
52 echo c >> b/c
52 echo c >> b/c
53 cvscall -q commit -mci0 . | grep '<--' |\
53 cvscall -q commit -mci0 . | grep '<--' |\
54 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
54 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
55 cd ..
55 cd ..
56
56
57 echo % convert fresh repo
57 echo % convert fresh repo
58 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
58 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
59 hgcat a
59 hgcat a
60 hgcat b/c
60 hgcat b/c
61
61
62 echo % convert fresh repo with --filemap
62 echo % convert fresh repo with --filemap
63 echo include b/c > filemap
63 echo include b/c > filemap
64 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
64 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
65 hgcat b/c
65 hgcat b/c
66 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
66 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
67
67
68 echo % commit new file revisions
68 echo % commit new file revisions
69 cd src
69 cd src
70 echo a >> a
70 echo a >> a
71 echo c >> b/c
71 echo c >> b/c
72 cvscall -q commit -mci1 . | grep '<--' |\
72 cvscall -q commit -mci1 . | grep '<--' |\
73 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
73 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
74 cd ..
74 cd ..
75
75
76 echo % convert again
76 echo % convert again
77 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
77 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
78 hgcat a
78 hgcat a
79 hgcat b/c
79 hgcat b/c
80
80
81 echo % convert again with --filemap
81 echo % convert again with --filemap
82 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
82 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
83 hgcat b/c
83 hgcat b/c
84 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
84 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
85
85
86 echo % commit branch
86 echo % commit branch
87 cd src
87 cd src
88 cvs -q update -r1.1 b/c
88 cvs -q update -r1.1 b/c
89 cvs -q tag -b branch
89 cvs -q tag -b branch
90 cvs -q update -r branch > /dev/null
90 cvs -q update -r branch > /dev/null
91 echo d >> b/c
91 echo d >> b/c
92 cvs -q commit -mci2 . | grep '<--' |\
92 cvs -q commit -mci2 . | grep '<--' |\
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
93 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
94 cd ..
94 cd ..
95
95
96 echo % convert again
96 echo % convert again
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
97 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
98 hgcat a
98 hgcat a
99 hgcat b/c
99 hgcat b/c
100
100
101 echo % convert again with --filemap
101 echo % convert again with --filemap
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
102 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
103 hgcat b/c
103 hgcat b/c
104 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
104 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
105 hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'
105 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
@@ -1,64 +1,64 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # This is http://www.selenic.com/mercurial/bts/issue1148
3 # This is http://www.selenic.com/mercurial/bts/issue1148
4
4
5 "$TESTDIR/hghave" cvs || exit 80
5 "$TESTDIR/hghave" cvs || exit 80
6
6
7 cvscall()
7 cvscall()
8 {
8 {
9 cvs -f "$@"
9 cvs -f "$@"
10 }
10 }
11
11
12 echo "[extensions]" >> $HGRCPATH
12 echo "[extensions]" >> $HGRCPATH
13 echo "convert = " >> $HGRCPATH
13 echo "convert = " >> $HGRCPATH
14 echo "graphlog = " >> $HGRCPATH
14 echo "graphlog = " >> $HGRCPATH
15 echo "[convert]" >> $HGRCPATH
15 echo "[convert]" >> $HGRCPATH
16 echo "cvsps=builtin" >> $HGRCPATH
16 echo "cvsps=builtin" >> $HGRCPATH
17 echo "cvsps.cache=0" >> $HGRCPATH
17 echo "cvsps.cache=0" >> $HGRCPATH
18
18
19 echo % create cvs repository
19 echo % create cvs repository
20 mkdir cvsrepo
20 mkdir cvsrepo
21 cd cvsrepo
21 cd cvsrepo
22 CVSROOT=`pwd`
22 CVSROOT=`pwd`
23 export CVSROOT
23 export CVSROOT
24 CVS_OPTIONS=-f
24 CVS_OPTIONS=-f
25 export CVS_OPTIONS
25 export CVS_OPTIONS
26 cd ..
26 cd ..
27
27
28 cvscall -q -d "$CVSROOT" init
28 cvscall -q -d "$CVSROOT" init
29
29
30 echo % Create a new project
30 echo % Create a new project
31
31
32 mkdir src
32 mkdir src
33 cd src
33 cd src
34 echo "1" > a
34 echo "1" > a
35 echo "1" > b
35 echo "1" > b
36 cvscall import -m "init" src v0 r0 | sort
36 cvscall import -m "init" src v0 r0 | sort
37 cd ..
37 cd ..
38 cvscall co src
38 cvscall co src
39 cd src
39 cd src
40
40
41 echo % Branch the project
41 echo % Branch the project
42
42
43 cvscall tag -b BRANCH
43 cvscall tag -b BRANCH
44 cvscall up -r BRANCH > /dev/null
44 cvscall up -r BRANCH > /dev/null
45
45
46 echo % Modify file a, then b, then a
46 echo % Modify file a, then b, then a
47
47
48 echo "2" > a
48 echo "2" > a
49 cvscall ci -m "mod a" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
49 cvscall ci -m "mod a" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
50
50
51 echo "2" > b
51 echo "2" > b
52 cvscall ci -m "mod b" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
52 cvscall ci -m "mod b" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
53
53
54 echo "3" > a
54 echo "3" > a
55 cvscall ci -m "mod a again" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
55 cvscall ci -m "mod a again" | grep '<--' | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
56
56
57 echo % Convert
57 echo % Convert
58
58
59 cd ..
59 cd ..
60 hg convert src | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
60 hg convert src | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
61
61
62 echo % Check the result
62 echo % Check the result
63
63
64 hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'
64 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
@@ -1,123 +1,123 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" cvs || exit 80
3 "$TESTDIR/hghave" cvs || exit 80
4
4
5 cvscall()
5 cvscall()
6 {
6 {
7 cvs -f "$@"
7 cvs -f "$@"
8 }
8 }
9
9
10 hgcat()
10 hgcat()
11 {
11 {
12 hg --cwd src-hg cat -r tip "$1"
12 hg --cwd src-hg cat -r tip "$1"
13 }
13 }
14
14
15 echo "[extensions]" >> $HGRCPATH
15 echo "[extensions]" >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
16 echo "convert = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
17 echo "graphlog = " >> $HGRCPATH
18 echo "[convert]" >> $HGRCPATH
18 echo "[convert]" >> $HGRCPATH
19 echo "cvsps=builtin" >> $HGRCPATH
19 echo "cvsps=builtin" >> $HGRCPATH
20
20
21 echo % create cvs repository
21 echo % create cvs repository
22 mkdir cvsrepo
22 mkdir cvsrepo
23 cd cvsrepo
23 cd cvsrepo
24 CVSROOT=`pwd`
24 CVSROOT=`pwd`
25 export CVSROOT
25 export CVSROOT
26 CVS_OPTIONS=-f
26 CVS_OPTIONS=-f
27 export CVS_OPTIONS
27 export CVS_OPTIONS
28 cd ..
28 cd ..
29
29
30 cvscall -q -d "$CVSROOT" init
30 cvscall -q -d "$CVSROOT" init
31
31
32 echo % create source directory
32 echo % create source directory
33 mkdir src-temp
33 mkdir src-temp
34 cd src-temp
34 cd src-temp
35 echo a > a
35 echo a > a
36 mkdir b
36 mkdir b
37 cd b
37 cd b
38 echo c > c
38 echo c > c
39 cd ..
39 cd ..
40
40
41 echo % import source directory
41 echo % import source directory
42 cvscall -q import -m import src INITIAL start
42 cvscall -q import -m import src INITIAL start
43 cd ..
43 cd ..
44
44
45 echo % checkout source directory
45 echo % checkout source directory
46 cvscall -q checkout src
46 cvscall -q checkout src
47
47
48 echo % commit a new revision changing b/c
48 echo % commit a new revision changing b/c
49 cd src
49 cd src
50 sleep 1
50 sleep 1
51 echo c >> b/c
51 echo c >> b/c
52 cvscall -q commit -mci0 . | grep '<--' |\
52 cvscall -q commit -mci0 . | grep '<--' |\
53 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
53 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
54 cd ..
54 cd ..
55
55
56 echo % convert fresh repo
56 echo % convert fresh repo
57 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
57 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
58 hgcat a
58 hgcat a
59 hgcat b/c
59 hgcat b/c
60
60
61 echo % convert fresh repo with --filemap
61 echo % convert fresh repo with --filemap
62 echo include b/c > filemap
62 echo include b/c > filemap
63 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
63 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
64 hgcat b/c
64 hgcat b/c
65 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
65 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
66
66
67 echo % commit new file revisions
67 echo % commit new file revisions
68 cd src
68 cd src
69 echo a >> a
69 echo a >> a
70 echo c >> b/c
70 echo c >> b/c
71 cvscall -q commit -mci1 . | grep '<--' |\
71 cvscall -q commit -mci1 . | grep '<--' |\
72 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
72 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
73 cd ..
73 cd ..
74
74
75 echo % convert again
75 echo % convert again
76 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
76 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
77 hgcat a
77 hgcat a
78 hgcat b/c
78 hgcat b/c
79
79
80 echo % convert again with --filemap
80 echo % convert again with --filemap
81 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
81 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
82 hgcat b/c
82 hgcat b/c
83 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
83 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
84
84
85 echo % commit branch
85 echo % commit branch
86 cd src
86 cd src
87 cvs -q update -r1.1 b/c
87 cvs -q update -r1.1 b/c
88 cvs -q tag -b branch
88 cvs -q tag -b branch
89 cvs -q update -r branch > /dev/null
89 cvs -q update -r branch > /dev/null
90 echo d >> b/c
90 echo d >> b/c
91 cvs -q commit -mci2 . | grep '<--' |\
91 cvs -q commit -mci2 . | grep '<--' |\
92 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
92 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
93 cd ..
93 cd ..
94
94
95 echo % convert again
95 echo % convert again
96 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
96 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
97 hgcat a
97 hgcat a
98 hgcat b/c
98 hgcat b/c
99
99
100 echo % convert again with --filemap
100 echo % convert again with --filemap
101 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
101 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
102 hgcat b/c
102 hgcat b/c
103 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
103 hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
104
104
105 echo % commit a new revision with funny log message
105 echo % commit a new revision with funny log message
106 cd src
106 cd src
107 sleep 1
107 sleep 1
108 echo e >> a
108 echo e >> a
109 cvscall -q commit -m'funny
109 cvscall -q commit -m'funny
110 ----------------------------
110 ----------------------------
111 log message' . | grep '<--' |\
111 log message' . | grep '<--' |\
112 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
112 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
113 cd ..
113 cd ..
114
114
115 echo % convert again
115 echo % convert again
116 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
116 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
117
117
118 echo "graphlog = " >> $HGRCPATH
118 echo "graphlog = " >> $HGRCPATH
119 hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'
119 hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
120
120
121 echo % testing debugcvsps
121 echo % testing debugcvsps
122 cd src
122 cd src
123 hg debugcvsps | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
123 hg debugcvsps | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/'
@@ -1,68 +1,68 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" darcs || exit 80
3 "$TESTDIR/hghave" darcs || exit 80
4 if darcs --version 2>&1 | grep '^2\.' > /dev/null; then
4 if darcs --version 2>&1 | grep '^2\.' > /dev/null; then
5 # FIXME: darcs 2 will fail with
5 # FIXME: darcs 2 will fail with
6 ### Abort: timeout after 180 seconds.
6 ### Abort: timeout after 180 seconds.
7 echo 'skipped: test currently disabled for darcs 2'
7 echo 'skipped: test currently disabled for darcs 2'
8 exit 80
8 exit 80
9 fi
9 fi
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 'hgext.graphlog =' >> $HGRCPATH
14
14
15 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
15 DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
16 HOME=do_not_use_HOME_darcs; export HOME
16 HOME=do_not_use_HOME_darcs; export HOME
17
17
18 # skip if we can't import elementtree
18 # skip if we can't import elementtree
19 mkdir dummy
19 mkdir dummy
20 mkdir dummy/_darcs
20 mkdir dummy/_darcs
21 if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
21 if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
22 echo 'skipped: missing feature: elementtree module'
22 echo 'skipped: missing feature: elementtree module'
23 exit 80
23 exit 80
24 fi
24 fi
25
25
26 echo % initialize darcs repo
26 echo % initialize darcs repo
27 mkdir darcs-repo
27 mkdir darcs-repo
28 cd darcs-repo
28 cd darcs-repo
29 darcs init
29 darcs init
30 echo a > a
30 echo a > a
31 darcs record -a -l -m p0
31 darcs record -a -l -m p0
32 cd ..
32 cd ..
33
33
34 echo % branch and update
34 echo % branch and update
35 darcs get darcs-repo darcs-clone >/dev/null
35 darcs get darcs-repo darcs-clone >/dev/null
36 cd darcs-clone
36 cd darcs-clone
37 echo c >> a
37 echo c >> a
38 echo c > c
38 echo c > c
39 darcs record -a -l -m p1.1
39 darcs record -a -l -m p1.1
40 cd ..
40 cd ..
41
41
42 echo % update source
42 echo % update source
43 cd darcs-repo
43 cd darcs-repo
44 echo b >> a
44 echo b >> a
45 echo b > b
45 echo b > b
46 darcs record -a -l -m p1.2
46 darcs record -a -l -m p1.2
47
47
48 echo % merge branch
48 echo % merge branch
49 darcs pull -a ../darcs-clone
49 darcs pull -a ../darcs-clone
50 echo e > a
50 echo e > a
51 darcs record -a -l -m p2
51 darcs record -a -l -m p2
52 cd ..
52 cd ..
53
53
54 glog()
54 glog()
55 {
55 {
56 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
56 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
57 }
57 }
58
58
59 hg convert darcs-repo darcs-repo-hg 2>&1 | grep -v hGetLine | grep -v '^$'
59 hg convert darcs-repo darcs-repo-hg 2>&1 | grep -v hGetLine | grep -v '^$'
60 # The converter does not currently handle patch conflicts very well.
60 # The converter does not currently handle patch conflicts very well.
61 # When they occur, it reverts *all* changes and moves forward,
61 # When they occur, it reverts *all* changes and moves forward,
62 # letting the conflict resolving patch fix collisions.
62 # letting the conflict resolving patch fix collisions.
63 # Unfortunately, non-conflicting changes, like the addition of the
63 # Unfortunately, non-conflicting changes, like the addition of the
64 # "c" file in p1.1 patch are reverted too.
64 # "c" file in p1.1 patch are reverted too.
65 # Just to say that manifest not listing "c" here is a bug.
65 # Just to say that manifest not listing "c" here is a bug.
66 glog -R darcs-repo-hg
66 glog -R darcs-repo-hg
67 hg up -q -R darcs-repo-hg
67 hg up -q -R darcs-repo-hg
68 hg -R darcs-repo-hg manifest --debug
68 hg -R darcs-repo-hg manifest --debug
@@ -1,40 +1,40 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat >> $HGRCPATH <<EOF
3 cat >> $HGRCPATH <<EOF
4 [extensions]
4 [extensions]
5 convert=
5 convert=
6 graphlog=
6 graphlog=
7 EOF
7 EOF
8
8
9 hg init t
9 hg init t
10 cd t
10 cd t
11 echo a >> a
11 echo a >> a
12 hg ci -Am a0 -d '1 0'
12 hg ci -Am a0 -d '1 0'
13 hg branch brancha
13 hg branch brancha
14 echo a >> a
14 echo a >> a
15 hg ci -m a1 -d '2 0'
15 hg ci -m a1 -d '2 0'
16 echo a >> a
16 echo a >> a
17 hg ci -m a2 -d '3 0'
17 hg ci -m a2 -d '3 0'
18 echo a >> a
18 echo a >> a
19 hg ci -m a3 -d '4 0'
19 hg ci -m a3 -d '4 0'
20 hg up -C 0
20 hg up -C 0
21 hg branch branchb
21 hg branch branchb
22 echo b >> b
22 echo b >> b
23 hg ci -Am b0 -d '5 0'
23 hg ci -Am b0 -d '5 0'
24 hg up -C brancha
24 hg up -C brancha
25 echo a >> a
25 echo a >> a
26 hg ci -m a4 -d '6 0'
26 hg ci -m a4 -d '6 0'
27 echo a >> a
27 echo a >> a
28 hg ci -m a5 -d '7 0'
28 hg ci -m a5 -d '7 0'
29 echo a >> a
29 echo a >> a
30 hg ci -m a6 -d '8 0'
30 hg ci -m a6 -d '8 0'
31 hg up -C branchb
31 hg up -C branchb
32 echo b >> b
32 echo b >> b
33 hg ci -m b1 -d '9 0'
33 hg ci -m b1 -d '9 0'
34 cd ..
34 cd ..
35
35
36 echo % convert with datesort
36 echo % convert with datesort
37 hg convert --datesort t t2
37 hg convert --datesort t t2
38 echo % graph converted repo
38 echo % graph converted repo
39 hg -R t2 glog --template '#rev# "#desc#"\n'
39 hg -R t2 glog --template '{rev} "{desc}"\n'
40
40
@@ -1,126 +1,126 b''
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 'hgext.graphlog =' >> $HGRCPATH
7 echo 'hgext.convert =' >> $HGRCPATH
7 echo 'hgext.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 dir
19 mkdir dir
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 hg ci -d '0 0' -qAm '0: add foo baz dir/'
22 hg ci -d '0 0' -qAm '0: add foo baz dir/'
23
23
24 echo bar > bar
24 echo bar > bar
25 echo quux > quux
25 echo quux > quux
26 hg copy foo copied
26 hg copy foo copied
27 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
27 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
28
28
29 echo >> foo
29 echo >> foo
30 hg ci -d '2 0' -m '2: change foo'
30 hg ci -d '2 0' -m '2: change foo'
31
31
32 hg up -qC 1
32 hg up -qC 1
33 echo >> bar
33 echo >> bar
34 echo >> quux
34 echo >> quux
35 hg ci -d '3 0' -m '3: change bar quux'
35 hg ci -d '3 0' -m '3: change bar quux'
36
36
37 hg up -qC 2
37 hg up -qC 2
38 hg merge -qr 3
38 hg merge -qr 3
39 echo >> bar
39 echo >> bar
40 echo >> baz
40 echo >> baz
41 hg ci -d '4 0' -m '4: first merge; change bar baz'
41 hg ci -d '4 0' -m '4: first merge; change bar baz'
42
42
43 echo >> bar
43 echo >> bar
44 echo 1 >> baz
44 echo 1 >> baz
45 echo >> quux
45 echo >> quux
46 hg ci -d '5 0' -m '5: change bar baz quux'
46 hg ci -d '5 0' -m '5: change bar baz quux'
47
47
48 hg up -qC 4
48 hg up -qC 4
49 echo >> foo
49 echo >> foo
50 echo 2 >> baz
50 echo 2 >> baz
51 hg ci -d '6 0' -m '6: change foo baz'
51 hg ci -d '6 0' -m '6: change foo baz'
52
52
53 hg up -qC 5
53 hg up -qC 5
54 hg merge -qr 6
54 hg merge -qr 6
55 echo >> bar
55 echo >> bar
56 hg ci -d '7 0' -m '7: second merge; change bar'
56 hg ci -d '7 0' -m '7: second merge; change bar'
57
57
58 echo >> foo
58 echo >> foo
59 hg ci -m '8: change foo'
59 hg ci -m '8: change foo'
60
60
61 glog
61 glog
62
62
63 echo '% final file versions in this repo:'
63 echo '% final file versions in this repo:'
64 hg manifest --debug
64 hg manifest --debug
65 hg debugrename copied
65 hg debugrename copied
66 echo
66 echo
67
67
68 cd ..
68 cd ..
69
69
70 splitrepo()
70 splitrepo()
71 {
71 {
72 msg="$1"
72 msg="$1"
73 files="$2"
73 files="$2"
74 opts=$3
74 opts=$3
75 echo "% $files: $msg"
75 echo "% $files: $msg"
76 prefix=`echo "$files" | sed -e 's/ /-/g'`
76 prefix=`echo "$files" | sed -e 's/ /-/g'`
77 fmap="$prefix.fmap"
77 fmap="$prefix.fmap"
78 repo="$prefix.repo"
78 repo="$prefix.repo"
79 for i in $files; do
79 for i in $files; do
80 echo "include $i" >> "$fmap"
80 echo "include $i" >> "$fmap"
81 done
81 done
82 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
82 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
83 hg up -q -R "$repo"
83 hg up -q -R "$repo"
84 glog -R "$repo"
84 glog -R "$repo"
85 hg -R "$repo" manifest --debug
85 hg -R "$repo" manifest --debug
86 }
86 }
87
87
88 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
88 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
89
89
90 splitrepo 'merges are not merges anymore' bar
90 splitrepo 'merges are not merges anymore' bar
91
91
92 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
92 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
93
93
94 splitrepo 'we add additional merges when they are interesting' 'foo quux'
94 splitrepo 'we add additional merges when they are interesting' 'foo quux'
95
95
96 splitrepo 'partial conversion' 'bar quux' '-r 3'
96 splitrepo 'partial conversion' 'bar quux' '-r 3'
97 splitrepo 'complete the partial conversion' 'bar quux'
97 splitrepo 'complete the partial conversion' 'bar quux'
98
98
99 rm -r foo.repo
99 rm -r foo.repo
100 splitrepo 'partial conversion' 'foo' '-r 3'
100 splitrepo 'partial conversion' 'foo' '-r 3'
101 splitrepo 'complete the partial conversion' 'foo'
101 splitrepo 'complete the partial conversion' 'foo'
102
102
103 splitrepo 'copied file; source not included in new repo' copied
103 splitrepo 'copied file; source not included in new repo' copied
104 hg --cwd copied.repo debugrename copied
104 hg --cwd copied.repo debugrename copied
105
105
106 splitrepo 'copied file; source included in new repo' 'foo copied'
106 splitrepo 'copied file; source included in new repo' 'foo copied'
107 hg --cwd foo-copied.repo debugrename copied
107 hg --cwd foo-copied.repo debugrename copied
108
108
109 cat > renames.fmap <<EOF
109 cat > renames.fmap <<EOF
110 include dir
110 include dir
111 exclude dir/file2
111 exclude dir/file2
112 rename dir dir2
112 rename dir dir2
113 include foo
113 include foo
114 include copied
114 include copied
115 rename foo foo2
115 rename foo foo2
116 rename copied copied2
116 rename copied copied2
117 EOF
117 EOF
118 hg -q convert --filemap renames.fmap --datesort source renames.repo
118 hg -q convert --filemap renames.fmap --datesort source renames.repo
119 hg up -q -R renames.repo
119 hg up -q -R renames.repo
120 glog -R renames.repo
120 glog -R renames.repo
121 hg -R renames.repo manifest --debug
121 hg -R renames.repo manifest --debug
122 hg --cwd renames.repo debugrename copied2
122 hg --cwd renames.repo debugrename copied2
123 echo 'copied:'
123 echo 'copied:'
124 hg --cwd source cat copied
124 hg --cwd source cat copied
125 echo 'copied2:'
125 echo 'copied2:'
126 hg --cwd renames.repo cat copied2
126 hg --cwd renames.repo cat copied2
@@ -1,169 +1,169 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" git || exit 80
3 "$TESTDIR/hghave" git || 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 'hgext.graphlog =' >> $HGRCPATH
8
8
9 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
9 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
10 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
10 GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
11 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
11 GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
12 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
12 GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
13 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
13 GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
14 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
14 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
15
15
16 count=10
16 count=10
17 commit()
17 commit()
18 {
18 {
19 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
19 GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
20 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
20 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
21 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
21 git commit "$@" >/dev/null 2>/dev/null || echo "git commit error"
22 count=`expr $count + 1`
22 count=`expr $count + 1`
23 }
23 }
24
24
25 mkdir git-repo
25 mkdir git-repo
26 cd git-repo
26 cd git-repo
27 git init-db >/dev/null 2>/dev/null
27 git init-db >/dev/null 2>/dev/null
28 echo a > a
28 echo a > a
29 mkdir d
29 mkdir d
30 echo b > d/b
30 echo b > d/b
31 git add a d
31 git add a d
32 commit -a -m t1
32 commit -a -m t1
33
33
34 # Remove the directory, then try to replace it with a file
34 # Remove the directory, then try to replace it with a file
35 # (issue 754)
35 # (issue 754)
36 git rm -f d/b
36 git rm -f d/b
37 commit -m t2
37 commit -m t2
38 echo d > d
38 echo d > d
39 git add d
39 git add d
40 commit -m t3
40 commit -m t3
41
41
42 echo b >> a
42 echo b >> a
43 commit -a -m t4.1
43 commit -a -m t4.1
44
44
45 git checkout -b other HEAD^ >/dev/null 2>/dev/null
45 git checkout -b other HEAD^ >/dev/null 2>/dev/null
46 echo c > a
46 echo c > a
47 echo a >> a
47 echo a >> a
48 commit -a -m t4.2
48 commit -a -m t4.2
49
49
50 git checkout master >/dev/null 2>/dev/null
50 git checkout master >/dev/null 2>/dev/null
51 git pull --no-commit . other > /dev/null 2>/dev/null
51 git pull --no-commit . other > /dev/null 2>/dev/null
52 commit -m 'Merge branch other'
52 commit -m 'Merge branch other'
53 cd ..
53 cd ..
54
54
55 hg convert --datesort git-repo
55 hg convert --datesort git-repo
56 hg up -q -R git-repo-hg
56 hg up -q -R git-repo-hg
57 hg -R git-repo-hg tip -v
57 hg -R git-repo-hg tip -v
58
58
59 count=10
59 count=10
60 mkdir git-repo2
60 mkdir git-repo2
61 cd git-repo2
61 cd git-repo2
62 git init-db >/dev/null 2>/dev/null
62 git init-db >/dev/null 2>/dev/null
63
63
64 echo foo > foo
64 echo foo > foo
65 git add foo
65 git add foo
66 commit -a -m 'add foo'
66 commit -a -m 'add foo'
67
67
68 echo >> foo
68 echo >> foo
69 commit -a -m 'change foo'
69 commit -a -m 'change foo'
70
70
71 git checkout -b Bar HEAD^ >/dev/null 2>/dev/null
71 git checkout -b Bar HEAD^ >/dev/null 2>/dev/null
72 echo quux >> quux
72 echo quux >> quux
73 git add quux
73 git add quux
74 commit -a -m 'add quux'
74 commit -a -m 'add quux'
75
75
76 echo bar > bar
76 echo bar > bar
77 git add bar
77 git add bar
78 commit -a -m 'add bar'
78 commit -a -m 'add bar'
79
79
80 git checkout -b Baz HEAD^ >/dev/null 2>/dev/null
80 git checkout -b Baz HEAD^ >/dev/null 2>/dev/null
81 echo baz > baz
81 echo baz > baz
82 git add baz
82 git add baz
83 commit -a -m 'add baz'
83 commit -a -m 'add baz'
84
84
85 git checkout master >/dev/null 2>/dev/null
85 git checkout master >/dev/null 2>/dev/null
86 git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
86 git pull --no-commit . Bar Baz > /dev/null 2>/dev/null
87 commit -m 'Octopus merge'
87 commit -m 'Octopus merge'
88
88
89 echo bar >> bar
89 echo bar >> bar
90 commit -a -m 'change bar'
90 commit -a -m 'change bar'
91
91
92 git checkout -b Foo HEAD^ >/dev/null 2>/dev/null
92 git checkout -b Foo HEAD^ >/dev/null 2>/dev/null
93 echo >> foo
93 echo >> foo
94 commit -a -m 'change foo'
94 commit -a -m 'change foo'
95
95
96 git checkout master >/dev/null 2>/dev/null
96 git checkout master >/dev/null 2>/dev/null
97 git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
97 git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null
98 commit -m 'Discard change to foo'
98 commit -m 'Discard change to foo'
99
99
100 cd ..
100 cd ..
101
101
102 glog()
102 glog()
103 {
103 {
104 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
104 hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
105 }
105 }
106
106
107 splitrepo()
107 splitrepo()
108 {
108 {
109 msg="$1"
109 msg="$1"
110 files="$2"
110 files="$2"
111 opts=$3
111 opts=$3
112 echo "% $files: $msg"
112 echo "% $files: $msg"
113 prefix=`echo "$files" | sed -e 's/ /-/g'`
113 prefix=`echo "$files" | sed -e 's/ /-/g'`
114 fmap="$prefix.fmap"
114 fmap="$prefix.fmap"
115 repo="$prefix.repo"
115 repo="$prefix.repo"
116 for i in $files; do
116 for i in $files; do
117 echo "include $i" >> "$fmap"
117 echo "include $i" >> "$fmap"
118 done
118 done
119 hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
119 hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo"
120 hg up -q -R "$repo"
120 hg up -q -R "$repo"
121 glog -R "$repo"
121 glog -R "$repo"
122 hg -R "$repo" manifest --debug
122 hg -R "$repo" manifest --debug
123 }
123 }
124
124
125 echo '% full conversion'
125 echo '% full conversion'
126 hg -q convert --datesort git-repo2 fullrepo
126 hg -q convert --datesort git-repo2 fullrepo
127 hg up -q -R fullrepo
127 hg up -q -R fullrepo
128 glog -R fullrepo
128 glog -R fullrepo
129 hg -R fullrepo manifest --debug
129 hg -R fullrepo manifest --debug
130
130
131 splitrepo 'octopus merge' 'foo bar baz'
131 splitrepo 'octopus merge' 'foo bar baz'
132
132
133 splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
133 splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux'
134
134
135 echo
135 echo
136 echo '% test binary conversion (issue 1359)'
136 echo '% test binary conversion (issue 1359)'
137 mkdir git-repo3
137 mkdir git-repo3
138 cd git-repo3
138 cd git-repo3
139 git init-db >/dev/null 2>/dev/null
139 git init-db >/dev/null 2>/dev/null
140 python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
140 python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)'
141 git add b
141 git add b
142 commit -a -m addbinary
142 commit -a -m addbinary
143 cd ..
143 cd ..
144
144
145 echo '% convert binary file'
145 echo '% convert binary file'
146 hg convert git-repo3 git-repo3-hg
146 hg convert git-repo3 git-repo3-hg
147
147
148 cd git-repo3-hg
148 cd git-repo3-hg
149 hg up -C
149 hg up -C
150 python -c 'print len(file("b", "rb").read())'
150 python -c 'print len(file("b", "rb").read())'
151 cd ..
151 cd ..
152
152
153 echo
153 echo
154 echo '% test author vs committer'
154 echo '% test author vs committer'
155 mkdir git-repo4
155 mkdir git-repo4
156 cd git-repo4
156 cd git-repo4
157 git init-db >/dev/null 2>/dev/null
157 git init-db >/dev/null 2>/dev/null
158 echo >> foo
158 echo >> foo
159 git add foo
159 git add foo
160 commit -a -m addfoo
160 commit -a -m addfoo
161 echo >> foo
161 echo >> foo
162 GIT_AUTHOR_NAME="nottest"
162 GIT_AUTHOR_NAME="nottest"
163 commit -a -m addfoo2
163 commit -a -m addfoo2
164 cd ..
164 cd ..
165
165
166 echo '% convert author committer'
166 echo '% convert author committer'
167 hg convert git-repo4 git-repo4-hg
167 hg convert git-repo4 git-repo4-hg
168 cd git-repo4-hg
168 cd git-repo4-hg
169 hg log -v
169 hg log -v
@@ -1,61 +1,61 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo '[extensions]' >> $HGRCPATH
3 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.graphlog =' >> $HGRCPATH
4 echo 'hgext.graphlog =' >> $HGRCPATH
5 echo 'hgext.convert =' >> $HGRCPATH
5 echo 'hgext.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 b''
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 'hgext.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,75 +1,75 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" p4 || exit 80
3 "$TESTDIR/hghave" p4 || exit 80
4
4
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
6 echo "convert = " >> $HGRCPATH
7
7
8 echo % create p4 depot
8 echo % create p4 depot
9 export P4ROOT=$PWD/depot
9 export P4ROOT=$PWD/depot
10 export P4AUDIT=$P4ROOT/audit
10 export P4AUDIT=$P4ROOT/audit
11 export P4JOURNAL=$P4ROOT/journal
11 export P4JOURNAL=$P4ROOT/journal
12 export P4LOG=$P4ROOT/log
12 export P4LOG=$P4ROOT/log
13 export P4PORT=localhost:16661
13 export P4PORT=localhost:16661
14 export P4DEBUG=1
14 export P4DEBUG=1
15
15
16 echo % start the p4 server
16 echo % start the p4 server
17 [ ! -d $P4ROOT ] && mkdir $P4ROOT
17 [ ! -d $P4ROOT ] && mkdir $P4ROOT
18 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
18 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
19 trap "echo % stop the p4 server ; p4 admin stop" EXIT
19 trap "echo % stop the p4 server ; p4 admin stop" EXIT
20
20
21 # wait for the server to initialize
21 # wait for the server to initialize
22 while ! p4 ; do
22 while ! p4 ; do
23 sleep 1
23 sleep 1
24 done >/dev/null 2>/dev/null
24 done >/dev/null 2>/dev/null
25
25
26 echo % create a client spec
26 echo % create a client spec
27 export P4CLIENT=hg-p4-import
27 export P4CLIENT=hg-p4-import
28 DEPOTPATH=//depot/test-mercurial-import/...
28 DEPOTPATH=//depot/test-mercurial-import/...
29 p4 client -o | sed '/^View:/,$ d' >p4client
29 p4 client -o | sed '/^View:/,$ d' >p4client
30 echo View: >>p4client
30 echo View: >>p4client
31 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
31 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
32 p4 client -i <p4client
32 p4 client -i <p4client
33
33
34 echo % populate the depot
34 echo % populate the depot
35 echo a > a
35 echo a > a
36 mkdir b
36 mkdir b
37 echo c > b/c
37 echo c > b/c
38 p4 add a b/c
38 p4 add a b/c
39 p4 submit -d initial
39 p4 submit -d initial
40
40
41 echo % change some files
41 echo % change some files
42 p4 edit a
42 p4 edit a
43 echo aa >> a
43 echo aa >> a
44 p4 submit -d "change a"
44 p4 submit -d "change a"
45
45
46 p4 edit b/c
46 p4 edit b/c
47 echo cc >> b/c
47 echo cc >> b/c
48 p4 submit -d "change b/c"
48 p4 submit -d "change b/c"
49
49
50 echo % convert
50 echo % convert
51 hg convert -s p4 $DEPOTPATH dst
51 hg convert -s p4 $DEPOTPATH dst
52 hg -R dst log --template 'rev=#rev# desc="#desc#" tags="#tags#" files="#files#"\n'
52 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
53
53
54 echo % change some files
54 echo % change some files
55 p4 edit a b/c
55 p4 edit a b/c
56 echo aaa >> a
56 echo aaa >> a
57 echo ccc >> b/c
57 echo ccc >> b/c
58 p4 submit -d "change a b/c"
58 p4 submit -d "change a b/c"
59
59
60 echo % convert again
60 echo % convert again
61 hg convert -s p4 $DEPOTPATH dst
61 hg convert -s p4 $DEPOTPATH dst
62 hg -R dst log --template 'rev=#rev# desc="#desc#" tags="#tags#" files="#files#"\n'
62 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
63
63
64 echo % interesting names
64 echo % interesting names
65 echo dddd > "d d"
65 echo dddd > "d d"
66 mkdir " e"
66 mkdir " e"
67 echo fff >" e/ f"
67 echo fff >" e/ f"
68 p4 add "d d" " e/ f"
68 p4 add "d d" " e/ f"
69 p4 submit -d "add d e f"
69 p4 submit -d "add d e f"
70
70
71 echo % convert again
71 echo % convert again
72 hg convert -s p4 $DEPOTPATH dst
72 hg convert -s p4 $DEPOTPATH dst
73 hg -R dst log --template 'rev=#rev# desc="#desc#" tags="#tags#" files="#files#"\n'
73 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
74
74
75
75
@@ -1,51 +1,51 b''
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 'hgext.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,39 +1,39 b''
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 "hgext.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 svnpath=`pwd | fix_path`
17 svnpath=`pwd | fix_path`
18 # SVN wants all paths to start with a slash. Unfortunately,
18 # SVN wants all paths to start with a slash. Unfortunately,
19 # Windows ones don't. Handle that.
19 # Windows ones don't. Handle that.
20 expr $svnpath : "\/" > /dev/null
20 expr $svnpath : "\/" > /dev/null
21 if [ $? -ne 0 ]; then
21 if [ $? -ne 0 ]; then
22 svnpath='/'$svnpath
22 svnpath='/'$svnpath
23 fi
23 fi
24 svnurl=file://$svnpath/svn-repo
24 svnurl=file://$svnpath/svn-repo
25
25
26 echo % convert trunk and branches
26 echo % convert trunk and branches
27 cat >branchmap <<EOF
27 cat >branchmap <<EOF
28 old3 newbranch
28 old3 newbranch
29 EOF
29 EOF
30 hg convert --branchmap=branchmap --datesort -r 10 $svnurl A-hg
30 hg convert --branchmap=branchmap --datesort -r 10 $svnurl A-hg
31
31
32 echo % convert again
32 echo % convert again
33 hg convert --branchmap=branchmap --datesort $svnurl A-hg
33 hg convert --branchmap=branchmap --datesort $svnurl A-hg
34
34
35 cd A-hg
35 cd A-hg
36 hg glog --template 'branch=#branches# #rev# #desc|firstline# files: #files#\n'
36 hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
37 hg branches | sed 's/:.*/:/'
37 hg branches | sed 's/:.*/:/'
38 hg tags -q
38 hg tags -q
39 cd ..
39 cd ..
@@ -1,32 +1,32 b''
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 "hgext.graphlog =" >> $HGRCPATH
13
13
14 svnadmin create svn-repo
14 svnadmin create svn-repo
15 cat "$TESTDIR/svn/move.svndump" | svnadmin load svn-repo > /dev/null
15 cat "$TESTDIR/svn/move.svndump" | svnadmin load svn-repo > /dev/null
16
16
17 svnpath=`pwd | fix_path`
17 svnpath=`pwd | fix_path`
18 # SVN wants all paths to start with a slash. Unfortunately,
18 # SVN wants all paths to start with a slash. Unfortunately,
19 # Windows ones don't. Handle that.
19 # Windows ones don't. Handle that.
20 expr $svnpath : "\/" > /dev/null
20 expr $svnpath : "\/" > /dev/null
21 if [ $? -ne 0 ]; then
21 if [ $? -ne 0 ]; then
22 svnpath='/'$svnpath
22 svnpath='/'$svnpath
23 fi
23 fi
24 svnurl=file://$svnpath/svn-repo
24 svnurl=file://$svnpath/svn-repo
25
25
26 echo % convert trunk and branches
26 echo % convert trunk and branches
27 hg convert --datesort $svnurl/subproject A-hg
27 hg convert --datesort $svnurl/subproject A-hg
28
28
29 cd A-hg
29 cd A-hg
30 hg glog --template '#rev# #desc|firstline# files: #files#\n'
30 hg glog --template '{rev} {desc|firstline} files: {files}\n'
31 hg branches | sed 's/:.*/:/'
31 hg branches | sed 's/:.*/:/'
32 cd ..
32 cd ..
@@ -1,89 +1,89 b''
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 'hgext.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,46 +1,46 b''
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 "hgext.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 svnpath=`pwd | fix_path`
17 svnpath=`pwd | fix_path`
18 # SVN wants all paths to start with a slash. Unfortunately,
18 # SVN wants all paths to start with a slash. Unfortunately,
19 # Windows ones don't. Handle that.
19 # Windows ones don't. Handle that.
20 expr $svnpath : "\/" > /dev/null
20 expr $svnpath : "\/" > /dev/null
21 if [ $? -ne 0 ]; then
21 if [ $? -ne 0 ]; then
22 svnpath='/'$svnpath
22 svnpath='/'$svnpath
23 fi
23 fi
24 svnurl=file://$svnpath/svn-repo
24 svnurl=file://$svnpath/svn-repo
25
25
26 convert()
26 convert()
27 {
27 {
28 startrev=$1
28 startrev=$1
29 repopath=A-r$startrev-hg
29 repopath=A-r$startrev-hg
30 hg convert --config convert.svn.startrev=$startrev \
30 hg convert --config convert.svn.startrev=$startrev \
31 --config convert.svn.trunk=branches/branch1 \
31 --config convert.svn.trunk=branches/branch1 \
32 --config convert.svn.branches=" " \
32 --config convert.svn.branches=" " \
33 --config convert.svn.tags= \
33 --config convert.svn.tags= \
34 --datesort $svnurl $repopath
34 --datesort $svnurl $repopath
35 hg -R $repopath glog --template '#rev# #desc|firstline# files: #files#\n'
35 hg -R $repopath glog --template '{rev} {desc|firstline} files: {files}\n'
36 echo
36 echo
37 }
37 }
38
38
39 echo % convert before branching point
39 echo % convert before branching point
40 convert 3
40 convert 3
41 echo % convert before branching point
41 echo % convert before branching point
42 convert 4
42 convert 4
43 echo % convert at branching point
43 echo % convert at branching point
44 convert 5
44 convert 5
45 echo % convert last revision only
45 echo % convert last revision only
46 convert 6
46 convert 6
@@ -1,37 +1,37 b''
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 "hgext.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 svnpath=`pwd | fix_path`
17 svnpath=`pwd | fix_path`
18 # SVN wants all paths to start with a slash. Unfortunately,
18 # SVN wants all paths to start with a slash. Unfortunately,
19 # Windows ones don't. Handle that.
19 # Windows ones don't. Handle that.
20 expr $svnpath : "\/" > /dev/null
20 expr $svnpath : "\/" > /dev/null
21 if [ $? -ne 0 ]; then
21 if [ $? -ne 0 ]; then
22 svnpath='/'$svnpath
22 svnpath='/'$svnpath
23 fi
23 fi
24 svnurl=file://$svnpath/svn-repo
24 svnurl=file://$svnpath/svn-repo
25
25
26 echo % convert
26 echo % convert
27 hg convert --datesort $svnurl A-hg
27 hg convert --datesort $svnurl A-hg
28
28
29 cd A-hg
29 cd A-hg
30 hg glog --template '#rev# #desc|firstline# tags: #tags#\n'
30 hg glog --template '{rev} {desc|firstline} tags: {tags}\n'
31 hg tags | sed 's/:.*/:/'
31 hg tags | sed 's/:.*/:/'
32 cd ..
32 cd ..
33
33
34 echo % convert without tags
34 echo % convert without tags
35 hg convert --datesort --config convert.svn.tags= $svnurl A-notags-hg
35 hg convert --datesort --config convert.svn.tags= $svnurl A-notags-hg
36 hg -R A-notags-hg tags -q
36 hg -R A-notags-hg tags -q
37
37
@@ -1,73 +1,73 b''
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 'hgext.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,50 +1,50 b''
1 #!/bin/sh -e
1 #!/bin/sh -e
2
2
3 umask 027
3 umask 027
4 mkdir test1
4 mkdir test1
5 cd test1
5 cd test1
6
6
7 hg init
7 hg init
8 touch a b
8 touch a b
9 hg add a b
9 hg add a b
10 hg ci -m "added a b" -d "1000000 0"
10 hg ci -m "added a b" -d "1000000 0"
11
11
12 cd ..
12 cd ..
13 hg clone test1 test3
13 hg clone test1 test3
14 mkdir test2
14 mkdir test2
15 cd test2
15 cd test2
16
16
17 hg init
17 hg init
18 hg pull ../test1
18 hg pull ../test1
19 hg co
19 hg co
20 chmod +x a
20 chmod +x a
21 hg ci -m "chmod +x a" -d "1000000 0"
21 hg ci -m "chmod +x a" -d "1000000 0"
22 echo % the changelog should mention file a:
22 echo % the changelog should mention file a:
23 hg tip --template '#files#\n'
23 hg tip --template '{files}\n'
24
24
25 cd ../test1
25 cd ../test1
26 echo 123 >>a
26 echo 123 >>a
27 hg ci -m "a updated" -d "1000000 0"
27 hg ci -m "a updated" -d "1000000 0"
28
28
29 hg pull ../test2
29 hg pull ../test2
30 hg heads
30 hg heads
31 hg history
31 hg history
32
32
33 hg -v merge
33 hg -v merge
34
34
35 cd ../test3
35 cd ../test3
36 echo 123 >>b
36 echo 123 >>b
37 hg ci -m "b updated" -d "1000000 0"
37 hg ci -m "b updated" -d "1000000 0"
38
38
39 hg pull ../test2
39 hg pull ../test2
40 hg heads
40 hg heads
41 hg history
41 hg history
42
42
43 hg -v merge
43 hg -v merge
44
44
45 ls -l ../test[123]/a > foo
45 ls -l ../test[123]/a > foo
46 cut -b 1-10 < foo
46 cut -b 1-10 < foo
47
47
48 hg debugindex .hg/store/data/a.i
48 hg debugindex .hg/store/data/a.i
49 hg debugindex ../test2/.hg/store/data/a.i
49 hg debugindex ../test2/.hg/store/data/a.i
50 hg debugindex ../test1/.hg/store/data/a.i
50 hg debugindex ../test1/.hg/store/data/a.i
@@ -1,334 +1,334 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 mkdir a/d1
4 mkdir a/d1
5 mkdir a/d1/d2
5 mkdir a/d1/d2
6 echo line 1 > a/a
6 echo line 1 > a/a
7 echo line 1 > a/d1/d2/a
7 echo line 1 > a/d1/d2/a
8 hg --cwd a ci -Ama
8 hg --cwd a ci -Ama
9
9
10 echo line 2 >> a/a
10 echo line 2 >> a/a
11 hg --cwd a ci -u someone -d '1 0' -m'second change'
11 hg --cwd a ci -u someone -d '1 0' -m'second change'
12
12
13 echo % import exported patch
13 echo % import exported patch
14 hg clone -r0 a b
14 hg clone -r0 a b
15 hg --cwd a export tip > tip.patch
15 hg --cwd a export tip > tip.patch
16 hg --cwd b import ../tip.patch
16 hg --cwd b import ../tip.patch
17 echo % message should be same
17 echo % message should be same
18 hg --cwd b tip | grep 'second change'
18 hg --cwd b tip | grep 'second change'
19 echo % committer should be same
19 echo % committer should be same
20 hg --cwd b tip | grep someone
20 hg --cwd b tip | grep someone
21 rm -r b
21 rm -r b
22
22
23 echo % import exported patch with external patcher
23 echo % import exported patch with external patcher
24 cat > dummypatch.py <<EOF
24 cat > dummypatch.py <<EOF
25 print 'patching file a'
25 print 'patching file a'
26 file('a', 'wb').write('line2\n')
26 file('a', 'wb').write('line2\n')
27 EOF
27 EOF
28 chmod +x dummypatch.py
28 chmod +x dummypatch.py
29 hg clone -r0 a b
29 hg clone -r0 a b
30 hg --cwd a export tip > tip.patch
30 hg --cwd a export tip > tip.patch
31 hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
31 hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
32 cat b/a
32 cat b/a
33 rm -r b
33 rm -r b
34
34
35 echo % import of plain diff should fail without message
35 echo % import of plain diff should fail without message
36 hg clone -r0 a b
36 hg clone -r0 a b
37 hg --cwd a diff -r0:1 > tip.patch
37 hg --cwd a diff -r0:1 > tip.patch
38 hg --cwd b import ../tip.patch
38 hg --cwd b import ../tip.patch
39 rm -r b
39 rm -r b
40
40
41 echo % import of plain diff should be ok with message
41 echo % import of plain diff should be ok with message
42 hg clone -r0 a b
42 hg clone -r0 a b
43 hg --cwd a diff -r0:1 > tip.patch
43 hg --cwd a diff -r0:1 > tip.patch
44 hg --cwd b import -mpatch ../tip.patch
44 hg --cwd b import -mpatch ../tip.patch
45 rm -r b
45 rm -r b
46
46
47 echo % import of plain diff with specific date and user
47 echo % import of plain diff with specific date and user
48 hg clone -r0 a b
48 hg clone -r0 a b
49 hg --cwd a diff -r0:1 > tip.patch
49 hg --cwd a diff -r0:1 > tip.patch
50 hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
50 hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
51 hg -R b tip -pv
51 hg -R b tip -pv
52 rm -r b
52 rm -r b
53
53
54 echo % import of plain diff should be ok with --no-commit
54 echo % import of plain diff should be ok with --no-commit
55 hg clone -r0 a b
55 hg clone -r0 a b
56 hg --cwd a diff -r0:1 > tip.patch
56 hg --cwd a diff -r0:1 > tip.patch
57 hg --cwd b import --no-commit ../tip.patch
57 hg --cwd b import --no-commit ../tip.patch
58 hg --cwd b diff --nodates
58 hg --cwd b diff --nodates
59 rm -r b
59 rm -r b
60
60
61 echo % hg -R repo import
61 echo % hg -R repo import
62 # put the clone in a subdir - having a directory named "a"
62 # put the clone in a subdir - having a directory named "a"
63 # used to hide a bug.
63 # used to hide a bug.
64 mkdir dir
64 mkdir dir
65 hg clone -r0 a dir/b
65 hg clone -r0 a dir/b
66 hg --cwd a export tip > dir/tip.patch
66 hg --cwd a export tip > dir/tip.patch
67 cd dir
67 cd dir
68 hg -R b import tip.patch
68 hg -R b import tip.patch
69 cd ..
69 cd ..
70 rm -r dir
70 rm -r dir
71
71
72 echo % import from stdin
72 echo % import from stdin
73 hg clone -r0 a b
73 hg clone -r0 a b
74 hg --cwd a export tip | hg --cwd b import -
74 hg --cwd a export tip | hg --cwd b import -
75 rm -r b
75 rm -r b
76
76
77 echo % override commit message
77 echo % override commit message
78 hg clone -r0 a b
78 hg clone -r0 a b
79 hg --cwd a export tip | hg --cwd b import -m 'override' -
79 hg --cwd a export tip | hg --cwd b import -m 'override' -
80 hg --cwd b tip | grep override
80 hg --cwd b tip | grep override
81 rm -r b
81 rm -r b
82
82
83 cat > mkmsg.py <<EOF
83 cat > mkmsg.py <<EOF
84 import email.Message, sys
84 import email.Message, sys
85 msg = email.Message.Message()
85 msg = email.Message.Message()
86 msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
86 msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
87 msg['Subject'] = 'email patch'
87 msg['Subject'] = 'email patch'
88 msg['From'] = 'email patcher'
88 msg['From'] = 'email patcher'
89 sys.stdout.write(msg.as_string())
89 sys.stdout.write(msg.as_string())
90 EOF
90 EOF
91
91
92 echo % plain diff in email, subject, message body
92 echo % plain diff in email, subject, message body
93 hg clone -r0 a b
93 hg clone -r0 a b
94 hg --cwd a diff -r0:1 > tip.patch
94 hg --cwd a diff -r0:1 > tip.patch
95 python mkmsg.py > msg.patch
95 python mkmsg.py > msg.patch
96 hg --cwd b import ../msg.patch
96 hg --cwd b import ../msg.patch
97 hg --cwd b tip | grep email
97 hg --cwd b tip | grep email
98 rm -r b
98 rm -r b
99
99
100 echo % plain diff in email, no subject, message body
100 echo % plain diff in email, no subject, message body
101 hg clone -r0 a b
101 hg clone -r0 a b
102 grep -v '^Subject:' msg.patch | hg --cwd b import -
102 grep -v '^Subject:' msg.patch | hg --cwd b import -
103 rm -r b
103 rm -r b
104
104
105 echo % plain diff in email, subject, no message body
105 echo % plain diff in email, subject, no message body
106 hg clone -r0 a b
106 hg clone -r0 a b
107 grep -v '^email ' msg.patch | hg --cwd b import -
107 grep -v '^email ' msg.patch | hg --cwd b import -
108 rm -r b
108 rm -r b
109
109
110 echo % plain diff in email, no subject, no message body, should fail
110 echo % plain diff in email, no subject, no message body, should fail
111 hg clone -r0 a b
111 hg clone -r0 a b
112 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
112 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
113 rm -r b
113 rm -r b
114
114
115 echo % hg export in email, should use patch header
115 echo % hg export in email, should use patch header
116 hg clone -r0 a b
116 hg clone -r0 a b
117 hg --cwd a export tip > tip.patch
117 hg --cwd a export tip > tip.patch
118 python mkmsg.py | hg --cwd b import -
118 python mkmsg.py | hg --cwd b import -
119 hg --cwd b tip | grep second
119 hg --cwd b tip | grep second
120 rm -r b
120 rm -r b
121
121
122 # subject: duplicate detection, removal of [PATCH]
122 # subject: duplicate detection, removal of [PATCH]
123 # The '---' tests the gitsendmail handling without proper mail headers
123 # The '---' tests the gitsendmail handling without proper mail headers
124 cat > mkmsg2.py <<EOF
124 cat > mkmsg2.py <<EOF
125 import email.Message, sys
125 import email.Message, sys
126 msg = email.Message.Message()
126 msg = email.Message.Message()
127 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
127 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
128 msg['Subject'] = '[PATCH] email patch'
128 msg['Subject'] = '[PATCH] email patch'
129 msg['From'] = 'email patcher'
129 msg['From'] = 'email patcher'
130 sys.stdout.write(msg.as_string())
130 sys.stdout.write(msg.as_string())
131 EOF
131 EOF
132
132
133 echo '% plain diff in email, [PATCH] subject, message body with subject'
133 echo '% plain diff in email, [PATCH] subject, message body with subject'
134 hg clone -r0 a b
134 hg clone -r0 a b
135 hg --cwd a diff -r0:1 > tip.patch
135 hg --cwd a diff -r0:1 > tip.patch
136 python mkmsg2.py | hg --cwd b import -
136 python mkmsg2.py | hg --cwd b import -
137 hg --cwd b tip --template '{desc}\n'
137 hg --cwd b tip --template '{desc}\n'
138 rm -r b
138 rm -r b
139
139
140 # We weren't backing up the correct dirstate file when importing many patches
140 # We weren't backing up the correct dirstate file when importing many patches
141 # (issue963)
141 # (issue963)
142 echo '% import patch1 patch2; rollback'
142 echo '% import patch1 patch2; rollback'
143 echo line 3 >> a/a
143 echo line 3 >> a/a
144 hg --cwd a ci -m'third change'
144 hg --cwd a ci -m'third change'
145 hg --cwd a export -o '../patch%R' 1 2
145 hg --cwd a export -o '../patch%R' 1 2
146 hg clone -qr0 a b
146 hg clone -qr0 a b
147 hg --cwd b parents --template 'parent: #rev#\n'
147 hg --cwd b parents --template 'parent: {rev}\n'
148 hg --cwd b import ../patch1 ../patch2
148 hg --cwd b import ../patch1 ../patch2
149 hg --cwd b rollback
149 hg --cwd b rollback
150 hg --cwd b parents --template 'parent: #rev#\n'
150 hg --cwd b parents --template 'parent: {rev}\n'
151 rm -r b
151 rm -r b
152
152
153 # bug non regression test
153 # bug non regression test
154 # importing a patch in a subdirectory failed at the commit stage
154 # importing a patch in a subdirectory failed at the commit stage
155 echo line 2 >> a/d1/d2/a
155 echo line 2 >> a/d1/d2/a
156 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
156 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
157 echo % hg import in a subdirectory
157 echo % hg import in a subdirectory
158 hg clone -r0 a b
158 hg clone -r0 a b
159 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
159 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
160 dir=`pwd`
160 dir=`pwd`
161 cd b/d1/d2 2>&1 > /dev/null
161 cd b/d1/d2 2>&1 > /dev/null
162 hg import ../../../tip.patch
162 hg import ../../../tip.patch
163 cd $dir
163 cd $dir
164 echo "% message should be 'subdir change'"
164 echo "% message should be 'subdir change'"
165 hg --cwd b tip | grep 'subdir change'
165 hg --cwd b tip | grep 'subdir change'
166 echo "% committer should be 'someoneelse'"
166 echo "% committer should be 'someoneelse'"
167 hg --cwd b tip | grep someoneelse
167 hg --cwd b tip | grep someoneelse
168 echo "% should be empty"
168 echo "% should be empty"
169 hg --cwd b status
169 hg --cwd b status
170
170
171
171
172 # Test fuzziness (ambiguous patch location, fuzz=2)
172 # Test fuzziness (ambiguous patch location, fuzz=2)
173 echo % test fuzziness
173 echo % test fuzziness
174 hg init fuzzy
174 hg init fuzzy
175 cd fuzzy
175 cd fuzzy
176 echo line1 > a
176 echo line1 > a
177 echo line0 >> a
177 echo line0 >> a
178 echo line3 >> a
178 echo line3 >> a
179 hg ci -Am adda
179 hg ci -Am adda
180 echo line1 > a
180 echo line1 > a
181 echo line2 >> a
181 echo line2 >> a
182 echo line0 >> a
182 echo line0 >> a
183 echo line3 >> a
183 echo line3 >> a
184 hg ci -m change a
184 hg ci -m change a
185 hg export tip > tip.patch
185 hg export tip > tip.patch
186 hg up -C 0
186 hg up -C 0
187 echo line1 > a
187 echo line1 > a
188 echo line0 >> a
188 echo line0 >> a
189 echo line1 >> a
189 echo line1 >> a
190 echo line0 >> a
190 echo line0 >> a
191 hg ci -m brancha
191 hg ci -m brancha
192 hg import -v tip.patch
192 hg import -v tip.patch
193 cd ..
193 cd ..
194
194
195 # Test hunk touching empty files (issue906)
195 # Test hunk touching empty files (issue906)
196 hg init empty
196 hg init empty
197 cd empty
197 cd empty
198 touch a
198 touch a
199 touch b1
199 touch b1
200 touch c1
200 touch c1
201 echo d > d
201 echo d > d
202 hg ci -Am init
202 hg ci -Am init
203 echo a > a
203 echo a > a
204 echo b > b1
204 echo b > b1
205 hg mv b1 b2
205 hg mv b1 b2
206 echo c > c1
206 echo c > c1
207 hg copy c1 c2
207 hg copy c1 c2
208 rm d
208 rm d
209 touch d
209 touch d
210 hg diff --git
210 hg diff --git
211 hg ci -m empty
211 hg ci -m empty
212 hg export --git tip > empty.diff
212 hg export --git tip > empty.diff
213 hg up -C 0
213 hg up -C 0
214 hg import empty.diff
214 hg import empty.diff
215 for name in a b1 b2 c1 c2 d;
215 for name in a b1 b2 c1 c2 d;
216 do
216 do
217 echo % $name file
217 echo % $name file
218 test -f $name && cat $name
218 test -f $name && cat $name
219 done
219 done
220 cd ..
220 cd ..
221
221
222 # Test importing a patch ending with a binary file removal
222 # Test importing a patch ending with a binary file removal
223 echo % test trailing binary removal
223 echo % test trailing binary removal
224 hg init binaryremoval
224 hg init binaryremoval
225 cd binaryremoval
225 cd binaryremoval
226 echo a > a
226 echo a > a
227 python -c "file('b', 'wb').write('a\x00b')"
227 python -c "file('b', 'wb').write('a\x00b')"
228 hg ci -Am addall
228 hg ci -Am addall
229 hg rm a
229 hg rm a
230 hg rm b
230 hg rm b
231 hg st
231 hg st
232 hg ci -m remove
232 hg ci -m remove
233 hg export --git . > remove.diff
233 hg export --git . > remove.diff
234 cat remove.diff | grep git
234 cat remove.diff | grep git
235 hg up -C 0
235 hg up -C 0
236 hg import remove.diff
236 hg import remove.diff
237 hg manifest
237 hg manifest
238 cd ..
238 cd ..
239
239
240 echo % 'test update+rename with common name (issue 927)'
240 echo % 'test update+rename with common name (issue 927)'
241 hg init t
241 hg init t
242 cd t
242 cd t
243 touch a
243 touch a
244 hg ci -Am t
244 hg ci -Am t
245 echo a > a
245 echo a > a
246 # Here, bfile.startswith(afile)
246 # Here, bfile.startswith(afile)
247 hg copy a a2
247 hg copy a a2
248 hg ci -m copya
248 hg ci -m copya
249 hg export --git tip > copy.diff
249 hg export --git tip > copy.diff
250 hg up -C 0
250 hg up -C 0
251 hg import copy.diff
251 hg import copy.diff
252 echo % view a
252 echo % view a
253 # a should contain an 'a'
253 # a should contain an 'a'
254 cat a
254 cat a
255 echo % view a2
255 echo % view a2
256 # and a2 should have duplicated it
256 # and a2 should have duplicated it
257 cat a2
257 cat a2
258 cd ..
258 cd ..
259
259
260 echo % 'test -p0'
260 echo % 'test -p0'
261 hg init p0
261 hg init p0
262 cd p0
262 cd p0
263 echo a > a
263 echo a > a
264 hg ci -Am t
264 hg ci -Am t
265 hg import -p0 - << EOF
265 hg import -p0 - << EOF
266 foobar
266 foobar
267 --- a Sat Apr 12 22:43:58 2008 -0400
267 --- a Sat Apr 12 22:43:58 2008 -0400
268 +++ a Sat Apr 12 22:44:05 2008 -0400
268 +++ a Sat Apr 12 22:44:05 2008 -0400
269 @@ -1,1 +1,1 @@
269 @@ -1,1 +1,1 @@
270 -a
270 -a
271 +bb
271 +bb
272 EOF
272 EOF
273 hg status
273 hg status
274 cat a
274 cat a
275 cd ..
275 cd ..
276
276
277 echo % 'test paths outside repo root'
277 echo % 'test paths outside repo root'
278 mkdir outside
278 mkdir outside
279 touch outside/foo
279 touch outside/foo
280 hg init inside
280 hg init inside
281 cd inside
281 cd inside
282 hg import - <<EOF
282 hg import - <<EOF
283 diff --git a/a b/b
283 diff --git a/a b/b
284 rename from ../outside/foo
284 rename from ../outside/foo
285 rename to bar
285 rename to bar
286 EOF
286 EOF
287 cd ..
287 cd ..
288
288
289 echo '% test import with similarity (issue295)'
289 echo '% test import with similarity (issue295)'
290 hg init sim
290 hg init sim
291 cd sim
291 cd sim
292 echo 'this is a test' > a
292 echo 'this is a test' > a
293 hg ci -Ama
293 hg ci -Ama
294 cat > ../rename.diff <<EOF
294 cat > ../rename.diff <<EOF
295 diff --git a/a b/a
295 diff --git a/a b/a
296 deleted file mode 100644
296 deleted file mode 100644
297 --- a/a
297 --- a/a
298 +++ /dev/null
298 +++ /dev/null
299 @@ -1,1 +0,0 @@
299 @@ -1,1 +0,0 @@
300 -this is a test
300 -this is a test
301 diff --git a/b b/b
301 diff --git a/b b/b
302 new file mode 100644
302 new file mode 100644
303 --- /dev/null
303 --- /dev/null
304 +++ b/b
304 +++ b/b
305 @@ -0,0 +1,2 @@
305 @@ -0,0 +1,2 @@
306 +this is a test
306 +this is a test
307 +foo
307 +foo
308 EOF
308 EOF
309 hg import --no-commit -v -s 1 ../rename.diff
309 hg import --no-commit -v -s 1 ../rename.diff
310 hg st -C
310 hg st -C
311 hg revert -a
311 hg revert -a
312 rm b
312 rm b
313 hg import --no-commit -v -s 100 ../rename.diff
313 hg import --no-commit -v -s 100 ../rename.diff
314 hg st -C
314 hg st -C
315 cd ..
315 cd ..
316
316
317
317
318 echo '% add empty file from the end of patch (issue 1495)'
318 echo '% add empty file from the end of patch (issue 1495)'
319 hg init addemptyend
319 hg init addemptyend
320 cd addemptyend
320 cd addemptyend
321 touch a
321 touch a
322 hg addremove
322 hg addremove
323 hg ci -m "commit"
323 hg ci -m "commit"
324 cat > a.patch <<EOF
324 cat > a.patch <<EOF
325 diff --git a/a b/a
325 diff --git a/a b/a
326 --- a/a
326 --- a/a
327 +++ b/a
327 +++ b/a
328 @@ -0,0 +1,1 @@
328 @@ -0,0 +1,1 @@
329 +a
329 +a
330 diff --git a/b b/b
330 diff --git a/b b/b
331 new file mode 100644
331 new file mode 100644
332 EOF
332 EOF
333 hg import --no-commit a.patch
333 hg import --no-commit a.patch
334 cd ..
334 cd ..
@@ -1,74 +1,74 b''
1 #!/bin/sh
1 #!/bin/sh
2 # check that renames are correctly saved by a commit after a merge
2 # check that renames are correctly saved by a commit after a merge
3
3
4 # test with the merge on 3 having the rename on the local parent
4 # test with the merge on 3 having the rename on the local parent
5 hg init a
5 hg init a
6 cd a
6 cd a
7
7
8 echo line1 > foo
8 echo line1 > foo
9 hg add foo
9 hg add foo
10 hg ci -m '0: add foo'
10 hg ci -m '0: add foo'
11
11
12 echo line2 >> foo
12 echo line2 >> foo
13 hg ci -m '1: change foo'
13 hg ci -m '1: change foo'
14
14
15 hg up -C 0
15 hg up -C 0
16 hg mv foo bar
16 hg mv foo bar
17 rm bar
17 rm bar
18 echo line0 > bar
18 echo line0 > bar
19 echo line1 >> bar
19 echo line1 >> bar
20 hg ci -m '2: mv foo bar; change bar'
20 hg ci -m '2: mv foo bar; change bar'
21
21
22 hg merge 1
22 hg merge 1
23 echo '% contents of bar should be line0 line1 line2'
23 echo '% contents of bar should be line0 line1 line2'
24 cat bar
24 cat bar
25 hg ci -m '3: merge with local rename'
25 hg ci -m '3: merge with local rename'
26 hg debugindex .hg/store/data/bar.i
26 hg debugindex .hg/store/data/bar.i
27 hg debugrename bar
27 hg debugrename bar
28 hg debugindex .hg/store/data/foo.i
28 hg debugindex .hg/store/data/foo.i
29
29
30 # revert the content change from rev 2
30 # revert the content change from rev 2
31 hg up -C 2
31 hg up -C 2
32 rm bar
32 rm bar
33 echo line1 > bar
33 echo line1 > bar
34 hg ci -m '4: revert content change from rev 2'
34 hg ci -m '4: revert content change from rev 2'
35
35
36 hg log --template '#rev#:#node|short# #parents#\n'
36 hg log --template '{rev}:{node|short} {parents}\n'
37 echo '% this should use bar@rev2 as the ancestor'
37 echo '% this should use bar@rev2 as the ancestor'
38 hg --debug merge 3
38 hg --debug merge 3
39 echo '% contents of bar should be line1 line2'
39 echo '% contents of bar should be line1 line2'
40 cat bar
40 cat bar
41 hg ci -m '5: merge'
41 hg ci -m '5: merge'
42 hg debugindex .hg/store/data/bar.i
42 hg debugindex .hg/store/data/bar.i
43
43
44
44
45 # same thing, but with the merge on 3 having the rename on the remote parent
45 # same thing, but with the merge on 3 having the rename on the remote parent
46 echo
46 echo
47 echo
47 echo
48 cd ..
48 cd ..
49 hg clone -U -r 1 -r 2 a b
49 hg clone -U -r 1 -r 2 a b
50 cd b
50 cd b
51
51
52 hg up -C 1
52 hg up -C 1
53 hg merge 2
53 hg merge 2
54 echo '% contents of bar should be line0 line1 line2'
54 echo '% contents of bar should be line0 line1 line2'
55 cat bar
55 cat bar
56 hg ci -m '3: merge with remote rename'
56 hg ci -m '3: merge with remote rename'
57 hg debugindex .hg/store/data/bar.i
57 hg debugindex .hg/store/data/bar.i
58 hg debugrename bar
58 hg debugrename bar
59 hg debugindex .hg/store/data/foo.i
59 hg debugindex .hg/store/data/foo.i
60
60
61 # revert the content change from rev 2
61 # revert the content change from rev 2
62 hg up -C 2
62 hg up -C 2
63 rm bar
63 rm bar
64 echo line1 > bar
64 echo line1 > bar
65 hg ci -m '4: revert content change from rev 2'
65 hg ci -m '4: revert content change from rev 2'
66
66
67 hg log --template '#rev#:#node|short# #parents#\n'
67 hg log --template '{rev}:{node|short} {parents}\n'
68 echo '% this should use bar@rev2 as the ancestor'
68 echo '% this should use bar@rev2 as the ancestor'
69 hg --debug merge 3
69 hg --debug merge 3
70 echo '% contents of bar should be line1 line2'
70 echo '% contents of bar should be line1 line2'
71 cat bar
71 cat bar
72 hg ci -m '5: merge'
72 hg ci -m '5: merge'
73 hg debugindex .hg/store/data/bar.i
73 hg debugindex .hg/store/data/bar.i
74
74
@@ -1,78 +1,78 b''
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 'hgext.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,44 +1,44 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo '[extensions]' >> $HGRCPATH
3 echo '[extensions]' >> $HGRCPATH
4 echo 'hgext.mq =' >> $HGRCPATH
4 echo 'hgext.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 b''
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 'hgext.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
General Comments 0
You need to be logged in to leave comments. Login now