Commit Graph

48 Commits

Author SHA1 Message Date
Adrian Buehlmann
76e8469c0d transaction: use posixfile and unlink from util
instead of open() and os.unlink()

Avoids potential issues with file access on Windows (e.g. AV-scanners).
2011-02-15 14:41:49 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Patrick Mezard
3153012325 cleanup: typos 2010-07-26 22:29:49 +02:00
Ronny Pfannschmidt
4362059a98 make transactions work on non-refcounted python implementations 2010-05-27 17:47:40 +02:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Benoit Boissinot
8265d7b666 transaction: initialize self.journal to None after deletion
This avoid a warning when having an empty transaction, where hg would try to
delete the journal twice.
2010-01-11 21:40:19 +01:00
Sune Foldager
46c649736d transaction: always remove empty journal on abort
When transactions without entries were aborted, the journal (of size 0) was not
unlinked, which prevents subsequent operations until hg recover is run on the
repository.

We also make sure the journal is unlinked when committing, even if the provided
hook doesn't do so.
2009-11-02 10:19:14 +01:00
Benoit Boissinot
864f95d532 transaction: more specific exceptions, os.unlink can raise OSError 2009-10-31 18:17:59 +01:00
Greg Ward
b42121b634 transaction: document close(), abort() methods 2009-07-21 20:31:45 -04:00
Henrik Stuart
2108f47c49 transaction: fix uncaught ENOENT (issue1724)
The opener raises an IOError on errors where transaction expects an
OSError.
2009-07-07 19:24:52 +02:00
Henrik Stuart
ec8d726ba0 transaction: add atomic groups to transaction logic
When performing a strip operation on a repository, it is vital that all the
truncations are performed, or that none of them are. This is done by adding
support for writing a number of entries in a single operation.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-11 21:12:40 +02:00
Henrik Stuart
d0b7d204d4 transaction: refactor transaction.abort and rollback to use the same code
This adds a change to the way that abort is processed, as it will not continue
truncating files beyond the first failure, otherwise the respective
functionality is maintained, i.e. abort will not unlink files, but rollback
will.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-04 15:31:57 +02:00
Henrik Stuart
206e98a6fb transaction: reset transaction on abort
Prevent the use of the transaction after it has been aborted.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-04-19 20:02:32 +02:00
Henrik Stuart
db9b1644e1 transaction: ensure finished transactions are not reused
All transactional methods on the transaction class have had a decorator
added that ensures the transaction is running.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-04-24 09:56:53 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Henrik Stuart
c57f2e28ee transaction: only delete journal on successful abort/commit
This solves that the journal file was always deleted when the transaction
was deleted, no matter whether the abort (rollback) succeeded or not.
Thus, never supporting a hg recover. The journal file is now only deleted
on close (commit) or a successful abort.
2009-04-16 15:41:25 +02:00
Benoit Boissinot
becc8b09ae add missing import from d329ec89ce55 2008-11-07 18:42:43 +01:00
Benoit Boissinot
a95f4bd10d fix restart of interrupted recover
Ignore missing files if they are already removed.
Thanks maelcum on IRC for reporting it.
2008-11-07 18:41:22 +01:00
Brendan Cully
9d21508cbe rollback: unlink files truncated to length 0 2008-03-31 23:02:25 -07:00
Alexis S. L. Carvalho
6b4c649e55 make the journal/undo files from transactions inherit the mode from .hg/store 2008-02-09 18:38:54 -02:00
Matt Mackall
a68910fcf1 transactions: don't show a backtrace when journal exists
Now we simply print a message on how to recover.
2008-01-16 11:32:25 -06:00
Matt Mackall
296d6a7cb8 Simplify i18n imports 2006-12-14 20:25:19 -06:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Vadim Gelfer
9a0c813fdc use demandload more. 2006-06-20 23:58:21 -07:00
Chris Mason
4841dc10da Fix transaction handling during interleaved file split. 2006-04-17 13:19:58 -04:00
mason@suse.com
9090463607 Automatic nesting into running transactions in the same repository.
This associates a transaction handle with a given repository object, and
any additional calls to start new transactions reuse that transaction.

For the 2700 patch import run, this brings the system time down from
1m20s to 50s, mostly by skipping backups of the dirstate file.

(note, this patch does not change hg import to use the nested transaction,
mq is the only user right now)
2006-02-28 12:24:54 -06:00
Eric Hopper
dd6718fc31 Convert all classes to new-style classes by deriving them from object. 2005-11-18 22:48:47 -08:00
twaldmann@thinkmo.de
55d74a6b77 fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX 2005-11-14 03:59:35 +02:00
Benoit Boissinot
06e39e559b i18n part2: use '_' for all strings who are part of the user interface 2005-10-18 18:38:39 -07:00
Benoit Boissinot
e38e94088a i18n first part: make '_' available for files who need it 2005-10-18 18:37:48 -07:00
Bart Trojanowski
3529a29a40 [PATCH] raise exceptions with Exception subclasses
Fixed the patch.  Using Exception subclasses.

(tweaked by mpm)
2005-08-26 19:08:25 -07:00
benoit.boissinot@ens-lyon.fr
95b97f01ed pep-0008 cleanup
- Don't use spaces around the '=' sign when used to indicate a
      keyword argument or a default parameter value.
2005-08-26 13:06:58 +02:00
mpm@selenic.com
e4d910ab82 Fix undo after aborted commit bug
Commit would overwrite undo.dirstate unconditionally, so an undo after
an aborted commit would restore the dirstate from the aborted commit
and not the prior transaction.

This copies dirstate to journal.dirstate and moves it after a
successful transaction.
2005-07-27 18:16:20 -08:00
mpm@selenic.com
4394004b4a Remove all remaining print statements
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remove all remaining print statements

Convert most prints to ui.warn or ui.write
Pass a write function into transactions

manifest hash: d1b0af7a344fc087a5acfe3ae87b782c20d043e0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCx1Q3ywK+sNU5EO8RAqSTAJwM5t/m+JOlf2ZXOjuItCSdFiubcwCdFm3G
HoicikSYpTgfCj2pIRfyLjo=
=Loqo
-----END PGP SIGNATURE-----
2005-07-02 18:57:59 -08:00
mpm@selenic.com
0420d357e1 transaction: nullify journal after close()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

transaction: nullify journal after close()

This keeps us from trying to cleanup in __del__.

bug spotted by K Thananchayan <thananck@yahoo.com>

manifest hash: 1f4c5fa43d2458cdcb6ec0f0a7066b3c3e699f33
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCxwQ6ywK+sNU5EO8RAuGhAJ9+BnKILwRCF9EKlPTz2zptiysQ/QCgsB3s
VKIehiStv+ibWQQi15k4mwk=
=nZD1
-----END PGP SIGNATURE-----
2005-07-02 13:16:42 -08:00
mpm@selenic.com
b292364b4f transaction: __del__ should do nothing if the journal already exists
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

transaction: __del__ should do nothing if the journal already exists

manifest hash: c85f747ca762b7c446d306cbd7a20f8e566557fb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCxXbTywK+sNU5EO8RAvjsAKCcTSzN9OjtoAdaZgtjDs9380ia7ACfcXsx
FcNESqr4nX9b97WTGszJs48=
=C2sL
-----END PGP SIGNATURE-----
2005-07-01 09:01:07 -08:00
mpm@selenic.com
0fb5db6915 Whitespace cleanups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whitespace cleanups

manifest hash: ac954bc3a4f034c12638a259ecd65841f5b63c5c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t
rknNUN/PhtyA4bzL646dOz4=
=UyCE
-----END PGP SIGNATURE-----
2005-06-29 10:42:35 -08:00
mpm@selenic.com
5e62f2ce10 [PATCH] rename under the other OS
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH] rename under the other OS

From: K Thananchayan <thananck@yahoo.com>

Rename fails under windows if dest file exists. This
patch add a rename method to util module that removes
the dest file and retries if initial attempt fails.

manifest hash: 2744d9fd1717e15133b411a269df909fa8ec0faf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCuNzDywK+sNU5EO8RAsPBAJ9NQN3bTuJvTem5x+utGnoMkhYc0QCbBFSJ
PoMP69H1UnVE6drFlnlFE0s=
=pePw
-----END PGP SIGNATURE-----
2005-06-21 19:36:35 -08:00
mpm@selenic.com
683f21be6a Implement recover and undo commands
This adds an interface to transaction to rollback with a given journal file
and commands to rollback an existing .hg/journal or .hg/undo.
2005-05-26 09:04:54 -08:00
mpm@selenic.com
7a540c10d5 Warn if we fail to truncate something 2005-05-20 17:20:39 -08:00
mpm@selenic.com
2bbb8b5a72 Beginnings of transaction undo support 2005-05-18 16:31:51 -08:00
mpm@selenic.com
60afa3551c Attempt to recover journal automatically 2005-05-10 00:32:05 -08:00
mpm@selenic.com
97820ba3c6 Fix multiple changes to file per transaction 2005-05-10 00:31:00 -08:00
mpm@selenic.com
89e337b327 Fix empty transaction destruction 2005-05-04 09:32:39 -08:00
mpm@selenic.com
78a55d241c Delete journal on destruction even if there are no entries to replay. 2005-05-04 09:30:56 -08:00
mpm@selenic.com
ca8cb8ba67 Add back links from file revisions to changeset revisions
Add simple transaction support
Add hg verify
Improve caching in revlog
Fix a bunch of bugs
Self-hosting now that the metadata is close to finalized
2005-05-03 13:16:10 -08:00