--- a/mercurial/localrepo.py Sat Jul 21 16:02:10 2007 -0500
+++ b/mercurial/localrepo.py Sat Jul 21 16:02:10 2007 -0500
@@ -8,7 +8,7 @@
from node import *
from i18n import _
import repo, changegroup
-import changelog, dirstate, filelog, manifest, context
+import changelog, dirstate, filelog, manifest, context, weakref
import re, lock, transaction, tempfile, stat, mdiff, errno, ui
import os, revlog, time, util, extensions, hook
@@ -16,8 +16,6 @@
capabilities = ('lookup', 'changegroupsubset')
supported = ('revlogv1', 'store')
- def __del__(self):
- self.transhandle = None
def __init__(self, parentui, path=None, create=0):
repo.repository.__init__(self)
self.path = path
@@ -84,7 +82,7 @@
self.branchcache = None
self.nodetagscache = None
self.filterpats = {}
- self.transhandle = None
+ self._transref = self._lockref = self._wlockref = None
def __getattr__(self, name):
if name == 'changelog':
@@ -396,6 +394,11 @@
n = self.changelog._partialmatch(key)
if n:
return n
+ try:
+ if len(key) == 20:
+ key = hex(key)
+ except:
+ pass
raise repo.RepoError(_("unknown revision '%s'") % key)
def dev(self):
@@ -495,9 +498,8 @@
return self._filter("decode", filename, data)
def transaction(self):
- tr = self.transhandle
- if tr != None and tr.running():
- return tr.nest()
+ if self._transref and self._transref():
+ return self._transref().nest()
# save dirstate for rollback
try:
@@ -511,7 +513,7 @@
tr = transaction.transaction(self.ui.warn, self.sopener,
self.sjoin("journal"),
aftertrans(renames))
- self.transhandle = tr
+ self._transref = weakref.ref(tr)
return tr
def recover(self):
--- a/tests/test-abort-checkin.out Sat Jul 21 16:02:10 2007 -0500
+++ b/tests/test-abort-checkin.out Sat Jul 21 16:02:10 2007 -0500
@@ -1,8 +1,8 @@
error: pretxncommit.nocommits hook failed: no commits allowed
-abort: no commits allowed
transaction abort!
rollback completed
+abort: no commits allowed
error: pretxncommit.nocommits hook failed: no commits allowed
-abort: no commits allowed
transaction abort!
rollback completed
+abort: no commits allowed
--- a/tests/test-acl.out Sat Jul 21 16:02:10 2007 -0500
+++ b/tests/test-acl.out Sat Jul 21 16:02:10 2007 -0500
@@ -129,9 +129,9 @@
acl: acl.deny not enabled
acl: user fred not allowed on foo/file.txt
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
-abort: acl: access denied for changeset ef1ea85a6374
transaction abort!
rollback completed
+abort: acl: access denied for changeset ef1ea85a6374
no rollback information available
0:6675d58eff77
@@ -170,9 +170,9 @@
acl: allowing changeset f9cafe1212c8
acl: user fred not allowed on quux/file.py
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
-abort: acl: access denied for changeset 911600dab2ae
transaction abort!
rollback completed
+abort: acl: access denied for changeset 911600dab2ae
no rollback information available
0:6675d58eff77
@@ -210,9 +210,9 @@
acl: acl.deny enabled, 0 entries for user barney
acl: user barney not allowed on foo/file.txt
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
-abort: acl: access denied for changeset ef1ea85a6374
transaction abort!
rollback completed
+abort: acl: access denied for changeset ef1ea85a6374
no rollback information available
0:6675d58eff77
@@ -253,9 +253,9 @@
acl: allowing changeset f9cafe1212c8
acl: user fred not allowed on quux/file.py
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
-abort: acl: access denied for changeset 911600dab2ae
transaction abort!
rollback completed
+abort: acl: access denied for changeset 911600dab2ae
no rollback information available
0:6675d58eff77
@@ -296,9 +296,9 @@
acl: allowing changeset ef1ea85a6374
acl: user fred denied on foo/Bar/file.txt
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8
-abort: acl: access denied for changeset f9cafe1212c8
transaction abort!
rollback completed
+abort: acl: access denied for changeset f9cafe1212c8
no rollback information available
0:6675d58eff77
@@ -338,9 +338,9 @@
acl: acl.deny enabled, 0 entries for user barney
acl: user barney not allowed on foo/file.txt
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset ef1ea85a6374
-abort: acl: access denied for changeset ef1ea85a6374
transaction abort!
rollback completed
+abort: acl: access denied for changeset ef1ea85a6374
no rollback information available
0:6675d58eff77
@@ -427,9 +427,9 @@
acl: allowing changeset f9cafe1212c8
acl: user wilma not allowed on quux/file.py
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
-abort: acl: access denied for changeset 911600dab2ae
transaction abort!
rollback completed
+abort: acl: access denied for changeset 911600dab2ae
no rollback information available
0:6675d58eff77
@@ -471,9 +471,9 @@
added 3 changesets with 3 changes to 3 files
calling hook pretxnchangegroup.acl: hgext.acl.hook
error: pretxnchangegroup.acl hook failed: unable to open ../acl.config: No such file or directory
-abort: unable to open ../acl.config: No such file or directory
transaction abort!
rollback completed
+abort: unable to open ../acl.config: No such file or directory
no rollback information available
0:6675d58eff77
@@ -524,9 +524,9 @@
acl: allowing changeset f9cafe1212c8
acl: user betty not allowed on quux/file.py
error: pretxnchangegroup.acl hook failed: acl: access denied for changeset 911600dab2ae
-abort: acl: access denied for changeset 911600dab2ae
transaction abort!
rollback completed
+abort: acl: access denied for changeset 911600dab2ae
no rollback information available
0:6675d58eff77
--- a/tests/test-clone-pull-corruption.out Sat Jul 21 16:02:10 2007 -0500
+++ b/tests/test-clone-pull-corruption.out Sat Jul 21 16:02:10 2007 -0500
@@ -1,8 +1,8 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
pulling from ../source
-abort: pretxncommit hook exited with status 1
transaction abort!
rollback completed
+abort: pretxncommit hook exited with status 1
searching for changes
adding changesets
adding manifests
--- a/tests/test-committer.out Sat Jul 21 16:02:10 2007 -0500
+++ b/tests/test-committer.out Sat Jul 21 16:02:10 2007 -0500
@@ -22,7 +22,7 @@
date: Mon Jan 12 13:46:40 1970 +0000
summary: commit-1
-abort: Please specify a username.
transaction abort!
rollback completed
+abort: Please specify a username.
No username found, using user@host instead
--- a/tests/test-hook.out Sat Jul 21 16:02:10 2007 -0500
+++ b/tests/test-hook.out Sat Jul 21 16:02:10 2007 -0500
@@ -60,9 +60,9 @@
pretxncommit hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
5:fad284daf8c0
pretxncommit.forbid hook: HG_NODE=fad284daf8c032148abaffcd745dafeceefceb61 HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
-abort: pretxncommit.forbid1 hook exited with status 1
transaction abort!
rollback completed
+abort: pretxncommit.forbid1 hook exited with status 1
4:8ea2ef7ad3e8
precommit hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
precommit.forbid hook: HG_PARENT1=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198
@@ -86,9 +86,9 @@
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
-abort: pretxnchangegroup.forbid1 hook exited with status 1
transaction abort!
rollback completed
+abort: pretxnchangegroup.forbid1 hook exited with status 1
3:4c52fb2e4022
preoutgoing hook: HG_SOURCE=pull
outgoing hook: HG_NODE=8ea2ef7ad3e8cac946c72f1e0c79d6aebc301198 HG_SOURCE=pull