##// 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 if opts.get('git'):
1077 if opts.get('git'):
1078 self.diffopts().git = True
1078 self.diffopts().git = True
1079 matchfn = cmdutil.match(repo, pats, opts)
1080 tip = repo.changelog.tip()
1079 tip = repo.changelog.tip()
1081 if top == tip:
1080 if top == tip:
1082 # if the top of our patch queue is also the tip, there is an
1081 # if the top of our patch queue is also the tip, there is an
@@ -1086,7 +1085,7 b' class queue:'
1086 # changed to speed up the diff
1085 # changed to speed up the diff
1087 #
1086 #
1088 # in short mode, we only diff the files included in the
1087 # in short mode, we only diff the files included in the
1089 # patch already
1088 # patch already plus specified files
1090 #
1089 #
1091 # this should really read:
1090 # this should really read:
1092 # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
1091 # mm, dd, aa, aa2 = repo.status(tip, patchparent)[:4]
@@ -1097,10 +1096,13 b' class queue:'
1097 changes = repo.changelog.read(tip)
1096 changes = repo.changelog.read(tip)
1098 man = repo.manifest.read(changes[0])
1097 man = repo.manifest.read(changes[0])
1099 aaa = aa[:]
1098 aaa = aa[:]
1099 matchfn = cmdutil.match(repo, pats, opts)
1100 if opts.get('short'):
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 match = cmdutil.matchfiles(repo, mm + aa + dd + matchfn.files())
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 else:
1106 else:
1105 match = cmdutil.matchall(repo)
1107 match = cmdutil.matchall(repo)
1106 m, a, r, d = repo.status(match=match)[:4]
1108 m, a, r, d = repo.status(match=match)[:4]
@@ -83,28 +83,44 b' cat .hg/patches/mqbase | \\'
83 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
83 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
84 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
84 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
85
85
86 echo % qrefresh --short
86 echo
87 echo % qrefresh --short tests:
87 echo 'orphan' > orphanchild
88 echo 'orphan' > orphanchild
88 hg add orphanchild
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 hg qrefresh --short 1/base
93 hg qrefresh --short 1/base
91 hg qrefresh --short 2/base
94 hg qrefresh --short 2/base
92
95
93 echo % qdiff
96 echo % -- qdiff output
94 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
97 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
95 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
98 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
96
99
97 echo % patch file contents
100 echo % -- patch file content
98 cat .hg/patches/mqbase | \
101 cat .hg/patches/mqbase | \
99 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
102 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
100 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
103 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
104 hg st
101
105
102 echo % diff shows orphan ...
106 echo % -- diff shows what is not in patch
103 hg st
104 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
107 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
105 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
108 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
106 -e "s/^\(diff\).*/\1/"
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 cd ..
124 cd ..
109
125
110
126
@@ -159,8 +159,10 b' diff -r b55ecdccb5cf 2/base'
159 @@ -1,1 +1,1 @@
159 @@ -1,1 +1,1 @@
160 -base
160 -base
161 +patched
161 +patched
162 % qrefresh --short
162
163 % qdiff
163 % qrefresh --short tests:
164 % - add 1/base and 2/base one by one
165 % -- qdiff output
164 diff -r b55ecdccb5cf 1/base
166 diff -r b55ecdccb5cf 1/base
165 --- a/1/base
167 --- a/1/base
166 +++ b/1/base
168 +++ b/1/base
@@ -178,7 +180,7 b' diff -r b55ecdccb5cf orphanchild'
178 +++ b/orphanchild
180 +++ b/orphanchild
179 @@ -0,0 +1,1 @@
181 @@ -0,0 +1,1 @@
180 +orphan
182 +orphan
181 % patch file contents
183 % -- patch file content
182 mqbase
184 mqbase
183
185
184 diff -r b55ecdccb5cf 1/base
186 diff -r b55ecdccb5cf 1/base
@@ -193,14 +195,28 b' diff -r b55ecdccb5cf 2/base'
193 @@ -1,1 +1,1 @@
195 @@ -1,1 +1,1 @@
194 -base
196 -base
195 +patched
197 +patched
196 % diff shows orphan ...
197 A orphanchild
198 A orphanchild
198 ? base
199 ? base
200 % -- diff shows what is not in patch
199 diff
201 diff
200 --- /dev/null
202 --- /dev/null
201 +++ b/orphanchild
203 +++ b/orphanchild
202 @@ -0,0 +1,1 @@
204 @@ -0,0 +1,1 @@
203 +orphan
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 % create test repo
220 % create test repo
205 adding a
221 adding a
206 % capture changes
222 % capture changes
General Comments 0
You need to be logged in to leave comments. Login now