##// END OF EJS Templates
mq: restore _branchtags() fast path (issue3223)...
Patrick Mezard -
r16101:20ad8f05 stable
parent child Browse files
Show More
@@ -267,11 +267,15 b' def secretcommit(repo, phase, *args, **k'
267 267 phase = phases.secret
268 268 if phase is not None:
269 269 backup = repo.ui.backupconfig('phases', 'new-commit')
270 # Marking the repository as committing an mq patch can be used
271 # to optimize operations like _branchtags().
272 repo._committingpatch = True
270 273 try:
271 274 if phase is not None:
272 275 repo.ui.setconfig('phases', 'new-commit', phase)
273 276 return repo.commit(*args, **kwargs)
274 277 finally:
278 repo._committingpatch = False
275 279 if phase is not None:
276 280 repo.ui.restoreconfig(backup)
277 281
@@ -3254,16 +3258,20 b' def reposetup(ui, repo):'
3254 3258
3255 3259 def _branchtags(self, partial, lrev):
3256 3260 q = self.mq
3261 cl = self.changelog
3262 qbase = None
3257 3263 if not q.applied:
3258 return super(mqrepo, self)._branchtags(partial, lrev)
3259
3260 cl = self.changelog
3261 qbasenode = q.applied[0].node
3262 try:
3263 qbase = cl.rev(qbasenode)
3264 except error.LookupError:
3265 self.ui.warn(_('mq status file refers to unknown node %s\n')
3266 % short(qbasenode))
3264 if getattr(self, '_committingpatch', False):
3265 # Committing a new patch, must be tip
3266 qbase = len(cl) - 1
3267 else:
3268 qbasenode = q.applied[0].node
3269 try:
3270 qbase = cl.rev(qbasenode)
3271 except error.LookupError:
3272 self.ui.warn(_('mq status file refers to unknown node %s\n')
3273 % short(qbasenode))
3274 if qbase is None:
3267 3275 return super(mqrepo, self)._branchtags(partial, lrev)
3268 3276
3269 3277 start = lrev + 1
@@ -556,7 +556,6 b' Copy and show added kwfiles'
556 556 Commit and show expansion in original and copy
557 557
558 558 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
559 invalidating branch cache (tip differs)
560 559 c
561 560 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
562 561 overwriting c expanding keywords
@@ -29,16 +29,14 b' mq patch on an empty repo'
29 29 $ hg qnew -d '0 0' p1
30 30 $ show_branch_cache
31 31 tip: 0
32 d986d5caac23a7d44a46efc0ddaf5eb9665844cf 0
33 d986d5caac23a7d44a46efc0ddaf5eb9665844cf default
32 No branch cache
34 33
35 34 $ echo > pfile
36 35 $ hg add pfile
37 36 $ hg qrefresh -m 'patch 1'
38 37 $ show_branch_cache
39 38 tip: 0
40 a7977e38ed2c2942fa6c278030badfef3d180979 0
41 a7977e38ed2c2942fa6c278030badfef3d180979 default
39 No branch cache
42 40
43 41 some regular revisions
44 42
@@ -67,8 +65,8 b' add some mq patches'
67 65 now at: p1
68 66 $ show_branch_cache
69 67 tip: 2
70 982611f6955f9c48d3365decea203217c945ef0d 2
71 982611f6955f9c48d3365decea203217c945ef0d bar
68 c229711f16da3d7591f89b1b8d963b79bda22714 1
69 c229711f16da3d7591f89b1b8d963b79bda22714 bar
72 70 dc25e3827021582e979f600811852e36cbe57341 foo
73 71
74 72 $ hg qnew -d '0 0' p2
@@ -77,8 +75,8 b' add some mq patches'
77 75 $ hg qrefresh -m 'patch 2'
78 76 $ show_branch_cache 1
79 77 tip: 3
80 982611f6955f9c48d3365decea203217c945ef0d 2
81 982611f6955f9c48d3365decea203217c945ef0d bar
78 c229711f16da3d7591f89b1b8d963b79bda22714 1
79 c229711f16da3d7591f89b1b8d963b79bda22714 bar
82 80 dc25e3827021582e979f600811852e36cbe57341 foo
83 81 branch foo: 3
84 82 branch bar: 2
@@ -121,6 +119,6 b' detect an invalid cache'
121 119 now at: p2
122 120 $ show_branch_cache
123 121 tip: 3
124 3fe2e3b237359b5c55cec6ed172ac41d3850fade 1
125 3fe2e3b237359b5c55cec6ed172ac41d3850fade foo
122 dc25e3827021582e979f600811852e36cbe57341 0
123 dc25e3827021582e979f600811852e36cbe57341 foo
126 124
General Comments 0
You need to be logged in to leave comments. Login now