Show More
@@ -341,6 +341,10 b' class revbranchcache(object):' | |||
|
341 | 341 | changelog = self._repo.changelog |
|
342 | 342 | rbcrevidx = rev * _rbcrecsize |
|
343 | 343 | |
|
344 | # avoid negative index, changelog.read(nullrev) is fast without cache | |
|
345 | if rev == nullrev: | |
|
346 | return changelog.branchinfo(rev) | |
|
347 | ||
|
344 | 348 | # if requested rev is missing, add and populate all missing revs |
|
345 | 349 | if len(self._rbcrevs) < rbcrevidx + _rbcrecsize: |
|
346 | 350 | self._rbcrevs.extend('\0' * (len(changelog) * _rbcrecsize - |
@@ -16,7 +16,7 b' import match as matchmod' | |||
|
16 | 16 | import merge as mergemod |
|
17 | 17 | import tags as tagsmod |
|
18 | 18 | from lock import release |
|
19 | import weakref, errno, os, time, inspect | |
|
19 | import weakref, errno, os, time, inspect, random | |
|
20 | 20 | import branchmap, pathutil |
|
21 | 21 | import namespaces |
|
22 | 22 | propertycache = util.propertycache |
@@ -959,7 +959,9 b' class localrepository(object):' | |||
|
959 | 959 | _("abandoned transaction found"), |
|
960 | 960 | hint=_("run 'hg recover' to clean up transaction")) |
|
961 | 961 | |
|
962 | self.hook('pretxnopen', throw=True, txnname=desc) | |
|
962 | idbase = "%.40f#%f" % (random.random(), time.time()) | |
|
963 | txnid = 'TXN:' + util.sha1(idbase).hexdigest() | |
|
964 | self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) | |
|
963 | 965 | |
|
964 | 966 | self._writejournal(desc) |
|
965 | 967 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
@@ -983,8 +985,7 b' class localrepository(object):' | |||
|
983 | 985 | self.store.createmode, |
|
984 | 986 | validator=validate) |
|
985 | 987 | |
|
986 | trid = 'TXN:' + util.sha1("%s#%f" % (id(tr), time.time())).hexdigest() | |
|
987 | tr.hookargs['txnid'] = trid | |
|
988 | tr.hookargs['txnid'] = txnid | |
|
988 | 989 | # note: writing the fncache only during finalize mean that the file is |
|
989 | 990 | # outdated when running hooks. As fncache is used for streaming clone, |
|
990 | 991 | # this is not expected to break anything that happen during the hooks. |
@@ -329,7 +329,8 b' def _getrevsource(repo, r):' | |||
|
329 | 329 | |
|
330 | 330 | def stringset(repo, subset, x): |
|
331 | 331 | x = repo[x].rev() |
|
332 |
if x in subset |
|
|
332 | if (x in subset | |
|
333 | or x == node.nullrev and isinstance(subset, fullreposet)): | |
|
333 | 334 | return baseset([x]) |
|
334 | 335 | return baseset() |
|
335 | 336 | |
@@ -1911,7 +1912,7 b' def user(repo, subset, x):' | |||
|
1911 | 1912 | def wdir(repo, subset, x): |
|
1912 | 1913 | # i18n: "wdir" is a keyword |
|
1913 | 1914 | getargs(x, 0, 0, _("wdir takes no arguments")) |
|
1914 | if None in subset: | |
|
1915 | if None in subset or isinstance(subset, fullreposet): | |
|
1915 | 1916 | return baseset([None]) |
|
1916 | 1917 | return baseset() |
|
1917 | 1918 | |
@@ -3470,11 +3471,6 b' class fullreposet(spanset):' | |||
|
3470 | 3471 | def __init__(self, repo): |
|
3471 | 3472 | super(fullreposet, self).__init__(repo) |
|
3472 | 3473 | |
|
3473 | def __contains__(self, rev): | |
|
3474 | # assumes the given rev is valid | |
|
3475 | hidden = self._hiddenrevs | |
|
3476 | return not (hidden and rev in hidden) | |
|
3477 | ||
|
3478 | 3474 | def __and__(self, other): |
|
3479 | 3475 | """As self contains the whole repo, all of the other set should also be |
|
3480 | 3476 | in self. Therefore `self & other = other`. |
@@ -2375,4 +2375,12 b' should not draw line down to null due to' | |||
|
2375 | 2375 | summary: add a |
|
2376 | 2376 | |
|
2377 | 2377 | |
|
2378 | $ hg log -G -r 'branch(default)' | tail -6 | |
|
2379 | | | |
|
2380 | o changeset: 0:f8035bb17114 | |
|
2381 | user: test | |
|
2382 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
2383 | summary: add a | |
|
2384 | ||
|
2385 | ||
|
2378 | 2386 | $ cd .. |
@@ -29,7 +29,7 b' commit hooks can see env vars' | |||
|
29 | 29 | $ hg add a |
|
30 | 30 | $ hg commit -m a |
|
31 | 31 | precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 |
|
32 | pretxnopen hook: HG_TXNNAME=commit | |
|
32 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
33 | 33 | pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
34 | 34 | 0:cb9a9f314b8b |
|
35 | 35 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
@@ -57,7 +57,7 b' pretxncommit and commit hooks can see bo' | |||
|
57 | 57 | $ echo b >> a |
|
58 | 58 | $ hg commit -m a1 -d "1 0" |
|
59 | 59 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
60 | pretxnopen hook: HG_TXNNAME=commit | |
|
60 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
61 | 61 | pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
62 | 62 | 1:ab228980c14d |
|
63 | 63 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
@@ -70,7 +70,7 b' pretxncommit and commit hooks can see bo' | |||
|
70 | 70 | $ hg add b |
|
71 | 71 | $ hg commit -m b -d '1 0' |
|
72 | 72 | precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
73 | pretxnopen hook: HG_TXNNAME=commit | |
|
73 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
74 | 74 | pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
75 | 75 | 2:ee9deb46ab31 |
|
76 | 76 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
@@ -83,7 +83,7 b' pretxncommit and commit hooks can see bo' | |||
|
83 | 83 | (branch merge, don't forget to commit) |
|
84 | 84 | $ hg commit -m merge -d '2 0' |
|
85 | 85 | precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
86 | pretxnopen hook: HG_TXNNAME=commit | |
|
86 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
87 | 87 | pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
88 | 88 | 3:07f3376c1e65 |
|
89 | 89 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
@@ -127,7 +127,7 b' tag hooks can see env vars' | |||
|
127 | 127 | $ hg tag -d '3 0' a |
|
128 | 128 | pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
129 | 129 | precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
130 | pretxnopen hook: HG_TXNNAME=commit | |
|
130 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
131 | 131 | pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
132 | 132 | 4:539e4b31b6dc |
|
133 | 133 | pretxnclose hook: HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=commit (glob) |
@@ -164,7 +164,7 b' more there after' | |||
|
164 | 164 | 4:539e4b31b6dc |
|
165 | 165 | $ hg commit -m 'fail' -d '4 0' |
|
166 | 166 | precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
167 | pretxnopen hook: HG_TXNNAME=commit | |
|
167 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=commit (glob) | |
|
168 | 168 | pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
169 | 169 | 5:6f611f8018c1 |
|
170 | 170 | 5:6f611f8018c1 |
@@ -228,7 +228,7 b' pushkey hook' | |||
|
228 | 228 | pushing to ../a |
|
229 | 229 | searching for changes |
|
230 | 230 | no changes found |
|
231 | pretxnopen hook: HG_TXNNAME=bookmarks | |
|
231 | pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=bookmarks (glob) | |
|
232 | 232 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_TXNID=TXN:* HG_TXNNAME=bookmarks (glob) |
|
233 | 233 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=bookmarks (glob) |
|
234 | 234 | pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 |
@@ -697,10 +697,10 b' Test null revision' | |||
|
697 | 697 | $ log 'reverse(null:)' | tail -2 |
|
698 | 698 | 0 |
|
699 | 699 | -1 |
|
700 | BROKEN: should be '-1' | |
|
700 | 701 | $ log 'first(null:)' |
|
701 | -1 | |
|
702 | BROKEN: should be '-1' | |
|
702 | 703 | $ log 'min(null:)' |
|
703 | -1 | |
|
704 | 704 | $ log 'tip:null and all()' | tail -2 |
|
705 | 705 | 1 |
|
706 | 706 | 0 |
@@ -708,9 +708,9 b' Test null revision' | |||
|
708 | 708 | Test working-directory revision |
|
709 | 709 | $ hg debugrevspec 'wdir()' |
|
710 | 710 | None |
|
711 | BROKEN: should include 'None' | |
|
711 | 712 | $ hg debugrevspec 'tip or wdir()' |
|
712 | 713 | 9 |
|
713 | None | |
|
714 | 714 | $ hg debugrevspec '0:tip and wdir()' |
|
715 | 715 | |
|
716 | 716 | $ log 'outgoing()' |
@@ -1702,6 +1702,46 b' tests for concatenation of strings/symbo' | |||
|
1702 | 1702 | |
|
1703 | 1703 | $ cd .. |
|
1704 | 1704 | |
|
1705 | prepare repository that has "default" branches of multiple roots | |
|
1706 | ||
|
1707 | $ hg init namedbranch | |
|
1708 | $ cd namedbranch | |
|
1709 | ||
|
1710 | $ echo default0 >> a | |
|
1711 | $ hg ci -Aqm0 | |
|
1712 | $ echo default1 >> a | |
|
1713 | $ hg ci -m1 | |
|
1714 | ||
|
1715 | $ hg branch -q stable | |
|
1716 | $ echo stable2 >> a | |
|
1717 | $ hg ci -m2 | |
|
1718 | $ echo stable3 >> a | |
|
1719 | $ hg ci -m3 | |
|
1720 | ||
|
1721 | $ hg update -q null | |
|
1722 | $ echo default4 >> a | |
|
1723 | $ hg ci -Aqm4 | |
|
1724 | $ echo default5 >> a | |
|
1725 | $ hg ci -m5 | |
|
1726 | ||
|
1727 | "null" revision belongs to "default" branch (issue4683) | |
|
1728 | ||
|
1729 | $ log 'branch(null)' | |
|
1730 | 0 | |
|
1731 | 1 | |
|
1732 | 4 | |
|
1733 | 5 | |
|
1734 | ||
|
1735 | "null" revision belongs to "default" branch, but it shouldn't appear in set | |
|
1736 | unless explicitly specified (issue4682) | |
|
1737 | ||
|
1738 | $ log 'children(branch(default))' | |
|
1739 | 1 | |
|
1740 | 2 | |
|
1741 | 5 | |
|
1742 | ||
|
1743 | $ cd .. | |
|
1744 | ||
|
1705 | 1745 | test author/desc/keyword in problematic encoding |
|
1706 | 1746 |
|
|
1707 | 1747 | # u30A2 0x83 0x41(= 'A') |
General Comments 0
You need to be logged in to leave comments.
Login now