##// END OF EJS Templates
Use a weakref for recursive transactions
Matt Mackall -
r4916:5c5d23d9 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 from node import *
8 from node import *
9 from i18n import _
9 from i18n import _
10 import repo, changegroup
10 import repo, changegroup
11 import changelog, dirstate, filelog, manifest, context
11 import changelog, dirstate, filelog, manifest, context, weakref
12 import re, lock, transaction, tempfile, stat, mdiff, errno, ui
12 import re, lock, transaction, tempfile, stat, mdiff, errno, ui
13 import os, revlog, time, util, extensions, hook
13 import os, revlog, time, util, extensions, hook
14
14
@@ -16,8 +16,6 b' class localrepository(repo.repository):'
16 capabilities = ('lookup', 'changegroupsubset')
16 capabilities = ('lookup', 'changegroupsubset')
17 supported = ('revlogv1', 'store')
17 supported = ('revlogv1', 'store')
18
18
19 def __del__(self):
20 self.transhandle = None
21 def __init__(self, parentui, path=None, create=0):
19 def __init__(self, parentui, path=None, create=0):
22 repo.repository.__init__(self)
20 repo.repository.__init__(self)
23 self.path = path
21 self.path = path
@@ -84,7 +82,7 b' class localrepository(repo.repository):'
84 self.branchcache = None
82 self.branchcache = None
85 self.nodetagscache = None
83 self.nodetagscache = None
86 self.filterpats = {}
84 self.filterpats = {}
87 self.transhandle = None
85 self._transref = self._lockref = self._wlockref = None
88
86
89 def __getattr__(self, name):
87 def __getattr__(self, name):
90 if name == 'changelog':
88 if name == 'changelog':
@@ -396,6 +394,11 b' class localrepository(repo.repository):'
396 n = self.changelog._partialmatch(key)
394 n = self.changelog._partialmatch(key)
397 if n:
395 if n:
398 return n
396 return n
397 try:
398 if len(key) == 20:
399 key = hex(key)
400 except:
401 pass
399 raise repo.RepoError(_("unknown revision '%s'") % key)
402 raise repo.RepoError(_("unknown revision '%s'") % key)
400
403
401 def dev(self):
404 def dev(self):
@@ -495,9 +498,8 b' class localrepository(repo.repository):'
495 return self._filter("decode", filename, data)
498 return self._filter("decode", filename, data)
496
499
497 def transaction(self):
500 def transaction(self):
498 tr = self.transhandle
501 if self._transref and self._transref():
499 if tr != None and tr.running():
502 return self._transref().nest()
500 return tr.nest()
501
503
502 # save dirstate for rollback
504 # save dirstate for rollback
503 try:
505 try:
@@ -511,7 +513,7 b' class localrepository(repo.repository):'
511 tr = transaction.transaction(self.ui.warn, self.sopener,
513 tr = transaction.transaction(self.ui.warn, self.sopener,
512 self.sjoin("journal"),
514 self.sjoin("journal"),
513 aftertrans(renames))
515 aftertrans(renames))
514 self.transhandle = tr
516 self._transref = weakref.ref(tr)
515 return tr
517 return tr
516
518
517 def recover(self):
519 def recover(self):
@@ -1,8 +1,8 b''
1 error: pretxncommit.nocommits hook failed: no commits allowed
1 error: pretxncommit.nocommits hook failed: no commits allowed
2 abort: no commits allowed
3 transaction abort!
2 transaction abort!
4 rollback completed
3 rollback completed
4 abort: no commits allowed
5 error: pretxncommit.nocommits hook failed: no commits allowed
5 error: pretxncommit.nocommits hook failed: no commits allowed
6 abort: no commits allowed
7 transaction abort!
6 transaction abort!
8 rollback completed
7 rollback completed
8 abort: no commits allowed
@@ -129,9 +129,9 b' acl: acl.allow enabled, 0 entries for us'
129 acl: acl.deny not enabled
129 acl: acl.deny not enabled
130 acl: user fred not allowed on foo/file.txt
130 acl: user fred not allowed on foo/file.txt
131 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
131 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
132 abort: acl: access denied for changeset ef1ea85a6374
133 transaction abort!
132 transaction abort!
134 rollback completed
133 rollback completed
134 abort: acl: access denied for changeset ef1ea85a6374
135 no rollback information available
135 no rollback information available
136 0:6675d58eff77
136 0:6675d58eff77
137
137
@@ -170,9 +170,9 b' acl: allowing changeset ef1ea85a6374'
170 acl: allowing changeset f9cafe1212c8
170 acl: allowing changeset f9cafe1212c8
171 acl: user fred not allowed on quux/file.py
171 acl: user fred not allowed on quux/file.py
172 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
172 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
173 abort: acl: access denied for changeset 911600dab2ae
174 transaction abort!
173 transaction abort!
175 rollback completed
174 rollback completed
175 abort: acl: access denied for changeset 911600dab2ae
176 no rollback information available
176 no rollback information available
177 0:6675d58eff77
177 0:6675d58eff77
178
178
@@ -210,9 +210,9 b' acl: acl.allow enabled, 0 entries for us'
210 acl: acl.deny enabled, 0 entries for user barney
210 acl: acl.deny enabled, 0 entries for user barney
211 acl: user barney not allowed on foo/file.txt
211 acl: user barney not allowed on foo/file.txt
212 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
212 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
213 abort: acl: access denied for changeset ef1ea85a6374
214 transaction abort!
213 transaction abort!
215 rollback completed
214 rollback completed
215 abort: acl: access denied for changeset ef1ea85a6374
216 no rollback information available
216 no rollback information available
217 0:6675d58eff77
217 0:6675d58eff77
218
218
@@ -253,9 +253,9 b' acl: allowing changeset ef1ea85a6374'
253 acl: allowing changeset f9cafe1212c8
253 acl: allowing changeset f9cafe1212c8
254 acl: user fred not allowed on quux/file.py
254 acl: user fred not allowed on quux/file.py
255 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
255 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
256 abort: acl: access denied for changeset 911600dab2ae
257 transaction abort!
256 transaction abort!
258 rollback completed
257 rollback completed
258 abort: acl: access denied for changeset 911600dab2ae
259 no rollback information available
259 no rollback information available
260 0:6675d58eff77
260 0:6675d58eff77
261
261
@@ -296,9 +296,9 b' acl: acl.deny enabled, 2 entries for use'
296 acl: allowing changeset ef1ea85a6374
296 acl: allowing changeset ef1ea85a6374
297 acl: user fred denied on foo/Bar/file.txt
297 acl: user fred denied on foo/Bar/file.txt
298 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8
298 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8
299 abort: acl: access denied for changeset f9cafe1212c8
300 transaction abort!
299 transaction abort!
301 rollback completed
300 rollback completed
301 abort: acl: access denied for changeset f9cafe1212c8
302 no rollback information available
302 no rollback information available
303 0:6675d58eff77
303 0:6675d58eff77
304
304
@@ -338,9 +338,9 b' acl: acl.allow enabled, 0 entries for us'
338 acl: acl.deny enabled, 0 entries for user barney
338 acl: acl.deny enabled, 0 entries for user barney
339 acl: user barney not allowed on foo/file.txt
339 acl: user barney not allowed on foo/file.txt
340 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
340 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
341 abort: acl: access denied for changeset ef1ea85a6374
342 transaction abort!
341 transaction abort!
343 rollback completed
342 rollback completed
343 abort: acl: access denied for changeset ef1ea85a6374
344 no rollback information available
344 no rollback information available
345 0:6675d58eff77
345 0:6675d58eff77
346
346
@@ -427,9 +427,9 b' acl: allowing changeset ef1ea85a6374'
427 acl: allowing changeset f9cafe1212c8
427 acl: allowing changeset f9cafe1212c8
428 acl: user wilma not allowed on quux/file.py
428 acl: user wilma not allowed on quux/file.py
429 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
429 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
430 abort: acl: access denied for changeset 911600dab2ae
431 transaction abort!
430 transaction abort!
432 rollback completed
431 rollback completed
432 abort: acl: access denied for changeset 911600dab2ae
433 no rollback information available
433 no rollback information available
434 0:6675d58eff77
434 0:6675d58eff77
435
435
@@ -471,9 +471,9 b' adding quux/file.py revisions'
471 added 3 changesets with 3 changes to 3 files
471 added 3 changesets with 3 changes to 3 files
472 calling hook pretxnchangegroup.acl: hgext.acl.hook
472 calling hook pretxnchangegroup.acl: hgext.acl.hook
473 error: pretxnchangegroup.acl hook failed: unable to open ../acl.config: No such file or directory
473 error: pretxnchangegroup.acl hook failed: unable to open ../acl.config: No such file or directory
474 abort: unable to open ../acl.config: No such file or directory
475 transaction abort!
474 transaction abort!
476 rollback completed
475 rollback completed
476 abort: unable to open ../acl.config: No such file or directory
477 no rollback information available
477 no rollback information available
478 0:6675d58eff77
478 0:6675d58eff77
479
479
@@ -524,9 +524,9 b' acl: allowing changeset ef1ea85a6374'
524 acl: allowing changeset f9cafe1212c8
524 acl: allowing changeset f9cafe1212c8
525 acl: user betty not allowed on quux/file.py
525 acl: user betty not allowed on quux/file.py
526 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
526 error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
527 abort: acl: access denied for changeset 911600dab2ae
528 transaction abort!
527 transaction abort!
529 rollback completed
528 rollback completed
529 abort: acl: access denied for changeset 911600dab2ae
530 no rollback information available
530 no rollback information available
531 0:6675d58eff77
531 0:6675d58eff77
532
532
@@ -1,8 +1,8 b''
1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 pulling from ../source
2 pulling from ../source
3 abort: pretxncommit hook exited with status 1
4 transaction abort!
3 transaction abort!
5 rollback completed
4 rollback completed
5 abort: pretxncommit hook exited with status 1
6 searching for changes
6 searching for changes
7 adding changesets
7 adding changesets
8 adding manifests
8 adding manifests
@@ -22,7 +22,7 b' user: foo@bar.com'
22 date: Mon Jan 12 13:46:40 1970 +0000
22 date: Mon Jan 12 13:46:40 1970 +0000
23 summary: commit-1
23 summary: commit-1
24
24
25 abort: Please specify a username.
26 transaction abort!
25 transaction abort!
27 rollback completed
26 rollback completed
27 abort: Please specify a username.
28 No username found, using user@host instead
28 No username found, using user@host instead
@@ -60,9 +60,9 b' precommit hook: HG_PARENT1=8ea2ef7ad3e8c'
60 pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
60 pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
61 5:fad284daf8c0
61 5:fad284daf8c0
62 pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
62 pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
63 abort: pretxncommit.forbid1 hook exited with status 1
64 transaction abort!
63 transaction abort!
65 rollback completed
64 rollback completed
65 abort: pretxncommit.forbid1 hook exited with status 1
66 4:8ea2ef7ad3e8
66 4:8ea2ef7ad3e8
67 precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
67 precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
68 precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
68 precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
@@ -86,9 +86,9 b' adding changesets'
86 adding manifests
86 adding manifests
87 adding file changes
87 adding file changes
88 added 1 changesets with 1 changes to 1 files
88 added 1 changesets with 1 changes to 1 files
89 abort: pretxnchangegroup.forbid1 hook exited with status 1
90 transaction abort!
89 transaction abort!
91 rollback completed
90 rollback completed
91 abort: pretxnchangegroup.forbid1 hook exited with status 1
92 3:4c52fb2e4022
92 3:4c52fb2e4022
93 preoutgoing hook: HG_SOURCE=pull
93 preoutgoing hook: HG_SOURCE=pull
94 outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull
94 outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull
General Comments 0
You need to be logged in to leave comments. Login now