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