##// END OF EJS Templates
merge with stable
Matt Mackall -
r16102:50682c07 merge default
parent child Browse files
Show More
@@ -54,7 +54,7 b' testpats = ['
54 (r'head -c', "don't use 'head -c', use 'dd'"),
54 (r'head -c', "don't use 'head -c', use 'dd'"),
55 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
55 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
56 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
56 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
57 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
57 (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"),
58 (r'printf.*\\x', "don't use printf \\x, use Python"),
58 (r'printf.*\\x', "don't use printf \\x, use Python"),
59 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
59 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
60 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
60 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
@@ -85,7 +85,7 b" def fetch(ui, repo, source='default', **"
85 newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
85 newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
86 if len(newheads) == 1 and len(newchildren):
86 if len(newheads) == 1 and len(newchildren):
87 if newchildren[0] != parent:
87 if newchildren[0] != parent:
88 return hg.clean(repo, newchildren[0])
88 return hg.update(repo, newchildren[0])
89 else:
89 else:
90 return 0
90 return 0
91
91
@@ -257,22 +257,28 b' class patchheader(object):'
257 ci += 1
257 ci += 1
258 del self.comments[ci]
258 del self.comments[ci]
259
259
260 def newcommit(repo, *args, **kwargs):
260 def newcommit(repo, phase, *args, **kwargs):
261 """helper dedicated to ensure a commit respect mq.secret setting
261 """helper dedicated to ensure a commit respect mq.secret setting
262
262
263 It should be used instead of repo.commit inside the mq source for operation
263 It should be used instead of repo.commit inside the mq source for operation
264 creating new changeset.
264 creating new changeset.
265 """
265 """
266 if not repo.ui.configbool('mq', 'secret', False):
266 if phase is None:
267 return repo.commit(*args, **kwargs)
267 if repo.ui.configbool('mq', 'secret', False):
268
268 phase = phases.secret
269 backup = repo.ui.backupconfig('phases', 'new-commit')
269 if phase is not None:
270 backup = repo.ui.backupconfig('phases', 'new-commit')
271 # Marking the repository as committing an mq patch can be used
272 # to optimize operations like _branchtags().
273 repo._committingpatch = True
270 try:
274 try:
271 # ensure we create a secret changeset
275 if phase is not None:
272 repo.ui.setconfig('phases', 'new-commit', phases.secret)
276 repo.ui.setconfig('phases', 'new-commit', phase)
273 return repo.commit(*args, **kwargs)
277 return repo.commit(*args, **kwargs)
274 finally:
278 finally:
275 repo.ui.restoreconfig(backup)
279 repo._committingpatch = False
280 if phase is not None:
281 repo.ui.restoreconfig(backup)
276
282
277 class queue(object):
283 class queue(object):
278 def __init__(self, ui, path, patchdir=None):
284 def __init__(self, ui, path, patchdir=None):
@@ -576,7 +582,7 b' class queue(object):'
576 ret = hg.merge(repo, rev)
582 ret = hg.merge(repo, rev)
577 if ret:
583 if ret:
578 raise util.Abort(_("update returned %d") % ret)
584 raise util.Abort(_("update returned %d") % ret)
579 n = newcommit(repo, ctx.description(), ctx.user(), force=True)
585 n = newcommit(repo, None, ctx.description(), ctx.user(), force=True)
580 if n is None:
586 if n is None:
581 raise util.Abort(_("repo commit failed"))
587 raise util.Abort(_("repo commit failed"))
582 try:
588 try:
@@ -616,7 +622,7 b' class queue(object):'
616 # the first patch in the queue is never a merge patch
622 # the first patch in the queue is never a merge patch
617 #
623 #
618 pname = ".hg.patches.merge.marker"
624 pname = ".hg.patches.merge.marker"
619 n = repo.commit('[mq]: merge marker', force=True)
625 n = newcommit(repo, None, '[mq]: merge marker', force=True)
620 self.removeundo(repo)
626 self.removeundo(repo)
621 self.applied.append(statusentry(n, pname))
627 self.applied.append(statusentry(n, pname))
622 self.applieddirty = True
628 self.applieddirty = True
@@ -747,8 +753,8 b' class queue(object):'
747
753
748 match = scmutil.matchfiles(repo, files or [])
754 match = scmutil.matchfiles(repo, files or [])
749 oldtip = repo['tip']
755 oldtip = repo['tip']
750 n = newcommit(repo, message, ph.user, ph.date, match=match,
756 n = newcommit(repo, None, message, ph.user, ph.date, match=match,
751 force=True)
757 force=True)
752 if repo['tip'] == oldtip:
758 if repo['tip'] == oldtip:
753 raise util.Abort(_("qpush exactly duplicates child changeset"))
759 raise util.Abort(_("qpush exactly duplicates child changeset"))
754 if n is None:
760 if n is None:
@@ -988,8 +994,8 b' class queue(object):'
988 if util.safehasattr(msg, '__call__'):
994 if util.safehasattr(msg, '__call__'):
989 msg = msg()
995 msg = msg()
990 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
996 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
991 n = newcommit(repo, commitmsg, user, date, match=match,
997 n = newcommit(repo, None, commitmsg, user, date, match=match,
992 force=True)
998 force=True)
993 if n is None:
999 if n is None:
994 raise util.Abort(_("repo commit failed"))
1000 raise util.Abort(_("repo commit failed"))
995 try:
1001 try:
@@ -1540,15 +1546,11 b' class queue(object):'
1540
1546
1541 try:
1547 try:
1542 # might be nice to attempt to roll back strip after this
1548 # might be nice to attempt to roll back strip after this
1543 backup = repo.ui.backupconfig('phases', 'new-commit')
1549
1544 try:
1550 # Ensure we create a new changeset in the same phase than
1545 # Ensure we create a new changeset in the same phase than
1551 # the old one.
1546 # the old one.
1552 n = newcommit(repo, oldphase, message, user, ph.date,
1547 repo.ui.setconfig('phases', 'new-commit', oldphase)
1553 match=match, force=True)
1548 n = repo.commit(message, user, ph.date, match=match,
1549 force=True)
1550 finally:
1551 repo.ui.restoreconfig(backup)
1552 # only write patch after a successful commit
1554 # only write patch after a successful commit
1553 patchf.close()
1555 patchf.close()
1554 self.applied.append(statusentry(n, patchfn))
1556 self.applied.append(statusentry(n, patchfn))
@@ -3257,16 +3259,20 b' def reposetup(ui, repo):'
3257
3259
3258 def _branchtags(self, partial, lrev):
3260 def _branchtags(self, partial, lrev):
3259 q = self.mq
3261 q = self.mq
3262 cl = self.changelog
3263 qbase = None
3260 if not q.applied:
3264 if not q.applied:
3261 return super(mqrepo, self)._branchtags(partial, lrev)
3265 if getattr(self, '_committingpatch', False):
3262
3266 # Committing a new patch, must be tip
3263 cl = self.changelog
3267 qbase = len(cl) - 1
3264 qbasenode = q.applied[0].node
3268 else:
3265 try:
3269 qbasenode = q.applied[0].node
3266 qbase = cl.rev(qbasenode)
3270 try:
3267 except error.LookupError:
3271 qbase = cl.rev(qbasenode)
3268 self.ui.warn(_('mq status file refers to unknown node %s\n')
3272 except error.LookupError:
3269 % short(qbasenode))
3273 self.ui.warn(_('mq status file refers to unknown node %s\n')
3274 % short(qbasenode))
3275 if qbase is None:
3270 return super(mqrepo, self)._branchtags(partial, lrev)
3276 return super(mqrepo, self)._branchtags(partial, lrev)
3271
3277
3272 start = lrev + 1
3278 start = lrev + 1
@@ -35,7 +35,7 b' Narrow diffstat:'
35
35
36 $ hg ci -m appenda
36 $ hg ci -m appenda
37
37
38 $ printf '\0' > c
38 >>> open("c", "wb").write("\0")
39 $ touch d
39 $ touch d
40 $ hg add c d
40 $ hg add c d
41
41
@@ -54,7 +54,7 b' Binary git diffstat:'
54
54
55 $ hg ci -m createb
55 $ hg ci -m createb
56
56
57 $ printf '\0' > "file with spaces"
57 >>> open("file with spaces", "wb").write("\0")
58 $ hg add "file with spaces"
58 $ hg add "file with spaces"
59
59
60 Filename with spaces diffstat:
60 Filename with spaces diffstat:
@@ -169,10 +169,10 b' hg cat files and symlink, no expansion'
169
169
170 hg status of kw-ignored binary file starting with '\1\n'
170 hg status of kw-ignored binary file starting with '\1\n'
171
171
172 $ printf '\1\nfoo' > i
172 >>> open("i", "wb").write("\1\nfoo")
173 $ hg -q commit -Am metasep i
173 $ hg -q commit -Am metasep i
174 $ hg status
174 $ hg status
175 $ printf '\1\nbar' > i
175 >>> open("i", "wb").write("\1\nbar")
176 $ hg status
176 $ hg status
177 M i
177 M i
178 $ hg -q commit -m "modify metasep" i
178 $ hg -q commit -m "modify metasep" i
@@ -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
@@ -279,12 +279,12 b" hg status of binary file starting with '"
279
279
280 $ hg init repo5
280 $ hg init repo5
281 $ cd repo5
281 $ cd repo5
282 $ printf '\1\nfoo' > 010a
282 >>> open("010a", "wb").write("\1\nfoo")
283 $ hg ci -q -A -m 'initial checkin'
283 $ hg ci -q -A -m 'initial checkin'
284 $ hg status -A
284 $ hg status -A
285 C 010a
285 C 010a
286
286
287 $ printf '\1\nbar' > 010a
287 >>> open("010a", "wb").write("\1\nbar")
288 $ hg status -A
288 $ hg status -A
289 M 010a
289 M 010a
290 $ hg ci -q -m 'modify 010a'
290 $ hg ci -q -m 'modify 010a'
@@ -17,7 +17,7 b' hg debugsub with no remapping'
17 hg debugsub with remapping
17 hg debugsub with remapping
18
18
19 $ echo '[subpaths]' >> .hg/hgrc
19 $ echo '[subpaths]' >> .hg/hgrc
20 $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc
20 $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc # no-check-code
21
21
22 $ hg debugsub
22 $ hg debugsub
23 path sub
23 path sub
General Comments 0
You need to be logged in to leave comments. Login now