##// END OF EJS Templates
Added tests for qpush/qpop with index.
Thomas Arendsen Hein -
r3081:760414dc default
parent child Browse files
Show More
@@ -1,175 +1,188 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
119 hg qnew test1b.patch
120 echo 1b > 1b
121 hg add 1b
122 hg qrefresh
123 hg qpush 2
124 hg qpop 0
125 hg qpush test.patch+1
126 hg qpush test.patch+2
127 hg qpop test2.patch-1
128 hg qpop test2.patch-2
129 hg qpush test1b.patch+1
130
118 echo % push should succeed
131 echo % push should succeed
119 hg qpop -a
132 hg qpop -a
120 hg push ../../k
133 hg push ../../k
121
134
122 echo % strip
135 echo % strip
123 cd ../../b
136 cd ../../b
124 echo x>x
137 echo x>x
125 hg ci -Ama
138 hg ci -Ama
126 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
139 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
127 hg unbundle .hg/strip-backup/*
140 hg unbundle .hg/strip-backup/*
128
141
129 echo '% cd b; hg qrefresh'
142 echo '% cd b; hg qrefresh'
130 hg init refresh
143 hg init refresh
131 cd refresh
144 cd refresh
132 echo a > a
145 echo a > a
133 hg ci -Ama -d'0 0'
146 hg ci -Ama -d'0 0'
134 hg qnew -mfoo foo
147 hg qnew -mfoo foo
135 echo a >> a
148 echo a >> a
136 hg qrefresh
149 hg qrefresh
137 mkdir b
150 mkdir b
138 cd b
151 cd b
139 echo f > f
152 echo f > f
140 hg add f
153 hg add f
141 hg qrefresh
154 hg qrefresh
142 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
155 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
143 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
156 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
144 echo % hg qrefresh .
157 echo % hg qrefresh .
145 hg qrefresh .
158 hg qrefresh .
146 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
159 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
147 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
160 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
148 hg status
161 hg status
149
162
150 cat >>$HGRCPATH <<EOF
163 cat >>$HGRCPATH <<EOF
151 [diff]
164 [diff]
152 git = True
165 git = True
153 EOF
166 EOF
154 cd ..
167 cd ..
155 hg init git
168 hg init git
156 cd git
169 cd git
157 hg qinit
170 hg qinit
158
171
159 hg qnew -m'new file' new
172 hg qnew -m'new file' new
160 echo foo > new
173 echo foo > new
161 chmod +x new
174 chmod +x new
162 hg add new
175 hg add new
163 hg qrefresh
176 hg qrefresh
164 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
177 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
165 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
178 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
166
179
167 hg qnew -m'copy file' copy
180 hg qnew -m'copy file' copy
168 hg cp new copy
181 hg cp new copy
169 hg qrefresh
182 hg qrefresh
170 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
183 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
171 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
184 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
172
185
173 hg qpop
186 hg qpop
174 hg qpush
187 hg qpush
175 hg qdiff
188 hg qdiff
@@ -1,172 +1,185 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
114 applying test2.patch
115 Now at: test2.patch
116 Now at: test.patch
117 applying test1b.patch
118 Now at: test1b.patch
119 applying test2.patch
120 Now at: test2.patch
121 Now at: test1b.patch
122 Now at: test.patch
123 applying test1b.patch
124 applying test2.patch
125 Now at: test2.patch
113 % push should succeed
126 % push should succeed
114 Patch queue now empty
127 Patch queue now empty
115 pushing to ../../k
128 pushing to ../../k
116 searching for changes
129 searching for changes
117 adding changesets
130 adding changesets
118 adding manifests
131 adding manifests
119 adding file changes
132 adding file changes
120 added 1 changesets with 1 changes to 1 files
133 added 1 changesets with 1 changes to 1 files
121 % strip
134 % strip
122 adding x
135 adding x
123 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
124 saving bundle to
137 saving bundle to
125 adding changesets
138 adding changesets
126 adding manifests
139 adding manifests
127 adding file changes
140 adding file changes
128 added 1 changesets with 1 changes to 1 files
141 added 1 changesets with 1 changes to 1 files
129 (run 'hg update' to get a working copy)
142 (run 'hg update' to get a working copy)
130 % cd b; hg qrefresh
143 % cd b; hg qrefresh
131 adding a
144 adding a
132 foo
145 foo
133
146
134 diff -r cb9a9f314b8b a
147 diff -r cb9a9f314b8b a
135 --- a/a
148 --- a/a
136 +++ b/a
149 +++ b/a
137 @@ -1,1 +1,2 @@ a
150 @@ -1,1 +1,2 @@ a
138 a
151 a
139 +a
152 +a
140 diff -r cb9a9f314b8b b/f
153 diff -r cb9a9f314b8b b/f
141 --- /dev/null
154 --- /dev/null
142 +++ b/b/f
155 +++ b/b/f
143 @@ -0,0 +1,1 @@
156 @@ -0,0 +1,1 @@
144 +f
157 +f
145 % hg qrefresh .
158 % hg qrefresh .
146 foo
159 foo
147
160
148 diff -r cb9a9f314b8b b/f
161 diff -r cb9a9f314b8b b/f
149 --- /dev/null
162 --- /dev/null
150 +++ b/b/f
163 +++ b/b/f
151 @@ -0,0 +1,1 @@
164 @@ -0,0 +1,1 @@
152 +f
165 +f
153 M a
166 M a
154 new file
167 new file
155
168
156 diff --git a/new b/new
169 diff --git a/new b/new
157 new file mode 100755
170 new file mode 100755
158 --- /dev/null
171 --- /dev/null
159 +++ b/new
172 +++ b/new
160 @@ -0,0 +1,1 @@
173 @@ -0,0 +1,1 @@
161 +foo
174 +foo
162 copy file
175 copy file
163
176
164 diff --git a/new b/copy
177 diff --git a/new b/copy
165 copy from new
178 copy from new
166 copy to copy
179 copy to copy
167 Now at: new
180 Now at: new
168 applying copy
181 applying copy
169 Now at: copy
182 Now at: copy
170 diff --git a/new b/copy
183 diff --git a/new b/copy
171 copy from new
184 copy from new
172 copy to copy
185 copy to copy
General Comments 0
You need to be logged in to leave comments. Login now