##// END OF EJS Templates
mq: test case for issue399
Brendan Cully -
r3464:ba3a9675 default
parent child Browse files
Show More
@@ -1,199 +1,201 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
5
5
6 echo % help
6 echo % help
7 hg help mq
7 hg help mq
8
8
9 hg init a
9 hg init a
10 cd a
10 cd a
11 echo a > a
11 echo a > a
12 hg ci -Ama
12 hg ci -Ama
13
13
14 hg clone . ../k
14 hg clone . ../k
15
15
16 mkdir b
16 mkdir b
17 echo z > b/z
17 echo z > b/z
18 hg ci -Ama
18 hg ci -Ama
19
19
20 echo % qinit
20 echo % qinit
21
21
22 hg qinit
22 hg qinit
23
23
24 cd ..
24 cd ..
25 hg init b
25 hg init b
26
26
27 echo % -R qinit
27 echo % -R qinit
28
28
29 hg -R b qinit
29 hg -R b qinit
30
30
31 hg init c
31 hg init c
32
32
33 echo % qinit -c
33 echo % qinit -c
34
34
35 hg --cwd c qinit -c
35 hg --cwd c qinit -c
36 hg -R c/.hg/patches st
36 hg -R c/.hg/patches st
37
37
38 echo % qnew implies add
38 echo % qnew implies add
39
39
40 hg -R c qnew test.patch
40 hg -R c qnew test.patch
41 hg -R c/.hg/patches st
41 hg -R c/.hg/patches st
42
42
43 cd a
43 cd a
44
44
45 echo % qnew -m
45 echo % qnew -m
46
46
47 hg qnew -m 'foo bar' test.patch
47 hg qnew -m 'foo bar' test.patch
48 cat .hg/patches/test.patch
48 cat .hg/patches/test.patch
49
49
50 echo % qrefresh
50 echo % qrefresh
51
51
52 echo a >> a
52 echo a >> a
53 hg qrefresh
53 hg qrefresh
54 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
54 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
55 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
55 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
56 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
56 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
57
57
58 echo % qpop
58 echo % qpop
59
59
60 hg qpop
60 hg qpop
61
61
62 echo % qpush
62 echo % qpush
63
63
64 hg qpush
64 hg qpush
65
65
66 cd ..
66 cd ..
67
67
68 echo % pop/push outside repo
68 echo % pop/push outside repo
69
69
70 hg -R a qpop
70 hg -R a qpop
71 hg -R a qpush
71 hg -R a qpush
72
72
73 cd a
73 cd a
74 hg qnew test2.patch
74 hg qnew test2.patch
75
75
76 echo % qrefresh in subdir
76 echo % qrefresh in subdir
77
77
78 cd b
78 cd b
79 echo a > a
79 echo a > a
80 hg add a
80 hg add a
81 hg qrefresh
81 hg qrefresh
82
82
83 echo % pop/push -a in subdir
83 echo % pop/push -a in subdir
84
84
85 hg qpop -a
85 hg qpop -a
86 hg --traceback qpush -a
86 hg --traceback qpush -a
87
87
88 echo % qseries
88 echo % qseries
89 hg qseries
89 hg qseries
90
90
91 echo % qapplied
91 echo % qapplied
92 hg qapplied
92 hg qapplied
93
93
94 echo % qtop
94 echo % qtop
95 hg qtop
95 hg qtop
96
96
97 echo % qprev
97 echo % qprev
98 hg qprev
98 hg qprev
99
99
100 echo % qnext
100 echo % qnext
101 hg qnext
101 hg qnext
102
102
103 echo % pop, qnext, qprev, qapplied
103 echo % pop, qnext, qprev, qapplied
104 hg qpop
104 hg qpop
105 hg qnext
105 hg qnext
106 hg qprev
106 hg qprev
107 hg qapplied
107 hg qapplied
108
108
109 echo % commit should fail
109 echo % commit should fail
110 hg commit
110 hg commit
111
111
112 echo % push should fail
112 echo % push should fail
113 hg push ../../k
113 hg push ../../k
114
114
115 echo % qunapplied
115 echo % qunapplied
116 hg qunapplied
116 hg qunapplied
117
117
118 echo % qpush/qpop with index
118 echo % qpush/qpop with index
119 hg qnew test1b.patch
119 hg qnew test1b.patch
120 echo 1b > 1b
120 echo 1b > 1b
121 hg add 1b
121 hg add 1b
122 hg qrefresh
122 hg qrefresh
123 hg qpush 2
123 hg qpush 2
124 hg qpop 0
124 hg qpop 0
125 hg qpush test.patch+1
125 hg qpush test.patch+1
126 hg qpush test.patch+2
126 hg qpush test.patch+2
127 hg qpop test2.patch-1
127 hg qpop test2.patch-1
128 hg qpop test2.patch-2
128 hg qpop test2.patch-2
129 hg qpush test1b.patch+1
129 hg qpush test1b.patch+1
130
130
131 echo % push should succeed
131 echo % push should succeed
132 hg qpop -a
132 hg qpop -a
133 hg push ../../k
133 hg push ../../k
134
134
135 echo % strip
135 echo % strip
136 cd ../../b
136 cd ../../b
137 echo x>x
137 echo x>x
138 hg ci -Ama
138 hg ci -Ama
139 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
139 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
140 hg unbundle .hg/strip-backup/*
140 hg unbundle .hg/strip-backup/*
141
141
142 echo '% cd b; hg qrefresh'
142 echo '% cd b; hg qrefresh'
143 hg init refresh
143 hg init refresh
144 cd refresh
144 cd refresh
145 echo a > a
145 echo a > a
146 hg ci -Ama -d'0 0'
146 hg ci -Ama -d'0 0'
147 hg qnew -mfoo foo
147 hg qnew -mfoo foo
148 echo a >> a
148 echo a >> a
149 hg qrefresh
149 hg qrefresh
150 mkdir b
150 mkdir b
151 cd b
151 cd b
152 echo f > f
152 echo f > f
153 hg add f
153 hg add f
154 hg qrefresh
154 hg qrefresh
155 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
155 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
156 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
156 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
157 echo % hg qrefresh .
157 echo % hg qrefresh .
158 hg qrefresh .
158 hg qrefresh .
159 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
159 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
160 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
160 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
161 hg status
161 hg status
162
162
163 echo % qpush failure
163 echo % qpush failure
164 cd ..
164 cd ..
165 hg qrefresh
165 hg qrefresh
166 hg qnew -mbar bar
166 hg qnew -mbar bar
167 echo foo > foo
167 echo foo > foo
168 hg add foo
168 echo bar > bar
169 hg add foo bar
169 hg qrefresh
170 hg qrefresh
170 hg qpop -a
171 hg qpop -a
171 echo bar > foo
172 echo bar > foo
172 hg qpush -a
173 hg qpush -a
174 hg st
173
175
174 cat >>$HGRCPATH <<EOF
176 cat >>$HGRCPATH <<EOF
175 [diff]
177 [diff]
176 git = True
178 git = True
177 EOF
179 EOF
178 cd ..
180 cd ..
179 hg init git
181 hg init git
180 cd git
182 cd git
181 hg qinit
183 hg qinit
182
184
183 hg qnew -m'new file' new
185 hg qnew -m'new file' new
184 echo foo > new
186 echo foo > new
185 chmod +x new
187 chmod +x new
186 hg add new
188 hg add new
187 hg qrefresh
189 hg qrefresh
188 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
190 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
189 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
191 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
190
192
191 hg qnew -m'copy file' copy
193 hg qnew -m'copy file' copy
192 hg cp new copy
194 hg cp new copy
193 hg qrefresh
195 hg qrefresh
194 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
196 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
195 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
197 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
196
198
197 hg qpop
199 hg qpop
198 hg qpush
200 hg qpush
199 hg qdiff
201 hg qdiff
@@ -1,193 +1,195 b''
1 % help
1 % help
2 mq extension - patch management and development
2 mq extension - patch management and development
3
3
4 This extension lets you work with a stack of patches in a Mercurial
4 This extension lets you work with a stack of patches in a Mercurial
5 repository. It manages two stacks of patches - all known patches, and
5 repository. It manages two stacks of patches - all known patches, and
6 applied patches (subset of known patches).
6 applied patches (subset of known patches).
7
7
8 Known patches are represented as patch files in the .hg/patches
8 Known patches are represented as patch files in the .hg/patches
9 directory. Applied patches are both patch files and changesets.
9 directory. Applied patches are both patch files and changesets.
10
10
11 Common tasks (use "hg help command" for more details):
11 Common tasks (use "hg help command" for more details):
12
12
13 prepare repository to work with patches qinit
13 prepare repository to work with patches qinit
14 create new patch qnew
14 create new patch qnew
15 import existing patch qimport
15 import existing patch qimport
16
16
17 print patch series qseries
17 print patch series qseries
18 print applied patches qapplied
18 print applied patches qapplied
19 print name of top applied patch qtop
19 print name of top applied patch qtop
20
20
21 add known patch to applied stack qpush
21 add known patch to applied stack qpush
22 remove patch from applied stack qpop
22 remove patch from applied stack qpop
23 refresh contents of top applied patch qrefresh
23 refresh contents of top applied patch qrefresh
24
24
25 list of commands (use "hg help -v mq" to show aliases and global options):
25 list of commands (use "hg help -v mq" to show aliases and global options):
26
26
27 qapplied print the patches already applied
27 qapplied print the patches already applied
28 qclone clone main and patch repository at same time
28 qclone clone main and patch repository at same time
29 qcommit commit changes in the queue repository
29 qcommit commit changes in the queue repository
30 qdelete remove patches from queue
30 qdelete remove patches from queue
31 qdiff diff of the current patch
31 qdiff diff of the current patch
32 qfold fold the named patches into the current patch
32 qfold fold the named patches into the current patch
33 qguard set or print guards for a patch
33 qguard set or print guards for a patch
34 qheader Print the header of the topmost or specified patch
34 qheader Print the header of the topmost or specified patch
35 qimport import a patch
35 qimport import a patch
36 qinit init a new queue repository
36 qinit init a new queue repository
37 qnew create a new patch
37 qnew create a new patch
38 qnext print the name of the next patch
38 qnext print the name of the next patch
39 qpop pop the current patch off the stack
39 qpop pop the current patch off the stack
40 qprev print the name of the previous patch
40 qprev print the name of the previous patch
41 qpush push the next patch onto the stack
41 qpush push the next patch onto the stack
42 qrefresh update the current patch
42 qrefresh update the current patch
43 qrename rename a patch
43 qrename rename a patch
44 qrestore restore the queue state saved by a rev
44 qrestore restore the queue state saved by a rev
45 qsave save current queue state
45 qsave save current queue state
46 qselect set or print guarded patches to push
46 qselect set or print guarded patches to push
47 qseries print the entire series file
47 qseries print the entire series file
48 qtop print the name of the current patch
48 qtop print the name of the current patch
49 qunapplied print the patches not yet applied
49 qunapplied print the patches not yet applied
50 strip strip a revision and all later revs on the same branch
50 strip strip a revision and all later revs on the same branch
51 adding a
51 adding a
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 adding b/z
53 adding b/z
54 % qinit
54 % qinit
55 % -R qinit
55 % -R qinit
56 % qinit -c
56 % qinit -c
57 A .hgignore
57 A .hgignore
58 A series
58 A series
59 % qnew implies add
59 % qnew implies add
60 A .hgignore
60 A .hgignore
61 A series
61 A series
62 A test.patch
62 A test.patch
63 % qnew -m
63 % qnew -m
64 foo bar
64 foo bar
65 % qrefresh
65 % qrefresh
66 foo bar
66 foo bar
67
67
68 diff -r xa
68 diff -r xa
69 --- a/a
69 --- a/a
70 +++ b/a
70 +++ b/a
71 @@ -1,1 +1,2 @@ a
71 @@ -1,1 +1,2 @@ a
72 a
72 a
73 +a
73 +a
74 % qpop
74 % qpop
75 Patch queue now empty
75 Patch queue now empty
76 % qpush
76 % qpush
77 applying test.patch
77 applying test.patch
78 Now at: test.patch
78 Now at: test.patch
79 % pop/push outside repo
79 % pop/push outside repo
80 Patch queue now empty
80 Patch queue now empty
81 applying test.patch
81 applying test.patch
82 Now at: test.patch
82 Now at: test.patch
83 % qrefresh in subdir
83 % qrefresh in subdir
84 % pop/push -a in subdir
84 % pop/push -a in subdir
85 Patch queue now empty
85 Patch queue now empty
86 applying test.patch
86 applying test.patch
87 applying test2.patch
87 applying test2.patch
88 Now at: test2.patch
88 Now at: test2.patch
89 % qseries
89 % qseries
90 test.patch
90 test.patch
91 test2.patch
91 test2.patch
92 % qapplied
92 % qapplied
93 test.patch
93 test.patch
94 test2.patch
94 test2.patch
95 % qtop
95 % qtop
96 test2.patch
96 test2.patch
97 % qprev
97 % qprev
98 test.patch
98 test.patch
99 % qnext
99 % qnext
100 All patches applied
100 All patches applied
101 % pop, qnext, qprev, qapplied
101 % pop, qnext, qprev, qapplied
102 Now at: test.patch
102 Now at: test.patch
103 test2.patch
103 test2.patch
104 Only one patch applied
104 Only one patch applied
105 test.patch
105 test.patch
106 % commit should fail
106 % commit should fail
107 abort: cannot commit over an applied mq patch
107 abort: cannot commit over an applied mq patch
108 % push should fail
108 % push should fail
109 pushing to ../../k
109 pushing to ../../k
110 abort: source has mq patches applied
110 abort: source has mq patches applied
111 % qunapplied
111 % qunapplied
112 test2.patch
112 test2.patch
113 % qpush/qpop with index
113 % qpush/qpop with index
114 applying test2.patch
114 applying test2.patch
115 Now at: test2.patch
115 Now at: test2.patch
116 Now at: test.patch
116 Now at: test.patch
117 applying test1b.patch
117 applying test1b.patch
118 Now at: test1b.patch
118 Now at: test1b.patch
119 applying test2.patch
119 applying test2.patch
120 Now at: test2.patch
120 Now at: test2.patch
121 Now at: test1b.patch
121 Now at: test1b.patch
122 Now at: test.patch
122 Now at: test.patch
123 applying test1b.patch
123 applying test1b.patch
124 applying test2.patch
124 applying test2.patch
125 Now at: test2.patch
125 Now at: test2.patch
126 % push should succeed
126 % push should succeed
127 Patch queue now empty
127 Patch queue now empty
128 pushing to ../../k
128 pushing to ../../k
129 searching for changes
129 searching for changes
130 adding changesets
130 adding changesets
131 adding manifests
131 adding manifests
132 adding file changes
132 adding file changes
133 added 1 changesets with 1 changes to 1 files
133 added 1 changesets with 1 changes to 1 files
134 % strip
134 % strip
135 adding x
135 adding x
136 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
136 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
137 saving bundle to
137 saving bundle to
138 adding changesets
138 adding changesets
139 adding manifests
139 adding manifests
140 adding file changes
140 adding file changes
141 added 1 changesets with 1 changes to 1 files
141 added 1 changesets with 1 changes to 1 files
142 (run 'hg update' to get a working copy)
142 (run 'hg update' to get a working copy)
143 % cd b; hg qrefresh
143 % cd b; hg qrefresh
144 adding a
144 adding a
145 foo
145 foo
146
146
147 diff -r cb9a9f314b8b a
147 diff -r cb9a9f314b8b a
148 --- a/a
148 --- a/a
149 +++ b/a
149 +++ b/a
150 @@ -1,1 +1,2 @@ a
150 @@ -1,1 +1,2 @@ a
151 a
151 a
152 +a
152 +a
153 diff -r cb9a9f314b8b b/f
153 diff -r cb9a9f314b8b b/f
154 --- /dev/null
154 --- /dev/null
155 +++ b/b/f
155 +++ b/b/f
156 @@ -0,0 +1,1 @@
156 @@ -0,0 +1,1 @@
157 +f
157 +f
158 % hg qrefresh .
158 % hg qrefresh .
159 foo
159 foo
160
160
161 diff -r cb9a9f314b8b b/f
161 diff -r cb9a9f314b8b b/f
162 --- /dev/null
162 --- /dev/null
163 +++ b/b/f
163 +++ b/b/f
164 @@ -0,0 +1,1 @@
164 @@ -0,0 +1,1 @@
165 +f
165 +f
166 M a
166 M a
167 % qpush failure
167 % qpush failure
168 Patch queue now empty
168 Patch queue now empty
169 applying foo
169 applying foo
170 applying bar
170 applying bar
171 1 out of 1 hunk ignored -- saving rejects to file foo.rej
171 1 out of 1 hunk ignored -- saving rejects to file foo.rej
172 patch failed, unable to continue (try -v)
172 patch failed, unable to continue (try -v)
173 patch failed, rejects left in working dir
173 patch failed, rejects left in working dir
174 Errors during apply, please fix and refresh bar
174 Errors during apply, please fix and refresh bar
175 ? foo
176 ? foo.rej
175 new file
177 new file
176
178
177 diff --git a/new b/new
179 diff --git a/new b/new
178 new file mode 100755
180 new file mode 100755
179 --- /dev/null
181 --- /dev/null
180 +++ b/new
182 +++ b/new
181 @@ -0,0 +1,1 @@
183 @@ -0,0 +1,1 @@
182 +foo
184 +foo
183 copy file
185 copy file
184
186
185 diff --git a/new b/copy
187 diff --git a/new b/copy
186 copy from new
188 copy from new
187 copy to copy
189 copy to copy
188 Now at: new
190 Now at: new
189 applying copy
191 applying copy
190 Now at: copy
192 Now at: copy
191 diff --git a/new b/copy
193 diff --git a/new b/copy
192 copy from new
194 copy from new
193 copy to copy
195 copy to copy
General Comments 0
You need to be logged in to leave comments. Login now