##// END OF EJS Templates
mq: Fix --qrefresh --short to work with --exclude and --include...
Mads Kiilerich -
r7177:09ed32b7 default
parent child Browse files
Show More
@@ -1076,7 +1076,6 b' class queue:'
1076 1076
1077 1077 if opts.get('git'):
1078 1078 self.diffopts().git = True
1079 matchfn = cmdutil.match(repo, pats, opts)
1080 1079 tip = repo.changelog.tip()
1081 1080 if top == tip:
1082 1081 # if the top of our patch queue is also the tip, there is an
@@ -1086,7 +1085,7 b' class queue:'
1086 1085 # changed to speed up the diff
1087 1086 #
1088 1087 # in short mode, we only diff the files included in the
1089 # patch already
1088 # patch already plus specified files
1090 1089 #
1091 1090 # this should really read:
1092 1091 # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
@@ -1097,10 +1096,13 b' class queue:'
1097 1096 changes = repo.changelog.read(tip)
1098 1097 man = repo.manifest.read(changes[0])
1099 1098 aaa = aa[:]
1099 matchfn = cmdutil.match(repo, pats, opts)
1100 1100 if opts.get('short'):
1101 # if amending a patch, we always match already-in-patch files
1101 # if amending a patch, we start with existing
1102 # files plus specified files - unfiltered
1102 1103 match = cmdutil.matchfiles(repo, mm + aa + dd + matchfn.files())
1103 matchfn = match # FIXME: Why have two matchers if we only need one?
1104 # filter with inc/exl options
1105 matchfn = cmdutil.match(repo, opts=opts)
1104 1106 else:
1105 1107 match = cmdutil.matchall(repo)
1106 1108 m, a, r, d = repo.status(match=match)[:4]
@@ -83,28 +83,44 b' cat .hg/patches/mqbase | \\'
83 83 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
84 84 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
85 85
86 echo % qrefresh --short
86 echo
87 echo % qrefresh --short tests:
87 88 echo 'orphan' > orphanchild
88 89 hg add orphanchild
89 hg qrefresh nonexistingfilename
90
91 echo % - add 1/base and 2/base one by one
92 hg qrefresh nonexistingfilename # clear patch
90 93 hg qrefresh --short 1/base
91 94 hg qrefresh --short 2/base
92 95
93 echo % qdiff
96 echo % -- qdiff output
94 97 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
95 98 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
96 99
97 echo % patch file contents
100 echo % -- patch file content
98 101 cat .hg/patches/mqbase | \
99 102 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
100 103 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
104 hg st
101 105
102 echo % diff shows orphan ...
103 hg st
106 echo % -- diff shows what is not in patch
104 107 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
105 108 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
106 109 -e "s/^\(diff\).*/\1/"
107
110 echo % - before starting exclusive tests
111 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
112 echo % - exclude 2/base
113 hg qref -s -X 2/base
114 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
115 echo % -- status shows 2/base as dirty
116 hg st
117 echo % - remove 1/base and add 2/base again but not orphanchild
118 hg qref -s -X orphanchild -X 1/base 2/base orphanchild
119 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
120 echo % - add 1/base with include filter - and thus remove 2/base from patch
121 hg qref -s -I 1/ o* */*
122 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
123 echo
108 124 cd ..
109 125
110 126
@@ -159,8 +159,10 b' diff -r b55ecdccb5cf 2/base'
159 159 @@ -1,1 +1,1 @@
160 160 -base
161 161 +patched
162 % qrefresh --short
163 % qdiff
162
163 % qrefresh --short tests:
164 % - add 1/base and 2/base one by one
165 % -- qdiff output
164 166 diff -r b55ecdccb5cf 1/base
165 167 --- a/1/base
166 168 +++ b/1/base
@@ -178,7 +180,7 b' diff -r b55ecdccb5cf orphanchild'
178 180 +++ b/orphanchild
179 181 @@ -0,0 +1,1 @@
180 182 +orphan
181 % patch file contents
183 % -- patch file content
182 184 mqbase
183 185
184 186 diff -r b55ecdccb5cf 1/base
@@ -193,14 +195,28 b' diff -r b55ecdccb5cf 2/base'
193 195 @@ -1,1 +1,1 @@
194 196 -base
195 197 +patched
196 % diff shows orphan ...
197 198 A orphanchild
198 199 ? base
200 % -- diff shows what is not in patch
199 201 diff
200 202 --- /dev/null
201 203 +++ b/orphanchild
202 204 @@ -0,0 +1,1 @@
203 205 +orphan
206 % - before starting exclusive tests
207 1/base
208 2/base
209 % - exclude 2/base
210 1/base
211 % -- status shows 2/base as dirty
212 M 2/base
213 A orphanchild
214 ? base
215 % - remove 1/base and add 2/base again but not orphanchild
216 2/base
217 % - add 1/base with include filter - and thus remove 2/base from patch
218 1/base
219
204 220 % create test repo
205 221 adding a
206 222 % capture changes
General Comments 0
You need to be logged in to leave comments. Login now