Commit Graph

9656 Commits

Author SHA1 Message Date
Idan Kamara
92fd1426f3 localrepo: filter unknown nodes from the phasecache on destroyed
When commit is followed by strip (qrefresh), phasecache contains nodes that were
removed from the changelog. Since phasecache is filecached with .hg/store/phaseroots
which doesn't change as a result of stripping, we have to filter it manually.

If we don't write it immediately, the next time it is read from disk the nodes
will be filtered again. That's what happened before, but there's no reason not
to write it immediately.

The change in test-keyword.t is caused by the above.
2012-12-21 17:19:52 +01:00
Idan Kamara
e3cd3c1a91 phases: make _filterunknown a member function of phasecache
We'd like the ability to call filterunknown on an existing phasecache
instance after nodes are destroyed.
2013-01-04 06:11:29 +01:00
Pierre-Yves David
458159ba53 localrepo: drop _cacheabletip method
It iss dead code now.
2013-01-04 01:37:38 +01:00
Pierre-Yves David
ea8f599221 branchmap: drop _cacheabletip usage in updatecache
Nobody overwrite the `_cacheabletip` any more. We always update the cache for
the whole repo and write it to disk (or at list try to). The `updatecache` code
is simplied to remove the double phase logic associated with _cacheabletip.
2013-01-04 01:25:55 +01:00
Pierre-Yves David
b52ac2ca01 bundlerepo: drop use of _cacheabletip
Now that bundlerepo use a read only VFS, we do not worry about what part of the
branchmap is written back to disk. Nothing is written at all.
2012-12-28 02:34:32 +01:00
Pierre-Yves David
eccc0c88c9 bundlerepo: enforce reading from core repo only
We do not want anything computed with the bundle overlay to be written back in
the repo. Such write will likely contains invalid data.

The short terms goal of this change is to drop use of `_cacheabletip` in bundle
repo.
2012-12-28 02:32:47 +01:00
Pierre-Yves David
e5d81232c2 branchmap: ignore Abort error while writing cache
Read only vfs can now raise Abort exception. Note that encoding.local are also a
possible raiser.
2013-01-04 04:52:57 +01:00
Pierre-Yves David
ecb9a9d217 vfs: add a read only vfs
This read only wrapper is intended to be used bundle repo. See follow up commit
for details.
2013-01-04 01:07:25 +01:00
Pierre-Yves David
f01949c09e branchmap: read return None in case of failure
This makes a clear distinction between having read a valid cache on disk or not.
This will help caches of various filtering level to collaborate.
2012-12-22 19:41:11 +01:00
Pierre-Yves David
704a17970c clfilter: fallback to unfiltered version when linkrev point to filtered history
On `filectx`, linkrev may point to any revision in the repository. When the
repository is filtered this may lead to `filectx` trying to build `changectx`
for filtered revision. In such case we fallback to creating `changectx` on the
unfiltered version of the reposition. This fallback should not be an issue
because `changectx` from `filectx` are not used in complex operation that
care about filtering. It is complicated to work around the issue in a
clearer way as code raising such `filectx` rarely have access to the
repository directly.

Linkrevs create a lot of issue with filtering. It is stored in revlog entry at
creation time and never changed. Nothing prevent the changeset revision pointed
to become filtered. Several bogus behavior emerge from such situation. Those
bugs are complex to solve and not part of the current effort to install
filtering. This changeset is simple hack that prevent plain crash in favor on
minor misbehavior without visible effect.

This "hack" is longly documented in to code itself to help people that would
look at it in the future.
2012-12-29 00:40:18 +01:00
Pierre-Yves David
8e3d4ef15b phases: prepare phase command for filtering
The phase command have some logic to report change made. We ensure this logic
run unfiltered.

With --force the command can change phase of a changeset for public to draft.
Such change can lead to obsolescence marker to apply again and the changeset to
be "hidden". If we do not run the logic unfiltered it could failed to fetch the
phase of a newly filtered changeset.
2012-12-24 11:58:40 +01:00
Pierre-Yves David
18a17fb6be phases: avoid changectx creation while checking command result
This minor changesets saves the creation of a `changectx` ctx object only used to
fetch the revision number.
2012-12-24 11:57:48 +01:00
Matt Mackall
bad4a7148f paper: sanity-check page feed links
filelog has feeds in header, but not in menu bar
help has header feeds pointing to tags
2012-12-20 16:36:45 -06:00
Matt Mackall
567c0ff1dc scmutil: don't try to match modes on filesystems without modes (issue3740) 2012-12-20 15:52:23 -06:00
Matt Mackall
6f6ef90fe2 hgwebdir: honor web.templates and web.static for static files (issue3734) 2012-12-22 18:11:51 -06:00
Mads Kiilerich
861c915f14 bundlerepo: don't return the peer without bundlerepo from getremotechanges
Problem:
getremotechanges would return the 'other' repo if nothing was incoming and
there thus wasn't any bundle to base the repo on. The 'other' could be a http
peer which only implement the functionality available over the http protocol.
Transplant could thus fail with
  TypeError: argument of type 'httppeer' is not iterable

Solution:
Return the local repo instead of the remote peer if there is no reason to place
a bundlerepo on top of the local repo.
2012-12-28 11:16:01 +01:00
Mads Kiilerich
a17080a566 bookmarks: fix head selection for merge with two bookmarked heads
A type mismatch caused the search for the other head to fail. The code is
fragile, and instead it ended up using the 'first' bookmark head, but the
ordering is undefined and it could thus randomly use the wrong bookmarkhead
and fail with:

  $ hg up -q -C e@diverged
  $ hg merge
  abort: merging with a working directory ancestor has no effect
2012-12-24 13:26:13 +01:00
Matt Mackall
fe2cbf4904 merge with stable 2013-01-02 00:24:28 -06:00
Angel Ezquerra
b072cb14e8 hgweb, paper: add (Atom) subscribe links to the repository index
This is similar to the subscribe links that already exist in other templates.
Rather than the usual RSS and Atom links a single feed icon linking to the
atom-log is shown.
2012-12-20 19:22:12 +01:00
Angel Ezquerra
4108217b64 hgweb: add (Atom) subscribe link to the main paper template pages
The subscribe link is found at the bottom of the navigation sidebar.
This uses a free icon from http://feedicons.com.
2012-12-04 00:41:29 +01:00
Pierre-Yves David
0cd9115520 branchmap: enable caching for filtered version too
The `_branchcache` attribute is turned into a dictionary. Key are filter name and
value is a `branchcache` object. Unfiltered version is cached as `None` filter.

The attribute is renamed to `_branchcaches` to avoid confusion with the previous
one. Both old and new contents are dictionary even if their contents are
different. I prefer possible extension code to crash right away instead of just
messing the wrong dictionary.

As all different caches work isolated to each other, this code keeps the
previous behavior of using the unfiltered cache  we nothing is filtered.  This
is a cheap way to have cache collaborate and nullify potential impact in the
default case.
2012-12-24 03:21:15 +01:00
Pierre-Yves David
daf9851247 branchmap: report filtername when read fails
Now that we can have multiple one, we need to know which filecache failed to be
read from disk.
2013-01-01 21:27:13 +01:00
Pierre-Yves David
256c2dfbf0 branchmap: use a different file name for filtered view of repo 2012-12-24 03:06:03 +01:00
Pierre-Yves David
c957b56f86 clfilter: ensure unfiltered repo have a filtername attribute too
That will allows to use `repo.filtername` for dispatch purpose.
2012-12-24 03:05:02 +01:00
Pierre-Yves David
4ad32b10f3 branchmap: move the cache file name into a dedicated function
Filtered view of the repo will want to write they file name in a different file.
2012-12-24 03:04:12 +01:00
Pierre-Yves David
d7e9f7c173 branchmap: read and write key part related to filtered revision
Now that we have a third part for the cache key we need to write and read it on
disk. It is only written when there is filtered revision. This keep the format
compatible with older version.

Notes that, at this state, filtered repository does not use any disk caches yet.
2013-01-01 18:19:24 +01:00
Augie Fackler
51e564c918 commands: fix implicit tuple that is invalid syntax in Python3 2013-01-01 13:18:33 -06:00
Augie Fackler
a65f6b11d8 httpclient: apply change df9aea1def3e: remove use of two-argument raise 2013-01-01 13:25:07 -06:00
Augie Fackler
83ede3fe35 scmutil: clean up use of two-argument raise
This makes any attempt to port to Python 3 harder, and the new syntax
is supported in 2.4 already.
2013-01-01 12:51:00 -06:00
Augie Fackler
fc13516f60 url: clean up use of two-argument raise
This makes any attempt to port to Python 3 harder, and the new syntax
is supported in 2.4 already.
2013-01-01 12:50:46 -06:00
Augie Fackler
7af5281bfc win32: clean up use of two-argument raise
This makes any attempt to port to Python 3 harder, and the new syntax
is supported in 2.4 already.
2013-01-01 12:50:23 -06:00
Augie Fackler
787a15630a commandserver: clean up use of two-argument raise
This makes any attempt to port to Python 3 harder, and the new syntax
is supported in 2.4 already.
2013-01-01 12:50:04 -06:00
Siddharth Agarwal
2b9ccce531 cmdutil: make getgraphlogrevs limit-aware
For a repository with over 400,000 changesets, this speeds up graphlog with a
small limit by around 0.05 seconds (~50%).
2012-12-28 16:25:12 -08:00
Siddharth Agarwal
aa52ffdc89 cmdutil: stop pretending we can calculate revs for graphlog lazily
cmdutil.getgraphlogrevs does a ton of work trying to build a graphlog lazily,
and then cmdutil.graphlog comes along and destroys all of that.
graphmod.dagwalker requires that it be given the full list of revs upfront so
that it can perform filtering and tests against known revs.

For a repository with over 400,000 changesets, this speeds up graphlog by
around 0.02 seconds (~20% with a small limit).
2012-12-28 16:25:00 -08:00
Siddharth Agarwal
1e67e6753f cmdutil: store a local ref to repo.hiddenrevs in getgraphlogrevs
On a repository with over 400,000 changesets, this speeds graphlog up by
around 0.03 seconds (~20% with a small limit).
2012-12-28 16:24:36 -08:00
Siddharth Agarwal
9302d9c2b3 cmdutil: make getgraphlogrevs return revs in descending order 2012-12-28 14:46:58 -08:00
Pierre-Yves David
4898e4fe72 branchmap: takes filtered revision in account for cache calculation
Tracking tipnode and tiprev is not enough to ensure validaty of the cache as
they do not help distinguish a cache that ignored various revisions below
tiprev.

To detect such difference, we build a hash of all ignored revisions. This hash
is then used when checking the validity of a cache for a repo.
2012-12-31 18:11:18 -06:00
Pierre-Yves David
c5a39ef698 branchmap: improve computation of target tip
With revision filtering the effective revision number of "tip" may be lower than:

    len(changelog) - 1

We now use a more correct version preventing useless writing on disk in some
case.
2012-12-24 02:57:23 +01:00
Pierre-Yves David
186fef84cd branchmap: improve invalid cache message when reading
This factors out the generation of the message. This helps future error reporting
when reading cache for filtered repository.
2012-12-28 00:13:32 +01:00
Pierre-Yves David
bc7f0f7ffa amend: allow amend of non-head when obsolete is enabled
Obsolescence marker can represent this situation just fine. The old
version is marked as precursor of the new changeset. All its
descendants become "unstable".

If obsolescence is not enabled we keep the current behavior of
aborting. This new behavior only applies when obsolete is
enabled and is subject to future discussion and changes.
2012-12-31 17:44:18 -06:00
Pierre-Yves David
1c9929a557 obsolete: factorise troubles detection during push
The use of the two methods introduced earlier allows a factorisation of the
push code preventing push of troubled changeset.
2012-12-21 22:58:59 +01:00
Pierre-Yves David
0571efafd8 obsolete: introduce a troubles method on context
A troubled changeset may be affected by multiple trouble at the same time. This
new method returns a list of all troubles affecting a changes.
2012-12-17 15:17:54 +01:00
Pierre-Yves David
c1a745d834 obsolete: introduce a troubled method on context
Allows to quickly check if a changeset is affected by any troubles.
(troubles are: unstable, bumped and divergent)
2012-12-17 15:06:15 +01:00
Mads Kiilerich
275333d6c9 util: fold ENOENT check into unlinkpath, controlled by new ignoremissing flag
Refactor a common pattern.
2012-12-28 11:55:57 +01:00
Mads Kiilerich
056fcbf2bc merge with stable 2012-12-28 11:55:45 +01:00
Pierre-Yves David
fc633e8922 strip: do not update branchcache during strip (issue3745)
At this moment, the cache is invalid, and will be thrown away.
Later the strip function will call the `localrepo.destroyed` method
that will update the branchmap cache.
2012-12-28 00:02:40 +01:00
Siddharth Agarwal
28f04a41d2 copies: do not track backward copies, only renames (issue3739)
The inverse of a rename is a rename, but the inverse of a copy is not a copy.
Presenting it as such -- in particular, stuffing it into the same dict as real
copies -- causes bugs because other code starts believing the inverse copies
are real.

The only test whose output changes is test-mv-cp-st-diff.t. When a backwards
status -C command is run where a copy is involved, the inverse copy (which was
hitherto presented as a real copy) is no longer displayed.

Keeping track of inverse copies is useful in some situations -- composability
of diffs, for example, since adding "a" followed by an inverse copy "b" to "a"
is equivalent to a rename "b" to "a". However, representing them would require
a more complex data structure than the same dict in which real copies are also
stored.
2012-12-26 15:04:07 -08:00
Siddharth Agarwal
76d4a91eed copies: make debug messages more sensible
The -> in debug messages is currently overloaded to mean both source to dest
and dest to source. To fix this, we add explicit labels and make the arrow
direction consistent.
2012-12-26 15:03:58 -08:00
Siddharth Agarwal
8e266eb31f copies: separate moves via directory renames from explicit copies
Currently the "copy" dict contains both explicit copies/moves made by a
context and pending moves that need to happen because the other context moved
the directory the file was in. For explicit copies, the dict stores a
destination to source map, while for pending moves via directory renames, it
stores a source to destination map. The merge code uses this fact in a non-
obvious way to differentiate between these two cases.

We make this explicit by storing these pending moves in a separate dict. The
dict still has a source to destination map, but that is called out in the
docstring.
2012-12-26 14:50:17 -08:00
Kevin Bullock
4ca92b51d3 merge with stable 2012-12-26 11:16:18 -06:00
Pierre-Yves David
2e407bdb0d branchmap: move validity logic in the object itself
In several place, We check if a branchcache is still valid regarding the current
state of the repository. This changeset puts this logic in a method of the object
that can be reused when necessary.

A branch map is considered valid whenever it is up to date or a strict subset of
the repository state.

The change will help making branchcache aware of filtered revision.

The change in keyword is expected. the branch cache is actually invalid after
the amend. The previous check did not detected it.
2012-12-24 02:49:59 +01:00
Pierre-Yves David
5e4e0ce72d branchmap: make update a method 2012-12-22 17:08:15 +01:00
Pierre-Yves David
3b1070cfe3 branchmap: make update responsible to update the cache key
The update function have all necessary data to keep the branchcache key
up to date with its value.

This saves assignment to the cache key that each caller of update had to do by
hand.

The strip case is a bit more complicated to handles from inside the function but
I do not expect any impact.
2012-12-24 02:22:04 +01:00
Pierre-Yves David
26e77ac183 branchmap: factorise changelog access in update
This both improves readability and performance. Access to changelog of filtered
repository currently have a minor overhead.
2012-12-22 02:11:12 +01:00
Pierre-Yves David
a3a3d2bc58 branchmap: make write a method on the branchmap object 2012-12-20 16:28:43 +01:00
Pierre-Yves David
1bc937448e branchmap: simplify write signature
All necessary data (cache value and key) are now stored in the branchcache
object. Any extra parameter is superfluous.
2012-12-22 02:04:49 +01:00
Pierre-Yves David
9602b376b6 branchmap: add the tiprev (cache key) on the branchmap object
The actual cache key used on disk is the (tipnode, tiprev) pair. There is no
reason not to use the revision number for the in memory version.
2012-12-22 02:06:26 +01:00
Pierre-Yves David
72ccce9263 branchmap: add the tipnode (cache key) on the branchcache object
Gathering data and cache key paves the way to a lot of simplification.
2012-12-22 01:59:05 +01:00
Pierre-Yves David
0b84a3fa35 branchmap: store branchcache in a dedicated object
Value and key of branchcache would benefit from being hold by the same object.
Moreover some logic (update, write, validation) could be move on such object.

The creation of this object is the first step toward this move. The result will
clarify branchcache related code and hide most of the detail in the class
itself. This encapsulation will greatly helps implementation of branchcache for
filtered view of the repo.
2012-12-22 01:44:42 +01:00
Pierre-Yves David
81a9a63850 branchmap: stream_in write remote branchcache to local one
The previous code was writing it to a non existent `branchcache` attribute.  We
now write is to the proper `_branchcache` attribute and initialize the
`_branchcachetip` at the same time.

We keep writing it to disk, the previous code had this part right.
2012-12-22 01:34:23 +01:00
Pierre-Yves David
dc5b484bd1 branchmap: extract updatebranchcache from repo 2012-12-20 14:45:17 +01:00
Pierre-Yves David
0e27877238 branchmap: extract _updatebranchcache from repo 2012-12-19 14:49:06 +01:00
Pierre-Yves David
92d0e6ec35 branchmap: _updatebranchmap does not need to be filtered
The `_updatebranchmap` method on repo does not need to be filtered as all
callers are already handling filtering themself.

The fact it is filtered may had even lead to buggy behaviors, but by chances the method
make very sparse use of the repo object.
2012-12-19 14:47:38 +01:00
Pierre-Yves David
b588a59cfa branchmap: extract read logic from repo 2012-12-19 14:46:57 +01:00
Pierre-Yves David
ef0f47c598 branchmap: extract write logic from localrepo 2012-12-20 13:37:37 +01:00
Pierre-Yves David
83c3a96189 branchmap: create a mercurial.branchmap module
This is the foundation stone for an extraction of branches map logic from local
repository class.  Most of the branches map logic have very few caller and
therefor does not fit in the current criteria for code held by the localrepo
class. Important change will be made to this code in relation with revision
filtering. So we extract it in a dedicated module before adding additional
complexity.


Follow up commit do the actual code movement.
2012-12-19 14:43:33 +01:00
Pierre-Yves David
62e1246b84 bundlerepo: use _cacheabletip mechanism in bundlerepo
Instead of preventing any cache write we allow writing cache for all content of
the original repo.

The motivation for this change is to drop the custom _writebranchcache of
bundlerepo to help extraction of the branchmap logic out of localrepo.
2012-12-20 12:17:44 +01:00
Pierre-Yves David
5587346fea branchmap: merge _branchtags into updatebranchcache
Now that nobody overwrite it, there is no reasons for `_branchtags` to remains
separated from `updatebranchcache`.
2012-12-20 13:23:29 +01:00
Pierre-Yves David
18004c817a branchmap: factorise access to changelog in updatebranchcache
This prepares merge of `updatebranchcache` and `_branchtags`.
2012-12-19 17:39:49 +01:00
Pierre-Yves David
6f3f4215a3 branchmap: simplify _branchtags using a new _cacheabletip method
The current _branchtags method is a remnant of an older, much larger function.
Its only remaining role is to help MQ to alter the version of branchcache we
store on disk. As MQ mutates the repository it ensures persistent cache does not
contain anything it is likely to alter.

This changeset makes explicit the stable vs volatile part of repository and
reduces the MQ specific code to the computation of this limit. The main
_branchtags code now handles this possible limit in all cases.

This will help to extract the branchmap logic from the repository.

The new code of _branchtags is a bit duplicated, but as I expect major
refactoring of this section I'm not keen to setup factorisation function here.
2012-12-20 11:52:50 +01:00
Dirkjan Ochtman
73f0d55371 hook: disable demandimport before importing hooks
This solved an obscure bug for me. In upgrading Distribute on the server, a
patch was added to has a try: import a except ImportError thing that's only
supposed to work with Python 3.3. I'm using 2.7. My hook failed with an
ImportError because of this. It seems kind of sensible to turn off
demandimport before importing the hook, since the except ImportError pattern
is used quite a bit in Python code (including in other Distribute code).
2012-12-20 21:26:30 +01:00
Angel Ezquerra
586f53ce9d subrepo: append subrepo path to subrepo error messages
This change appends the subrepo path to subrepo errors. That is, when there
is an error performing an operation a subrepo, rather than displaying a message
such as:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH!
hint: did you forget to merge? use push -f to force

mercurial will show:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH! (in subrepo MYSUBREPO)
hint: did you forget to merge? use push -f to force

The rationale for this change is that the current error messages make it hard
for TortoiseHg (and similar tools) to tell the user which subrepo caused the
push failure.

The "(in subrepo MYSUBREPO)" message has been added to those subrepo methods
were it made sense (by using a decorator). We avoid appending "(in subrepo XXX)"
multiple times when subrepos are nexted by throwing a "SubrepoAbort" exception
after the extra message is appended. The decorator will then "ignore" (i.e. just
re-raise) the exception and never add the message again.

A small drawback of this method is that part of the exception trace is lost when
the exception is catched and re-raised by the annotatesubrepoerror decorator.

Also, because the state() function already printed the subrepo path when it
threw an error, that error has been changed to avoid duplicating the subrepo
path in the error message.

Note that I have also updated several subrepo related tests to reflect these
changes.
2012-12-13 23:37:53 +01:00
Pierre-Yves David
fa2bc9d633 hidden: invalidate hiddenrevs when needed
The `hiddenrevs` cache is volatile too (It use content from `obscache`). When
unsure it is invalidated when necessary. In a near future, the cache will
probably be moved to `revsfiltercache`
2012-12-18 01:51:08 +01:00
Pierre-Yves David
e3f34c0ee1 cache: group obscache and revsfiltercache invalidation in a single function
Both caches are very volatile and needs invalidation on the same kind of event.
revsfiltercache actually depends on the content of revsfiltercache.
2012-12-18 02:04:37 +01:00
Pierre-Yves David
ad4e0f7344 clfilter: use filtering in visibleheads
This is the second real use of changelog filtering. The change is very small to
allow testing the new filter with a setup close to the original one.

We replace custom post processing on `heads`function by call to the standard
code pass on a filtering repo.

In later coming will have wider usage of filtering that will make the dedicated
function useless.
2012-12-17 17:27:12 +01:00
Pierre-Yves David
33f9591972 clfilter: use filtering in visiblebranchmap
Here is the first real use of changelog filtering. The change is very small to
allow testing the new filter with a setup close to the original one.

We replace custom post processing on branchmap function by call to the
standard code pass on a filtering repo.

In later coming will have wider usage of filtering that will make the dedicated
function useless.
2012-12-17 17:42:34 +01:00
Pierre-Yves David
78f77e2591 clfilter: introduce a "unserver" filtering mode
This mode is for repository used as a server. It filter secret and hidden
changeset out.

It is put to use in later changeset.
2012-12-17 17:12:02 +01:00
Pierre-Yves David
0ea6453a8a clfilter: add a cache on repo for set of revision to filter for a given set.
Recomputing the filtered revisions at every access to changelog is far too
expensive. This changeset introduce a cache for this information. This cache is
hold by the repository (unfiltered repository) and invalidated when necessary.
This cache is not a protected attribute (leading _) because some logic that
invalidate it is not held by the local repo itself.
2012-12-20 17:14:07 +01:00
Pierre-Yves David
4d4c1e240e clfilter: add actual repo filtering mechanism
We add a `filtered` method on repo. This method return an instance of `repoview`
that behaves exactly as the original repository but with a filtered changelog
attribute. Filters are identified by a "name". Planned filter are `unserved`,
`hidden` and `mutable`. Filtering the repository in place what out of question
as it wont not allows multiple thread to share the same repo. It would makes
control of the filtering scope harder too. See the `repoview` docstring for
details.

A mechanism to compute filtered revision is also installed. Some caches will be
installed in later commit.
2012-12-20 15:32:42 +01:00
Bryan O'Sullivan
3a10142595 posix: move server side of unix domain sockets out of inotify
We also turn the unix domain socket into a class, so that we have a
sensible place to hang its logically related attributes and behaviour.

We'll shortly want to reuse this in other code.
2012-12-18 17:15:13 -08:00
Siddharth Agarwal
28d6c979cc localrepo: use lazy ancestor membership testing
For a repository with over 400,000 commits, rebasing one revision near tip,
this avoids two treks up the DAG, speeding the operation up by around 1.6
seconds.
2012-12-17 20:43:37 -08:00
Siddharth Agarwal
4fdbea480f ancestor: add lazy membership testing to lazyancestors
This also makes the perfancestorset command use lazy membership testing. In a
linear repository with over 400,000 commits, without this patch, hg
perfancestorset takes 0.80 seconds no matter how far behind we're looking.
With this patch, hg perfancestorset -- X takes:

    Rev X       Time
       -1      0.00s
    -4000      0.01s
   -20000      0.04s
   -80000      0.17s
  -200000      0.43s
  -300000      0.69s
        0      0.88s

Thus, for revisions close to tip, we're up to several orders of magnitude
faster. At 0 we're around 10% slower.
2012-12-18 12:47:20 -08:00
Siddharth Agarwal
4d560304bb revlog: move ancestor generation out to a new class
This refactoring is to prepare for implementing lazy membership.
2012-12-18 10:14:01 -08:00
Bryan O'Sullivan
7396bcb61d ignore: process hgignore files in deterministic order
Previously, we processed them in whatever order the dict iterator gave us.
2012-12-17 15:57:02 -08:00
Bryan O'Sullivan
b79fd1a32c ignore: only read an ignore file once 2012-12-17 15:52:44 -08:00
Bryan O'Sullivan
09995e8825 ignore: refactor ignore into two functions
This prepares us for eventually being able to hash the list of patterns
in use.
2012-12-17 16:23:37 -08:00
Pierre-Yves David
fe7c7f379e clfilter: fix nodemap usage in getbundle
With the current implementation, `changelog.nodemap` is not filtered. So some
filtered changeset in common are not filtered by `n in nodemap`. This leads to
crash lower in the stack when the bundle generation try to access those node on
a filtered changelog.
2012-12-10 18:12:41 +01:00
Pierre-Yves David
985f5be6c5 clfilter: ensure context raise RepoLookupError when the revision is filtered
Currently the code path of `changectx(filteredrepo, rev)` call
`filteredrepo.changelog.node(rev)`. When `rev` is filtered this raise an
unhandled `IndexError`. This case now raise a `RepoLookupError` as other
error case do.
2012-12-17 18:09:41 +01:00
Siddharth Agarwal
cca6ff3076 revlog: remove incancestors since it is no longer used 2012-12-17 15:08:37 -08:00
Siddharth Agarwal
6d5198a5a3 revlog.ancestors: add support for including revs
This is in preparation for an upcoming refactoring. This also fixes a bug in
incancestors, where if an element of revs was an ancestor of another it would
be generated twice.
2012-12-17 15:13:51 -08:00
Siddharth Agarwal
40a1b50c25 ancestor: move missingancestors doctest out into a separate file
This is in preparation for upcoming patches which will reuse the same graph
for tests.
2012-12-11 14:47:33 -08:00
Kevin Bullock
aaaf5fc704 merge with crew-stable 2012-12-16 23:02:54 -06:00
Kevin Bullock
2deea1b073 commands: 'hg bookmark NAME' should work even with ui.strict=True
Before this patch, enabling strict command processing (ui.strict=True)
meant that 'hg bookmark NAME', as referenced several places in the
documentation, would not work. This adds 'bookmark' as an explicit alias
to 'bookmarks'.
2012-12-16 22:00:38 -06:00
Tim Henigan
31b2db1033 dirstate: remove obsolete comment from setbranch
This comment should have been removed in 9d5893d31db9, when the call
to scmutil.checknewlabel was removed.
2012-11-29 08:44:54 -05:00
Idan Kamara
26e04e85c9 dirstate: don't rename branch file if writing it failed 2012-12-15 20:19:07 +02:00
Matt Mackall
b867b2de5c hgweb: avoid generator exhaustion with branches 2012-12-06 13:21:27 -06:00
Matt Mackall
a671a1cc84 hgweb: fix iterator reuse in atom feed generation 2012-12-05 15:38:18 -06:00
FUJIWARA Katsunori
b81a7802fd subrepo: add argument to "diff()" to pass "ui" of caller side (issue3712) (API)
Color extension achieves colorization by overriding the class of
"ui" object just before command execution.

Before this patch, "diff()" of abstractsubrepo and classes
derived from it has no "ui" argument, so "diff()" of hgsubrepo
uses "self._repo.ui" to invoke "cmdutil.diffordiffstat()".

For separation of configuration between repositories, revision
1498948ee815 changed the initialization source of "self._repo.ui"
from "ui"(overridden) to "baseui"(plain) of parent repository.
And this caused break of colorization.

This patch adds "ui" argument to "diff()" of abstractsubrepo and
classes derived from it to pass "ui" object of caller side.
2012-11-30 00:43:55 +09:00
Tim Henigan
68a1fc4488 update: allow update to existing branches with invalid names (issue3710)
Starting with 049792af94d6, users are no longer able to update a
working copy to a branch named with a "bad" character (such as ':').

Prior to v2.4, it was possible to create branch names using "bad"
characters, so this breaks backwards compatibility.

Mercurial must allow users to update to existing branches with bad
names.  However, it should continue to prevent the creation of new
branches with bad names.

A test was added to confirm that 'hg update' works as expected. The
test uses a bundled repo that was created with an earlier version of
Mercurial.
2012-11-27 08:47:35 -05:00
Pierre-Yves David
292c83cd65 command: remove phase from the list of basic command
This is not a basic command. There is no reason new user should needs to know
about it. Thanks to Matt Mackall for pointing this.
2012-11-28 11:20:56 +01:00
André Sintzoff
94ef5e50d6 phases: fix missing "error" module import (issue3707) 2012-11-25 20:39:37 +01:00
Matt Mackall
1c34c93b25 hooks: be even more forgiven of non-fd descriptors (issue3711)
Looks like there are instances where sys.stdout/stderr contain file
handles that are invalid. We should be tolerant of this for hook I/O
redirection, as our primary concern is not garbling our own output stream.
2012-11-26 17:48:39 -06:00
Matt Mackall
c6fe65e9e2 hooks: delay I/O redirection until we actually run a hook (issue3711)
We were attempting to redirect I/O even if no hook was actually
getting called. This defers redirection until we've found something to
do.
2012-11-26 16:14:22 -06:00
Matt Mackall
af5b4b62cf util: make chunkbuffer non-quadratic on Windows
The old str-based += collector performed very nicely on Linux, but
turns out to be quadratically expensive on Windows, causing
chunkbuffer to dominate in profiles.

This list-based version has been measured to significantly improve
performance with large chunks on Windows, with negligible overall
overhead on Linux (though microbenchmarks show it to be about 50% slower).

This may increase memory overhead where += didn't behave quadratically. If we
want to gather up 1G of data to join, we temporarily have 1G in our
list and 1G in our string.
2012-11-26 15:42:52 -06:00
Matt Mackall
d4deebc4f7 revset: backed out changeset 7a8dc9a35aa2
This was causing clones of the hg repo to go from 12.4s to 14.7s.
2012-11-26 13:44:11 -06:00
Durham Goode
6a6b8c49d1 commit: increase perf by avoiding checks against entire repo subsets
When commiting to a repo with lots of history (>400000 changesets)
checking the results of revset.py:descendants against the subset takes
some time.  Since the subset equals the entire changelog, the check
isn't necessary.  Avoiding it in that case saves 0.1 seconds off of
a 1.78 second commit. A 6% gain.

We use the length of the subset to determine if it is the entire repo.
There is precedence for this in revset.py:stringset.
2012-11-16 15:39:12 -08:00
Durham Goode
cce0517fb6 commit: increase perf by avoiding unnecessary filteredrevs check
When commiting to a repo with lots of history (>400000 changesets)
the filteredrevs check (added with 373606589de5) in changelog.py
takes a bit of time even if the filteredrevs set is empty. Skipping
the check in that case shaves 0.36 seconds off a 2.14 second commit.
A 17% gain.
2012-11-16 15:39:12 -08:00
Kevin Bullock
b676337ab7 grep: remove useless while condition
A revised version of 51ea4dcf1448 was sent to the list that fixed this
<http://markmail.org/message/jmfuiise5igcyh2m>, but the older version of
the patch was applied.
2012-11-15 11:27:30 -06:00
Idan Kamara
4ae64fdb03 grep: don't search past the end of the searched string
'*' causes the resulting RE to match 0 or more repetitions of the preceding RE:

>>> bool(re.search('.*', ''))
>>> True

This causes an infinite loop because currently we're only checking if there was
a match without looking at where we are in the searched string.
2012-11-12 19:27:03 +02:00
Pierre-Yves David
cc961a38fb amend: force editor only if old message is reused (issue3698)
This regression was added by 435d13b1e757. It triggered the editor even if
--message or --logfile were provided.
2012-11-13 08:41:56 -08:00
Pierre-Yves David
2038eca723 obsolete: refuse to push divergent changeset
As other troubles `unstable` and `bumped`. Followup patches may simplify the
push code with unification of "obsolescence troubles" handling.
2012-11-10 02:19:20 +01:00
Pierre-Yves David
38afff41e0 obsolete: add a divergent method on context
The same we have `unstable` and `bumped`. Convenient method to access troubles
information in general may land later.

This get actual use and testing in the next changesets.
2012-12-12 03:20:49 +01:00
Pierre-Yves David
f3faf259c5 obsolete: add revset and test for divergent changesets
This changesets add a new `divergent()` revset similar to `unstable()` and
`bumped()` one. Introducting this revset allows actuall test of the divergent
detection.
2012-12-12 03:12:55 +01:00
Pierre-Yves David
5f44f3518f obsolete: detect divergent changesets
Divergent changeset are final successors (non obsolete) of a changeset who
compete with another set of final successors for this same changeset.

For example if you have two obsolescence markers A -> B and A -> C, B and C are
both "divergent" because they compete to be the one true successors of A.

Public revision can't be divergent.

This function is used and tested in the next changeset.
2012-12-12 03:19:30 +01:00
Pierre-Yves David
70d5b32616 obsolete: drop successors sets which are subset of another one
If both "(B,)" and "(B, C)" are successors set of "A", "(B,)" is dropped.
We won't be interrested in detection such divergence scenario.
2012-11-10 01:56:59 +01:00
Pierre-Yves David
da22110fc6 obsolete: compute successors set
Successors set are an important part of obsolescence. It is necessary to detect
and solve divergence situation. This changeset add a core function to compute
them, a debug command to audit them and solid test on the concept.

Check function docstring for details about the concept.
2012-12-13 15:38:43 +01:00
Siddharth Agarwal
86e87e5ede revset.children: ignore rev numbers that are too low
This replaces unnecessary parentrevs() calls with calculating min(parentset).
Even though the min operation is O(size of parentset), since parentrevs is
relatively expensive, this tradeoff almost always works in our favour. In a
repository with over 400,000 changesets, hg perfrevset "children(X)" takes:

       Set X       Before    After
       -1           0.51s    0.06s
    -1000:          0.55s    0.08s
   -10000:          0.56s    0.10s
  -100000:          0.60s    0.25s
  -100000:-99000    0.55s    0.19s
        0:100000    0.60s    0.61s
      all()         0.72s    0.74s

The relative performance is similar for Mercurial's own repository -- several
times faster in most cases, slightly slower for revisions close to 0 and
all().
2012-12-07 10:37:43 -08:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Mads Kiilerich
00be1ef6f3 rm: drop misleading 'use -f' hint for the rm --after 'not removing' warning
A warning mentioning 'forgetting' or 'recording delete' would be more correct
than 'not removing' but also more confusing.
2012-12-09 23:33:16 +01:00
Angel Ezquerra
d3a4755c75 hgwebdir: do not show RSS and Atom links for plain directories
Up until now the templates that show RSS and Atom feeds on the "repository
lists" (i.e. gitweb and monoblue) showed them for all entries, including regular
folders. Clicking on those "folder RSS" links would result in an error page
being shown.

This patch hides those links for regular folders.
2012-11-27 22:24:02 +01:00
Angel Ezquerra
689bb15da1 hgweb: add branches RSS and Atom feeds
There were no RSS nor Atom feeds for the branches page. Different hgweb
templates linked to different feeds on their branches page (some linked to the
tags feed, some to the log feed and some to the unexisting branches feed).
2012-12-04 00:37:50 +01:00
Kevin Bullock
1ff9eb737c push: reunite comment with the line of code it describes 2012-12-07 12:03:37 -06:00
Kevin Bullock
2ad73cfc74 bookmarks: spelling correction in docstring 2012-12-07 11:30:38 -06:00
Kevin Bullock
9fbb5bfee2 merge: fix mistake in moved _checkcollision call from 9d2a09d53599 2012-12-06 22:07:44 -06:00
Matt Mackall
2e6f376926 windows: correctly pass a mode to S_IFMT in statfiles 2012-12-06 16:56:44 -06:00
Siddharth Agarwal
e9b46fad5b strip: make query to get new bookmark target cheaper
The current query to get the new bookmark target for stripped revisions
involves multiple walks up the DAG, and is really expensive, taking over 2.5
seconds on a repository with over 400,000 changesets even if just one
changeset is being stripped.

A slightly simplified version of the current query is

max(heads(::<tostrip> - <tostrip>))

We make two observations here.

1. For any set s, max(heads(s)) == max(s). That is because revision numbers
   define a topological order, so that the element with the highest revision
   number in s will not have any children in s.

2. For any set s, max(::s - s) == max(parents(s) - s). In other words, the
   ancestor of s with the highest revision number not in s is a parent of one
   of the revs in s. Why? Because if it were an ancestor but not a parent of s,
   it would have a descendant that would be a parent of s. This descendant
   would have a higher revision number, leading to a contradiction.

Combining these two observations, we rewrite the revset query as

max(parents(<tostrip>) - <tostrip>)

The time complexity is now linear in the number of changesets being stripped.
For the above repository, the query now takes 0.1 seconds when one changeset
is stripped. This speeds up operations that use repair.strip, like the rebase
and strip commands.
2012-12-05 14:33:15 -08:00
David Schleimer
8fe2e0bb30 graft: explicit current node tracking
This changes graft to explicitly track the progression of commits it
makes, and updates it's idea of the current node based on it's last
commit, rather than from the working copy parent.  This should have no
effect on the value of current since we were reading the working copy
parent immediately after commiting to it.

The motivation for this change is that a subsequent patch will break
the current node and working copy relationship.  Splitting this out
into a separate patch will make that one more readible.
2012-12-04 12:54:18 -08:00
David Schleimer
63ae483369 graft: move commit info building
This moves the logic for generating the commit metadata ahead of the
merge operation.  The only purposae of this patch is to make
subsequent patches easier to read, and there should be no behavior
changes.
2012-12-04 12:54:18 -08:00
Matt Mackall
af1b0b230f merge with stable 2012-12-06 16:42:15 -06:00
David Schleimer
3dbabdb2fc merge: support calculating merge actions against non-working contexts
This is not currently used.  It is instead a pre-requisite to
performing non-conflicting grafts in memory, which a subsequent patch
will do.
2012-12-04 12:54:18 -08:00
David Schleimer
00a1d6a1fe merge: refactor action calculation into function
This pulls the code used to calculate the changes that need to happen
during merge.update() into a separate function.  This is not useful on
its own, but is instead preparatory to performing grafts in memory
when there are no potential conflicts.
2012-12-04 12:54:18 -08:00
Siddharth Agarwal
cb69b98e9b dirstate: inline more properties and methods in status
hg perfstatus -u on a working directory with 170,000 files, without this
change:
! wall 1.839561 comb 1.830000 user 1.120000 sys 0.710000 (best of 6)

With this change:
! wall 1.804222 comb 1.790000 user 1.140000 sys 0.650000 (best of 6)

hg perfstatus on the same directory, without this change:
! wall 1.016609 comb 1.020000 user 0.670000 sys 0.350000 (best of 10)

With this change:
! wall 0.985573 comb 0.980000 user 0.650000 sys 0.330000 (best of 10)
2012-12-03 14:21:45 -08:00
Siddharth Agarwal
40de7ddbeb dirstate: test normalize is truthy instead of using a no-op lambda
hg perfstatus -u on a working directory with 170,000 files, without this
change:
! wall 1.869404 comb 1.850000 user 1.170000 sys 0.680000 (best of 6)

With this change:
! wall 1.839561 comb 1.830000 user 1.120000 sys 0.710000 (best of 6)
2012-12-04 10:29:18 -08:00
Kevin Bullock
e8ece086e3 merge with stable 2012-12-04 11:19:32 -06:00
Bryan O'Sullivan
48cad1b73b osutil: tab damage, how i hate thee 2012-12-03 13:17:01 -08:00
Bryan O'Sullivan
58c82f12c9 osutil: write a C implementation of statfiles for unix
This makes a big difference to performance.

In a clean working directory containing 170,000 files, performance of
"hg --time diff" improves from 2.38 seconds to 1.69.
2012-12-03 12:40:24 -08:00
Bryan O'Sullivan
7be204f3cf osutil: fix tab damage 2012-11-30 17:40:11 -08:00
Bryan O'Sullivan
9e6c16981b Merge with crew 2012-11-30 15:56:09 -08:00
Bryan O'Sullivan
6b3dd5248e osutil: factor out creation and init of listdir_stat 2012-11-30 15:55:09 -08:00
Bryan O'Sullivan
09d0142d5e dirstate: avoid use of zip on big lists
In a clean working directory containing 170,000 tracked files, this
improves performance of "hg --time diff" from 1.69 seconds to 1.43.

This idea is due to Siddharth Agarwal.
2012-11-30 15:55:08 -08:00
Bryan O'Sullivan
a288702cfd dirstate: move file type filtering to its source
This prepares us to move to a much faster statfiles implementation on Unix.
2012-11-30 15:55:07 -08:00
Pierre-Yves David
5ccc6bfa9a clfilter: rename unfilteredmeth to unfilteredmethod
As originally intended.
2012-11-30 22:34:21 +01:00
Adrian Buehlmann
b5e726b312 openpath: specify binary mode and use util.posixfile
follow-up to aa655773f574
2012-11-01 13:46:03 +01:00
Simon Heimberg
b731b379ec subrepo: only do clean update when overwrite is set (issue3276)
Files in a subrepo were overwritten on update. But this should only happen on a
clean update (example: -C is specified).
Use the overwrite parameter introduced for svn subrepos in e3640daa4703 to
decide whether to merge changes (as update) or remove them (as clean).

The new function hg.updaterepo is intruduced to keep all update calls in hg.

test-subrepo.t is extended to test if an untracked file is overwritten
(issue3276). (Update -C is already tested in many places.)
The first two chunks are debugging output which has changed. (Because overwrite
is not always true anymore for subrepos)
All other tests still pass without any change.
2012-10-24 18:45:22 +02:00
FUJIWARA Katsunori
f05ff4243c i18n: add "i18n" comment to column positioning messages of "hg summary"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:28 +09:00
FUJIWARA Katsunori
ff00b9869d i18n: add "i18n" comment to column positioning messages of "hg log"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:27 +09:00
FUJIWARA Katsunori
78e9fa90ae i18n: add "i18n" comment to error messages of template functions 2012-10-31 03:59:27 +09:00
FUJIWARA Katsunori
2cf8855a64 icasefs: make case-folding collision detection as deletion aware (issue3648)
Before this patch, case-folding collision is checked simply between
manifests of each merged revisions.

So, files may be considered as colliding each other, even though one
of them is already deleted on one of merged branches: in such case,
merge causes deleting it, so case-folding collision doesn't occur.

This patch checks whether both of files colliding each other still
remain after merge or not, and ignores collision if at least one of
them is deleted by merge.

In the case that one of colliding files is deleted on one of merged
branches and changed on another, file is considered to still remain
after merge, even though it may be deleted by merge, if "deleting" of
it is chosen in "manifestmerge()".

This avoids fail to merge by case-folding collisions after choices
from "changing" and "deleting" of files.

This patch adds only tests for "removed remotely" code paths in
"_remains()", because other ones are tested by existing tests in
"test-casecollision-merge.t".
2012-10-31 16:50:22 +09:00
Siddharth Agarwal
acc48ffd83 url: use open and not url.open for local files (issue3624) 2012-10-17 21:30:08 -07:00
Matt Mackall
e56ab4a814 revset: accept @ in unquoted symbols (issue3686) 2012-10-30 18:48:44 -05:00