Show More
@@ -96,7 +96,7 class changelog(revlog.revlog): | |||||
96 | fp = self.opener(self.indexfile, 'a') |
|
96 | fp = self.opener(self.indexfile, 'a') | |
97 | fp.write("".join(self._delaybuf)) |
|
97 | fp.write("".join(self._delaybuf)) | |
98 | fp.close() |
|
98 | fp.close() | |
99 |
|
|
99 | self._delaybuf = [] | |
100 | # split when we're done |
|
100 | # split when we're done | |
101 | self.checkinlinesize(tr) |
|
101 | self.checkinlinesize(tr) | |
102 |
|
102 | |||
@@ -115,6 +115,31 class changelog(revlog.revlog): | |||||
115 | # otherwise, divert to memory |
|
115 | # otherwise, divert to memory | |
116 | return appender(fp, self._delaybuf) |
|
116 | return appender(fp, self._delaybuf) | |
117 |
|
117 | |||
|
118 | def readpending(self, file): | |||
|
119 | r = revlog.revlog(self.opener, file) | |||
|
120 | self.index = r.index | |||
|
121 | self.nodemap = r.nodemap | |||
|
122 | self._chunkcache = r._chunkcache | |||
|
123 | ||||
|
124 | def writepending(self): | |||
|
125 | "create a file containing the unfinalized state for pretxnchangegroup" | |||
|
126 | if self._delaybuf: | |||
|
127 | # make a temporary copy of the index | |||
|
128 | fp1 = self._realopener(self.indexfile) | |||
|
129 | fp2 = self._realopener(self.indexfile + ".a", "w") | |||
|
130 | fp2.write(fp1.read()) | |||
|
131 | # add pending data | |||
|
132 | fp2.write("".join(self._delaybuf)) | |||
|
133 | fp2.close() | |||
|
134 | # switch modes so finalize can simply rename | |||
|
135 | self._delaybuf = [] | |||
|
136 | self._delayname = fp1.name | |||
|
137 | ||||
|
138 | if self._delayname: | |||
|
139 | return True | |||
|
140 | ||||
|
141 | return False | |||
|
142 | ||||
118 | def checkinlinesize(self, tr, fp=None): |
|
143 | def checkinlinesize(self, tr, fp=None): | |
119 | if self.opener == self._delayopener: |
|
144 | if self.opener == self._delayopener: | |
120 | return |
|
145 | return |
@@ -70,7 +70,13 def _pythonhook(ui, repo, name, hname, f | |||||
70 |
|
70 | |||
71 | def _exthook(ui, repo, name, cmd, args, throw): |
|
71 | def _exthook(ui, repo, name, cmd, args, throw): | |
72 | ui.note(_("running hook %s: %s\n") % (name, cmd)) |
|
72 | ui.note(_("running hook %s: %s\n") % (name, cmd)) | |
73 | env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()]) |
|
73 | ||
|
74 | env = {} | |||
|
75 | for k, v in args.iteritems(): | |||
|
76 | if callable(v): | |||
|
77 | v = v() | |||
|
78 | env['HG_' + k.upper()] = v | |||
|
79 | ||||
74 | if repo: |
|
80 | if repo: | |
75 | cwd = repo.root |
|
81 | cwd = repo.root | |
76 | else: |
|
82 | else: |
@@ -88,6 +88,10 class localrepository(repo.repository): | |||||
88 | def __getattr__(self, name): |
|
88 | def __getattr__(self, name): | |
89 | if name == 'changelog': |
|
89 | if name == 'changelog': | |
90 | self.changelog = changelog.changelog(self.sopener) |
|
90 | self.changelog = changelog.changelog(self.sopener) | |
|
91 | if 'HG_PENDING' in os.environ: | |||
|
92 | p = os.environ['HG_PENDING'] | |||
|
93 | if p.startswith(self.root): | |||
|
94 | self.changelog.readpending('00changelog.i.a') | |||
91 | self.sopener.defversion = self.changelog.version |
|
95 | self.sopener.defversion = self.changelog.version | |
92 | return self.changelog |
|
96 | return self.changelog | |
93 | if name == 'manifest': |
|
97 | if name == 'manifest': | |
@@ -955,10 +959,13 class localrepository(repo.repository): | |||||
955 | raise util.Abort(_("empty commit message")) |
|
959 | raise util.Abort(_("empty commit message")) | |
956 | text = '\n'.join(lines) |
|
960 | text = '\n'.join(lines) | |
957 |
|
961 | |||
|
962 | self.changelog.delayupdate() | |||
958 | n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, |
|
963 | n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, | |
959 | user, wctx.date(), extra) |
|
964 | user, wctx.date(), extra) | |
|
965 | p = lambda: self.changelog.writepending() and self.root or "" | |||
960 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |
|
966 | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | |
961 | parent2=xp2) |
|
967 | parent2=xp2, pending=p) | |
|
968 | self.changelog.finalize(trp) | |||
962 | tr.close() |
|
969 | tr.close() | |
963 |
|
970 | |||
964 | if self.branchcache: |
|
971 | if self.branchcache: | |
@@ -2034,9 +2041,6 class localrepository(repo.repository): | |||||
2034 | revisions += len(fl) - o |
|
2041 | revisions += len(fl) - o | |
2035 | files += 1 |
|
2042 | files += 1 | |
2036 |
|
2043 | |||
2037 | # make changelog see real files again |
|
|||
2038 | cl.finalize(trp) |
|
|||
2039 |
|
||||
2040 | newheads = len(self.changelog.heads()) |
|
2044 | newheads = len(self.changelog.heads()) | |
2041 | heads = "" |
|
2045 | heads = "" | |
2042 | if oldheads and newheads != oldheads: |
|
2046 | if oldheads and newheads != oldheads: | |
@@ -2047,9 +2051,13 class localrepository(repo.repository): | |||||
2047 | % (changesets, revisions, files, heads)) |
|
2051 | % (changesets, revisions, files, heads)) | |
2048 |
|
2052 | |||
2049 | if changesets > 0: |
|
2053 | if changesets > 0: | |
|
2054 | p = lambda: self.changelog.writepending() and self.root or "" | |||
2050 | self.hook('pretxnchangegroup', throw=True, |
|
2055 | self.hook('pretxnchangegroup', throw=True, | |
2051 | node=hex(self.changelog.node(cor+1)), source=srctype, |
|
2056 | node=hex(self.changelog.node(cor+1)), source=srctype, | |
2052 | url=url) |
|
2057 | url=url, pending=p) | |
|
2058 | ||||
|
2059 | # make changelog see real files again | |||
|
2060 | cl.finalize(trp) | |||
2053 |
|
2061 | |||
2054 | tr.close() |
|
2062 | tr.close() | |
2055 | finally: |
|
2063 | finally: |
@@ -46,6 +46,9 if url.startswith("file:"): | |||||
46 | elif url.startswith("remote:http"): |
|
46 | elif url.startswith("remote:http"): | |
47 | os.environ["HG_URL"] = "remote:http" |
|
47 | os.environ["HG_URL"] = "remote:http" | |
48 |
|
48 | |||
|
49 | if "HG_PENDING" in os.environ: | |||
|
50 | os.environ["HG_PENDING"] = os.environ["HG_PENDING"] and "true" | |||
|
51 | ||||
49 | out.write("%s hook: " % name) |
|
52 | out.write("%s hook: " % name) | |
50 | for v in env: |
|
53 | for v in env: | |
51 | out.write("%s=%s " % (v, os.environ[v])) |
|
54 | out.write("%s=%s " % (v, os.environ[v])) |
@@ -1,18 +1,18 | |||||
1 | precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 |
|
1 | precommit hook: HG_PARENT1=0000000000000000000000000000000000000000 | |
2 | pretxncommit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 |
|
2 | pretxncommit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=true | |
3 | 0:29b62aeb769f |
|
3 | 0:29b62aeb769f | |
4 | commit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 |
|
4 | commit hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 | |
5 | commit.b hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 |
|
5 | commit.b hook: HG_NODE=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PARENT1=0000000000000000000000000000000000000000 | |
6 | updating working directory |
|
6 | updating working directory | |
7 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
7 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
8 | precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
8 | precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
9 | pretxncommit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
9 | pretxncommit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=true | |
10 | 1:b702efe96888 |
|
10 | 1:b702efe96888 | |
11 | commit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
11 | commit hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
12 | commit.b hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
12 | commit.b hook: HG_NODE=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
14 | precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
14 | precommit hook: HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
15 | pretxncommit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
15 | pretxncommit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b HG_PENDING=true | |
16 | 2:1324a5531bac |
|
16 | 2:1324a5531bac | |
17 | commit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
17 | commit hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
18 | commit.b hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b |
|
18 | commit.b hook: HG_NODE=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT1=29b62aeb769fdf78d8d9c5f28b017f76d7ef824b | |
@@ -20,7 +20,7 created new head | |||||
20 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
20 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
21 | (branch merge, don't forget to commit) |
|
21 | (branch merge, don't forget to commit) | |
22 | precommit hook: HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 |
|
22 | precommit hook: HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 | |
23 | pretxncommit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 |
|
23 | pretxncommit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 HG_PENDING=true | |
24 | 3:4c52fb2e4022 |
|
24 | 3:4c52fb2e4022 | |
25 | commit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 |
|
25 | commit hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 | |
26 | commit.b hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 |
|
26 | commit.b hook: HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_PARENT1=1324a5531bac09b329c3845d35ae6a7526874edb HG_PARENT2=b702efe9688826e3a91283852b328b84dbf37bc2 | |
@@ -43,7 +43,7 added 3 changesets with 2 changes to 2 f | |||||
43 | (run 'hg update' to get a working copy) |
|
43 | (run 'hg update' to get a working copy) | |
44 | pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a |
|
44 | pretag hook: HG_LOCAL=0 HG_NODE=4c52fb2e402287dd5dc052090682536c8406c321 HG_TAG=a | |
45 | precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 |
|
45 | precommit hook: HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 | |
46 | pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 |
|
46 | pretxncommit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 HG_PENDING=true | |
47 | 4:8ea2ef7ad3e8 |
|
47 | 4:8ea2ef7ad3e8 | |
48 | commit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 |
|
48 | commit hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 | |
49 | commit.b hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 |
|
49 | commit.b hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PARENT1=4c52fb2e402287dd5dc052090682536c8406c321 | |
@@ -58,9 +58,9 pretag.forbid hook: HG_LOCAL=1 HG_NODE=8 | |||||
58 | abort: pretag.forbid hook exited with status 1 |
|
58 | abort: pretag.forbid hook exited with status 1 | |
59 | 4:8ea2ef7ad3e8 |
|
59 | 4:8ea2ef7ad3e8 | |
60 | precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 |
|
60 | precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 | |
61 | pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 |
|
61 | pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=true | |
62 | 5:fad284daf8c0 |
|
62 | 5:fad284daf8c0 | |
63 | pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 |
|
63 | pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=true | |
64 | transaction abort! |
|
64 | transaction abort! | |
65 | rollback completed |
|
65 | rollback completed | |
66 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
66 | abort: pretxncommit.forbid1 hook exited with status 1 | |
@@ -80,7 +80,7 pulling from ../a | |||||
80 | searching for changes |
|
80 | searching for changes | |
81 | abort: prechangegroup.forbid hook exited with status 1 |
|
81 | abort: prechangegroup.forbid hook exited with status 1 | |
82 | 4:8ea2ef7ad3e8 |
|
82 | 4:8ea2ef7ad3e8 | |
83 | pretxnchangegroup.forbid hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull HG_URL=file: |
|
83 | pretxnchangegroup.forbid hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_PENDING=true HG_SOURCE=pull HG_URL=file: | |
84 | pulling from ../a |
|
84 | pulling from ../a | |
85 | searching for changes |
|
85 | searching for changes | |
86 | adding changesets |
|
86 | adding changesets |
General Comments 0
You need to be logged in to leave comments.
Login now