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