diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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): diff --git a/tests/test-abort-checkin.out b/tests/test-abort-checkin.out --- a/tests/test-abort-checkin.out +++ b/tests/test-abort-checkin.out @@ -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 diff --git a/tests/test-acl.out b/tests/test-acl.out --- a/tests/test-acl.out +++ b/tests/test-acl.out @@ -129,9 +129,9 @@ acl: acl.allow enabled, 0 entries for us 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 ef1ea85a6374 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.allow enabled, 0 entries for us 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 ef1ea85a6374 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: acl.deny enabled, 2 entries for use 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.allow enabled, 0 entries for us 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 ef1ea85a6374 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 @@ adding quux/file.py revisions 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 ef1ea85a6374 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 diff --git a/tests/test-clone-pull-corruption.out b/tests/test-clone-pull-corruption.out --- a/tests/test-clone-pull-corruption.out +++ b/tests/test-clone-pull-corruption.out @@ -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 diff --git a/tests/test-committer.out b/tests/test-committer.out --- a/tests/test-committer.out +++ b/tests/test-committer.out @@ -22,7 +22,7 @@ user: foo@bar.com 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 diff --git a/tests/test-hook.out b/tests/test-hook.out --- a/tests/test-hook.out +++ b/tests/test-hook.out @@ -60,9 +60,9 @@ precommit hook: HG_PARENT1=8ea2ef7ad3e8c 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 changesets 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