Commit Graph

59 Commits

Author SHA1 Message Date
Augie Fackler
d7b1ad91f4 strip: move bookmarks to nearest ancestor rather than '.'
If you've got this graph:

0-1-2
   \
    3

and 3 is checked out, 2 is bookmarked with "broken", and you do "hg
strip 2", the bookmark will move to 3, not 1. That's always struck me
as a bug.

This change makes bookmarks move to the tipmost ancestor of
the stripped set rather than the currently-checked-out revision, which
is what I always expected should happen.
2012-07-26 16:57:50 -05:00
Joshua Redstone
fe77ca6b46 strip: incrementally update the branchheads cache after a strip
This function augments strip to incrementally update the branchheads cache
rather than recompute it from scratch.  This speeds up the performance of strip
and rebase on repos with long history.  The performance optimization only
happens if the revisions stripped are all on the same branch and the parents of
the stripped revisions are also on that same branch.

This adds a few test cases, particularly one that reproduces the extra heads
that mpm observed.
2012-05-18 12:45:47 -07:00
Bryan O'Sullivan
141bd09daa revlog: descendants(*revs) becomes descendants(revs) (API)
Once again making the API more rational, as with ancestors.
2012-06-01 12:45:16 -07:00
Matt Mackall
7e8d9b6e6f branchcache: backout 29529231e17d 2012-05-17 15:34:59 -05:00
Joshua Redstone
d70249edef localrepo: strip now incrementally updates the branchheads cache
Destroying history via strip used to invalidate the branchheads cache,
causing it to be regenerated the next time it is read. This is
expensive in large repos. This change converts strip to pass info to
localrepo.destroyed() to enable to it to incrementally update the
cache, improving the performance of strip and other operations that
depend on it (e.g., rebase).

This change also strengthens a bit the integrity checking of the
branchheads cache when it is read, by rejecting the cache if it has
nodes in it that no longer exist.
2012-05-11 10:35:54 -07:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
redstone
7ea2f3b663 localrepo: cleanup var names and comments
Cosmetic cleanups.  Fix comment typo referring to the notion of multiple tips.
Make variable describing a generator end in 'gen'.
Fix another var containing a node not to end with 'rev'.
2012-05-11 10:53:12 -07:00
Patrick Mezard
2940b01bad repair: no need to call filterunknown() in strip()
Calling strip() will eventually trigger localrepo.destroyed() which will
invalidate _parseroots. It will call filterunknown() upon reload.

Changes to test-keyword.t are related to commit --debug running after
either qpop or rollback.
2012-05-10 18:21:15 +02:00
Alain Leufroy
01eed330fd repair: fix missing import
introduced by: 1792c24f759cbee608767738104810158188a0e4
2012-04-16 10:33:18 +02:00
Idan Kamara
6a237ec01a repair: allow giving strip backup a different name
So the user can differentiate amend backups from the rest.
2012-04-06 16:18:33 +03:00
Matt Mackall
87d3671dbf merge with stable 2012-03-12 17:05:42 -05:00
Wagner Bruna
9653f097ec strip: enhance repair.strip to receive a list of nodes (issue3299)
Originally, mq.strip called repair.strip a single rev at a time.
repair.strip stores in a backup bundle any revision greater than
the revision being stripped, strips, then restores the backup with
repo.addchangegroup. So, when stripping revisions on more than one
topological branch, some could end up being restored from the backup
bundle, only to be later removed by a subsequent repair.strip call.

But repo.addchangegroup calls hooks for all those restore operations.
And 1671d21e8e41 changed it to delay all hook calls until the
repository lock were released - by mq.strip, after stripping all
revisions. Thus, the hooks could be called over revisions already
removed from the repository at that point.

By generating the revision lists at once inside repo.strip, we avoid
calling addchangegroup for temporary restores. Incidentally, this
also avoids creating many backup files for a single strip command.
2012-03-12 17:02:45 -03:00
Idan Kamara
3d63e7c8f4 repair: remove undo files after strip 2012-03-06 18:43:05 +02:00
Henrik Stuart
1b54292744 repair: move phases code after invalidation code 2012-01-18 14:50:17 +01:00
Pierre-Yves David
e62e01ae47 phases: handle unknown nodes in boundary
We filter unknown node out of the boundary. No data is lost. A
filtering is explicitly done after strip too
2011-11-07 13:20:22 +01:00
Matt Mackall
7215130ac4 strip: backout 9aac86f54486 (issue3077) 2011-10-30 12:10:09 -05:00
Peter Arrenbrecht
e10442fbcb repair: switch from changegroupsubset to getbundle
This is in preparation of deprecating changegroupsubset.
2011-09-01 12:29:24 +02:00
Alexander Solovyov
0eb3836642 remove unused imports and variables 2011-04-30 13:59:14 +02:00
Patrick Mezard
4e7e0fa921 code indentation fixes 2011-03-23 23:33:14 +01:00
Matt Mackall
00a0332ced repair: revlog has an iterator 2011-03-20 20:21:19 -05:00
Matt Mackall
920f4c5db4 strip: simplify collectone 2011-03-20 19:43:28 -05:00
Benoit Boissinot
66804f4889 strip: remove usage of extranodes
Instead of computing the exact set of missing revlog revisions, we only
compute the set of missing/broken changesets. The resulting bundle can be
slightly bigger but we will be able to get rid of the ugly extranodes handling
in changegroupsubset.
2011-03-20 00:50:22 +01:00
Matt Mackall
d3d3054cf5 bookmarks: move strip support to repair 2011-02-10 13:46:28 -06:00
Patrick Mezard
0e57a866c2 repair: pass variable explicitely to nested function 2010-08-26 23:38:13 +02:00
Nicolas Dumazet
96827d742a repair: do not compress partial bundle if we do not keep it on disk
A partial bundle is created to temporarily save revisions > rev but
not descending from the node to strip, to be able to restore the
changesets after stripping the changelog.
Since this bundle is not kept after the strip operation, and is not
user-visible, it is not necessary and should be faster to avoid
compression.
2010-08-12 16:53:23 +09:00
Martin Geisler
8f362a460f mark ui.warn strings for translation 2010-07-16 14:44:30 +02:00
Matt Mackall
251885d01b strip: backup bundles should use the .hg extension 2010-06-10 15:23:31 -05:00
Matt Mackall
46429c0cb8 strip: hide unbundle messages by default
Unbundling is an internal implementation detail for strip, only show
them with --verbose.
2010-05-20 13:27:28 -05:00
Matt Mackall
a386dc3529 strip: improve full backup message 2010-05-20 12:15:44 -05:00
Matt Mackall
0a1ca665ca strip: be quiet about temporary internal bundle 2010-05-19 19:46:39 -05:00
Steve Borho
c7ec998a7b localrepo: add desc parameter to transaction
All callers to localrepo.transaction() must supply a transaction description.
The description and the existing repository tip are then stored
(transactionally) into .hg/undo.desc; where rollback can later find it.
2010-04-09 17:23:35 -05:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Greg Ward
0487eef6d6 localrepo: add destroyed() method for strip/rollback to use (issue548). 2009-07-16 10:39:41 -04:00
Brendan Cully
2c53914f62 Fix issue1738 for strip too.
I see no reason to open every touched file at once.
2009-07-14 17:58:36 -07:00
Martin Geisler
4176f5b789 replace xrange(0, n) with xrange(n) 2009-05-25 23:06:11 +02:00
Martin Geisler
7901628fb3 repair: bulk update sets
Use a single set.update and set.difference_update call instead of many
set.add and set.discard calls.
2009-05-17 16:55:51 +02:00
Benoit Boissinot
21c663ad08 repair: use set instead of dict 2009-05-17 03:38:03 +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
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Henrik Stuart
c1e6537e5f strip: make repair.strip transactional to avoid repository corruption
Uses a transaction instance from the local repository to journal the
truncation of revlog files, such that if a strip only partially completes,
hg recover will be able to finish the truncate of all the files.

The potential unbundling of changes that have been backed up to be restored
later will, in case of an error, have to be unbundled manually. The
difference is that it will be possible to recover the repository state so
the unbundle can actually succeed.
2009-04-16 15:34:03 +02:00
Matt Mackall
b2807810c6 linkrev: take a revision number rather than a hash 2008-11-12 15:19:14 -06:00
Martin Geisler
28fb695e9a i18n: mark strings for translation in Mercurial 2008-08-31 16:12:02 +02:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Benoit Boissinot
9ac6d264fb fix warning from pychecker 2008-03-30 20:21:57 +02:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Alexis S. L. Carvalho
aa51bf2928 repair.py: rewrite a loop, making it cleaner and faster 2008-02-19 19:20:10 -03:00
Alexis S. L. Carvalho
ba985d288a simplify revlog.strip interface and callers; add docstring
Also, strip files only after the changelog and the manifest.
2008-01-19 18:01:16 -02:00
Alexis S. L. Carvalho
8b35462ec9 strip: calculate list of extra nodes to save and pass it to changegroupsubset
When we remove revision N from the repository, all revisions >= N are
affected: either it's a descendant from N and will also be removed, or
it's not a descendant of N and will be renumbered.

As a consequence, we have to (at least temporarily) remove all filelog
and manifest revisions that have a linkrev >= N, readding some of them
later.

Unfortunately, it's possible to have a revlog with two revisions
r1 and r2 such that r1 < r2, but linkrev(r1) > linkrev(r2).  If we try
to strip revision linkrev(r1) from the repository, we'll also lose
revision r2 when we truncate this revlog.

We already use changegroupsubset to create a temporary changegroup
containing the revisions that have to be restored, but that function is
unable to detect that we also wanted to save the r2 in the case above.

So we manually calculate these extra nodes and pass it to changegroupsubset.

This should fix issue764.
2008-01-19 18:01:16 -02:00