##// END OF EJS Templates
shelve: allow shelving of a change with an mq patch applied...
David Soria Parra -
r19856:28b1b7b9 default
parent child Browse files
Show More
@@ -347,6 +347,7 b' class queue(object):'
347 347 except error.ConfigError:
348 348 self.gitmode = ui.config('mq', 'git', 'auto').lower()
349 349 self.plainmode = ui.configbool('mq', 'plain', False)
350 self.checkapplied = True
350 351
351 352 @util.propertycache
352 353 def applied(self):
@@ -3264,7 +3265,7 b' def reposetup(ui, repo):'
3264 3265 return queue(self.ui, self.baseui, self.path)
3265 3266
3266 3267 def abortifwdirpatched(self, errmsg, force=False):
3267 if self.mq.applied and not force:
3268 if self.mq.applied and self.mq.checkapplied and not force:
3268 3269 parents = self.dirstate.parents()
3269 3270 patches = [s.node for s in self.mq.applied]
3270 3271 if parents[0] in patches or parents[1] in patches:
@@ -3280,7 +3281,7 b' def reposetup(ui, repo):'
3280 3281 editor, extra)
3281 3282
3282 3283 def checkpush(self, force, revs):
3283 if self.mq.applied and not force:
3284 if self.mq.applied and self.mq.checkapplied and not force:
3284 3285 outapplied = [e.node for e in self.mq.applied]
3285 3286 if revs:
3286 3287 # Assume applied patches have no non-patch descendants and
@@ -156,7 +156,11 b' def createcmd(ui, repo, pats, opts):'
156 156 # check modified, added, removed, deleted only
157 157 for flist in repo.status(match=match)[:4]:
158 158 shelvedfiles.extend(flist)
159 return repo.commit(message, user, opts.get('date'), match)
159 saved, repo.mq.checkapplied = repo.mq.checkapplied, False
160 try:
161 return repo.commit(message, user, opts.get('date'), match)
162 finally:
163 repo.mq.checkapplied = saved
160 164
161 165 if parent.node() != nullid:
162 166 desc = parent.description().split('\n', 1)[0]
@@ -1,7 +1,9 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 3 $ echo "shelve=" >> $HGRCPATH
3 4 $ echo "[defaults]" >> $HGRCPATH
4 5 $ echo "diff = --nodates --git" >> $HGRCPATH
6 $ echo "qnew = --date '0 0'" >> $HGRCPATH
5 7
6 8 $ hg init repo
7 9 $ cd repo
@@ -33,11 +35,12 b' shelving in an empty repo should be poss'
33 35 nothing changed
34 36 [1]
35 37
36 create another commit
38 create an mq patch - shelving should work fine with a patch applied
37 39
38 40 $ echo n > n
39 41 $ hg add n
40 42 $ hg commit n -m second
43 $ hg qnew second.patch
41 44
42 45 shelve a change that we will delete later
43 46
@@ -79,11 +82,11 b' the common case - no options or filename'
79 82 ensure that our shelved changes exist
80 83
81 84 $ hg shelve -l
82 default-01 (*) second (glob)
83 default (*) second (glob)
85 default-01 (*) [mq]: second.patch (glob)
86 default (*) [mq]: second.patch (glob)
84 87
85 88 $ hg shelve -l -p default
86 default (*) second (glob)
89 default (*) [mq]: second.patch (glob)
87 90
88 91 diff --git a/a/a b/a/a
89 92 --- a/a/a
@@ -95,6 +98,7 b' ensure that our shelved changes exist'
95 98 delete our older shelved change
96 99
97 100 $ hg shelve -d default
101 $ hg qfinish -a -q
98 102
99 103 local edits should prevent a shelved change from applying
100 104
@@ -203,11 +207,11 b' force a conflicted merge to occur'
203 207 ensure that we have a merge with unresolved conflicts
204 208
205 209 $ hg heads -q
206 3:6ea6529cfc65
207 2:ceefc37abe1e
210 4:cebf2b8de087
211 3:2e69b451d1ea
208 212 $ hg parents -q
209 2:ceefc37abe1e
210 3:6ea6529cfc65
213 3:2e69b451d1ea
214 4:cebf2b8de087
211 215 $ hg status
212 216 M a/a
213 217 M b.rename/b
@@ -268,9 +272,9 b' abort the unshelve and be happy'
268 272 $ hg unshelve -a
269 273 unshelve of 'default' aborted
270 274 $ hg heads -q
271 2:ceefc37abe1e
275 3:2e69b451d1ea
272 276 $ hg parents
273 changeset: 2:ceefc37abe1e
277 changeset: 3:2e69b451d1ea
274 278 tag: tip
275 279 user: test
276 280 date: Thu Jan 01 00:00:00 1970 +0000
@@ -314,14 +318,14 b' attempt to continue'
314 318 ensure the repo is as we hope
315 319
316 320 $ hg parents
317 changeset: 2:ceefc37abe1e
321 changeset: 3:2e69b451d1ea
318 322 tag: tip
319 323 user: test
320 324 date: Thu Jan 01 00:00:00 1970 +0000
321 325 summary: second
322 326
323 327 $ hg heads -q
324 2:ceefc37abe1e
328 3:2e69b451d1ea
325 329
326 330 $ hg status -C
327 331 M a/a
@@ -386,7 +390,7 b' if we resolve a conflict while unshelvin'
386 390 merging a/a
387 391 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
388 392 $ hg parents -q
389 4:be7e79683c99
393 5:01ba9745dc5a
390 394 $ hg shelve -l
391 395 $ hg status
392 396 M a/a
General Comments 0
You need to be logged in to leave comments. Login now