Commit Graph

25375 Commits

Author SHA1 Message Date
Martin von Zweigbergk
468a7b8172 changegroup: don't use 'repo' for non-repo 'self'
'repo' is a very confusing name to use for 'self', especially when
it's not a repo. Also drop repo.ui member (a.k.a. self.ui) now that
'self' doesn't shadow outer 'repo' variable.
2015-06-12 10:54:10 -07:00
Matt Harbison
61135ed1ee subrepo: introduce hgsubrepo._getctx()
This code is already used in a couple of places, and will need to be used in
others where wdir() support is needed.  Trying to get the wdir() revision stored
in self._substate[1] when creating the object in subrepo.subrepo() resulted in
breaking various status and diff tests.  This is a far less invasive change.
2015-06-14 21:51:57 -04:00
Matt Harbison
5becc4c86f convert: apply the appropriate phases to the destination (issue4165)
If the conversion doesn't change the hash, and the cset is public in the source,
it should be public in the destination.  (This can happen if file remapping is
done that doesn't affect the initial commits.)  This also propagates the secret
phase from the source, regardless of the hash, because presumably the content is
what is secret.  Otherwise, the destination commit stays in the draft phase.

Maybe any draft cset with an unchanged hash should be changed to public, because
it has effectively been shared, but convert pretty strongly implies throwing
away (or at least readonly archiving) the source repo.

The change in the rollback output is because the name of the outer transaction
is now 'convert', which seems more accurate.  Unfortunately, the memctx won't
indicate the hash prior to committing, so the proper phase can't be applied with
the commit.

The repo is already write locked in mercurial_sink.before().
2015-06-14 13:08:11 -04:00
Matt Harbison
a1e5ef1d56 convert: always track the hg source revision in the internal commit object
This will be needed in the next patch to determine if phases need to be
adjusted.  The insertion of the source revision in 'extras{}' is still
controlled by the config property.
2015-06-14 13:04:00 -04:00
Laurent Charignon
887ad23366 repoview: invalidate 'visible' filtered revisions when bookmarks change
Context: the result of computehidden, used to compute the 'visible' revisions
is cached. Its output can change when:
1) new obsolete commits are created
2) new bookmarks are created or deleted
3) new tags are created or deleted
4) the parents of the working copy change

We currently correctly invalidate the cache only in the case 1).
This patch fixes the second case (bookmarks) by invalidating the cache once
a bookmark is added or removed.
2015-06-13 00:51:43 -07:00
Matt Harbison
1378c4e950 ui: flush stderr after printing a non-chained exception for Windows
There were consistent test failures in test-bad-extension.t, because Windows
buffers stderr when redirected to a file (per the comment in ui.write_err()).
That resulted in failures like this:

  --- c:/Users/Matt/Projects/hg/tests/test-bad-extension.t
  +++ c:/Users/Matt/Projects/hg/tests/test-bad-extension.t.err
  @@ -23,11 +23,11 @@
     Traceback (most recent call last):
     Exception: bit bucket overflow
     *** failed to import extension badext2: No module named badext2
  -  Traceback (most recent call last):
  -  ImportError: No module named badext2
     hg help [-ec] [TOPIC]

     show help for a given topic or a help overview
  +  Traceback (most recent call last):
  +  ImportError: No module named badext2

   show traceback for ImportError of hgext.name if debug is set
   (note that --debug option isn't applied yet when loading extensions)

Instead of inserting another flush immediately after the print, to go along with
the one recently added prior to the print (see 3cd72de3be66), funnel the output
through ui.write_err().  The flush prior to printing the traceback only mentions
that stdout needs to be flushed, and only stderr needs to be flushed after
printing the traceback.  ui.write_err() does both for us without needing to
redocument the quirky Windows behavior.  It will also clear any progress bar.
2015-06-12 22:09:41 -04:00
Pierre-Yves David
48aa2b29f7 revset: use parentsets.min in _children
As stated in the comment, using the smartset 'min' will give more opportunity to
be smart. It give a small but significant boost to the performance. Most of the
time is still spend doing the actual computation but at least we can scrap some
performance when it makes sense.

revset #0: roots(0:tip)
   plain
0) 0.046600
1) 0.044109  94%
2015-06-11 19:02:24 -07:00
Pierre-Yves David
ae45bb4c69 revset: prefetch all attributes before loop in _revsbetween
Python is slow at attributes lookup. No, really, I mean -slow-. prefetching
these three methods give use a measurable performance boost.

revset #0: 0::tip
   plain
0) 0.037655
1) 0.034290  91%
2015-06-11 11:42:46 -07:00
Pierre-Yves David
ff7d1b0e92 hgweb: add some in-code documentation for 'web.view'
This documentation was mostly intended for the user helps. However given the
lack of request for such feature, we should keep it un-documented. We stick the
help text in the code as it could still be useful to fellow contributors.
2013-02-07 00:32:26 +00:00
Pierre-Yves David
e4e6aeb80c bookmark: informs of failure to upgrade a bookmark
When we explicitly requested to update a bookmark but the bookmark location was
missing locally, we used to silently ignore the case. We now issue a message
about it to point that something wrong is going on.

By chance, we fixed all the cases where is case happened (for explicit pulling
only, issue4700 is still open). But I think it is still valuable to have a
warning in place in case such issue is reintroduced.

This patch have been tested against issue4689 test (but without issue4689 fix).
It give the better but expected failure seen below:

> --- /home/pyd/src/mercurial-dev/tests/test-bookmarks-pushpull.t
> +++ /home/pyd/src/mercurial-dev/tests/test-bookmarks-pushpull.t.err
> @@ -337,12 +337,12 @@
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files
> -  updating bookmark Y
> +  remote bookmark Y point to locally missing 0d60821d2197
>    (run 'hg update' to get a working copy)
>    $ hg book
>     * @                         1:0d2164f0ce0d
>       X                         1:0d2164f0ce0d
> -     Y                         5:35d1ef0a8d1b
> +     Y                         4:b0a5eff05604
>       Z                         1:0d2164f0ce0d
>
>  Update a bookmark right after the initial lookup -r (issue4700)
> @@ -387,12 +387,11 @@
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files
> -  updating bookmark Y
>    (run 'hg update' to get a working copy)
>    $ hg book
>     * @                         1:0d2164f0ce0d
>       X                         1:0d2164f0ce0d
> -     Y                         6:0d60821d2197
> +     Y                         4:b0a5eff05604
>       Z                         1:0d2164f0ce0d
>    $ hg -R $TESTTMP/pull-race book
>       @                         1:0d2164f0ce0d
2015-06-11 17:19:48 -07:00
introom
f388c9f791 fancyopts: allow all callable as default parameter value
The current fancyopts allows function as default parameter value
but not other callables.
By supporting other callables, we can have the benefits of e.g.,
custom __str__ method, which will be printed by 'hg help' as
the default value.
2015-06-11 08:54:24 -04:00
Matt Harbison
c3c21b7f9c largefiles: restore the original converter class after lfconvert --to-normal
Not sure how much this really matters, but much of the largefiles code that
monkey-patches like this restores things when it finishes.
2015-06-12 16:11:42 -04:00
Pierre-Yves David
dea1de453c push: only say we are trying to push obsmarkers when we actually try
The message was issued unconditionally. Move it inside the `if` that actually
tries to push obsmarkers.
2015-06-11 13:02:21 -07:00
Matt Harbison
ff48d6b214 convert: support incremental conversion with hg subrepos
This was implied in issue3486, which specifically asked for subrepo support in
lfconvert.  Now that lfconvert uses the convert extension internally when going
to normal files, the issue is half fixed.  But now even non largefile repos
benefit when other transformations are needed.

Supporting a full subrepo tree conversion from a single command doesn't seem
reasonable, given the number of options that can be provided, and the
transformations that would need to occur when entering a subrepo (consider
'filemap' paths).  Instead, this allows the user to incrementally convert each
hg subrepo from bottom up like so:

  # so convert knows the dest type when it sees a non empty dest dir
  $ hg init converted

  $ hg convert orig/sub1 converted/sub1
  $ hg convert orig/sub2 converted/sub2
  $ hg convert orig converted

This allows different options to be applied to different subrepos more readily.
It assumes the shamap is in the default location in each converted subrepo for
simplicity.  It also allows for a subrepo to be cloned into place, in case _it_
doesn't need a conversion.  I was able to convert away from using
largefiles/bfiles in several subrepos with this mechanism.
2015-05-29 13:25:34 -04:00
Laurent Charignon
05537e0c0f crecord: exit edition of hunk with non-zero status does not interrupt session
Before this patch, when editing a hunk, if the editor was exiting with a non-
zero status the crecord session would be aborted. This patch makes crecord
handle the failure and goes back to the state before the failed edition.
We use the new error reporting mechanism introduced in the previous patch to
notify the user of the issue.
2015-06-05 13:41:14 -07:00
Laurent Charignon
9a5e2d91be crecord: add mechanism for error reporting
Before this patch, there was no way to report errors in the crecord ui.
This patch introduces a new variable errorstr. If set, its content replaces the
top banner displayed in crecord until a key is pressed.
2015-06-05 13:53:49 -07:00
Laurent Charignon
b472b09bc6 crecord: extract ui refresh code after editing of hunk in a function
This is useful to reuse the logic to implement the continuation of the crecord
session if the user edits a hunk and the editor exits with a non-zero status.
2015-06-05 13:32:52 -07:00
Pierre-Yves David
062add8bae revset: mark spots that use 'set' instead of 'smartset'
Using smartset is better because we can do more optimisation on it. So we are
marking the faulty spot for later processing.
2015-06-11 15:45:02 -07:00
Pierre-Yves David
fb5a589cc8 revset: mark spot that feeds a set to a baseset
Sets have non-defined order and this should break stuff, but as we are lucky
fullreposet is also broken so the result is "not too bad".

We should fix it anyway, but it is too much for my current plate.
2015-06-11 15:43:11 -07:00
Pierre-Yves David
f5b6e24d29 revset: mark the fact we should use '&' instead of 'filter' in 'head'
I do not have time to fix all this now, let's mark it for later.
2015-06-11 15:37:17 -07:00
Pierre-Yves David
b62dbb27c2 revset: gratuitous formating fix in keyword
You will be aligned.
2015-06-11 15:36:03 -07:00
Pierre-Yves David
eb81242d78 revset: gratuitous code move in '_children'
As 'cs' is empty as the time of the conditional, we can just return an empty
'baseset' and create the variable later.
2015-06-11 14:27:52 -07:00
Pierre-Yves David
64a4e299bb revset: mark spots that should use 'smartset.min()'
Using smartset's min will be significantly faster when the input set can provided
an optimised answer. I do not have time to fix all of them but I'm marking the
spot.
2015-06-11 14:26:44 -07:00
Pierre-Yves David
53bc8a61ba revset: mark the place where we are combining sets in the wrong direction
We should always combine with subset as the left operand (to preserve the
order). I do not have time to fix all of them so I'm just marking the spot.
2015-06-11 14:21:21 -07:00
Pierre-Yves David
9bcc184424 revset: point out wrong behavior in fullreposet
I cannot fix all issues in revset because I've got other things to do,
but let's write down all the brokenness to help other people reading
and fixing.
2015-06-11 14:00:13 -07:00
Pierre-Yves David
a58cb283b6 revsetbenchmarks: also display tag when printing a revision
This is usually more useful information than the commit message.
2015-06-10 17:33:57 -07:00
Pierre-Yves David
86d12c3327 revsetbenchmarks: clean up revsets that achieved with default variants
We remove revset making use of min and max as this is covered by the variants.
We could use variant for roots too, but it is not in the default so keep it
here.
2014-10-27 13:40:12 +01:00
Pierre-Yves David
4bf2a1c663 revsetbenchmarks: use combination variants in default set
Now that we have them, let's make use of them.
2015-06-09 23:49:07 -07:00
Pierre-Yves David
1a88814277 revsetbenchmarks: support combining variants with "+"
We need more advanced variants in some cases. For example, "The last
rev of the sorted version".

We introduce a syntax for this: `reverse+last` means `last(reverse(REVSET))`.
2015-06-09 23:45:34 -07:00
Pierre-Yves David
6f731a872c revsetbenchmarks: use many more variants by default
So far the variants feature was introduced, but not used by
default. We now use a set of basic variants by default.
2015-06-09 21:10:44 -07:00
Pierre-Yves David
3e785ae2da revsetbenchmarks: display even more compact timing result
We now use an 8 char display for timing (from 10), we add some logic to drop
precision if the number grows too large (as we do not care about sub-0 digit
in this case). This allow to pack more variants in a single screen.
2015-06-09 21:20:54 -07:00
Pierre-Yves David
abd025e2f3 revsetbenchmarks: allow running multiple variants per revset
The current benchmarks were only testing the whole iteration. This is suboptimal
because some changes are meaningful for things like first result, minimum or
sorting.

We introduce a "variants" feature that let you systematically add some variants
to all revsets tested.

A typical variants value would be 'plain,min,last,sort'. When testing 'all()' it
will also provide testing for:
- all()
- min(all())
- last(all())
- sort(sort)

and output:

   plain         min            last           sort
0) 0.034568      0.037857       0.000074       0.034238
1) 0.011358  32% 0.020181  53%  0.000080 108%  0.011405  33%

Using revsets (who hit the API) instead of the internal API add some overhead,
but the overhead should be the same everywhere so it still allow comparison.
This is is more simple to implement and allows comparison with older versions
who do not have the same API.
2014-10-27 11:59:39 +01:00
Pierre-Yves David
dd891bab9c revsetbenchmarks: display relative change when meaningful
If the time difference is more than 5% from the previous run, we'll display
relative information. This makes it much simpler to spot performance changes in
a sea of benchmarks.
2015-06-09 21:30:04 -07:00
Pierre-Yves David
c7c66491f5 revsetbenchmarks: improve revision printing
We now print the revision number and short hash inline. As a result we drop the
crappy list printing.
2015-06-09 18:53:04 -07:00
Pierre-Yves David
e5f0537065 revsetbenchmarks: hide most timing under a --verbose flag
We mostly only care about total time. Dropping this output give us some room to
display more useful information (like percentage different) in future
changesets.
2015-06-09 18:40:06 -07:00
Pierre-Yves David
f130bcfaa1 revsetbenchmarks: drop outdated comment
We are no longer testing against system mercurial for quite some time.
2015-06-09 18:32:47 -07:00
Pierre-Yves David
d6c409833b revsetbenchmarks: fix argument parsing
The file doc was saying something, the code was doing something else, the
argument validation was doing a third thing.

Doc and behavior now comply with the argument defined in the code.
2015-06-09 18:39:55 -07:00
Pierre-Yves David
3f8df9e038 revsetbenchmarks: use a more compact output format with a header
We change the output from:

  revset #0: draft()
  0) wall 0.011989 comb 0.010000 user 0.000000 sys 0.010000 (best of 177)
  1) wall 0.012226 comb 0.010000 user 0.000000 sys 0.010000 (best of 193)
  2) wall 0.011838 comb 0.020000 user 0.000000 sys 0.020000 (best of 208)

to:

  revset #0: draft()
       wall       comb       user       sys       count
  0)   0.012028   0.010000   0.000000   0.010000    170
  1)   0.012218   0.010000   0.000000   0.010000    157
  2)   0.012622   0.010000   0.000000   0.010000    189

This opens the road to more useful output.
2015-06-09 17:15:48 -07:00
Augie Fackler
ada9978856 revsetbenchmarks: clarify comment based on irc discussion 2015-06-12 16:42:07 -04:00
Pierre-Yves David
59a81fd7b3 revsetbenchmarks: ensure all indexes have the same width
This avoids an alignment glitch.
2015-06-11 10:55:02 -07:00
Pierre-Yves David
1cc4521b8c revsetbenchmarks: factor out result output into a function
This will make update of the output easier.
2015-06-09 16:57:18 -07:00
Pierre-Yves David
db08ff2e74 revsetbenchmarks: parse perfrevset output into actual number
We cannot just ask perfrevset to provide debug output because we usually want
to compare output from old version of Mercurial that do not support it. So, we
are using a regular expression.

(/we now have \d problems/).
2015-06-09 16:48:29 -07:00
Pierre-Yves David
bb398f89a5 revsetbenchmarks: improve error output in case of failure
This helps with diagnostics.
2015-06-09 15:58:48 -07:00
Pierre-Yves David
d9d7ac3a22 revsetbenchmarks: extract call to mercurial into a function
This is a gratuitous change to make the code easier to look at.
2015-06-09 15:49:14 -07:00
Pierre-Yves David
d82568c62e phases: really fix native phase computation
For some reason (probably rebase issue, leprechaun or badly resolved .rej)
4d2ffbaf1d5d contains only half of the emailed patches and do not fix the bug.
This patch adds the other half and enable the sweet native computation for real.

As expected this provide massive speedup along the board.

revset #0: not public()
   plain         first
0) 0.011960      0.010523
1) 0.000465   3% 0.000492   4%

revset #1: (tip~1000::) - public()
   plain         first
0) 0.025700      0.025169
1) 0.002864  11% 0.001899   7%

revset #2: not public() and branch("default")
   plain         first
0) 0.022842      0.020863
1) 0.011418  49% 0.010948   52%

However, it has a less impact (even bad) on first result time in simple
situation.  This comes from the overhead of building the set and filtering it.
This is especially true on my Mercurial repository (used here) where about 1/3
of the changesets are non public and hidden. This could be mitigated by a
caching of the set and a better usage of smartset in '_notpublic'. (But this
won't happen in this patch because the win is massive everywhere else).

revset #0: not public()
   last
0) 0.000081
1) 0.000493 x6.1 <-- bad impact

revset #1: (tip~1000::) - public()
   last
0) 0.013966
1) 0.002737  19%

revset #2: not public() and branch("default")
   last
0) 0.011021
1) 0.011038

The effect mostly disappear when the number of non-public changesets is small
and/or the repo get bigger. Result for Mozilla central:

Mozilla

revset #0: not public()
   plain         first         last
0) 0.092787      0.084094      0.000080
1) 0.000054   0% 0.000083   0% 0.000083

revset #1: (tip~1000::) - public()
   plain         first         last
0) 0.215607      0.183996      0.124962
1) 0.031620  14% 0.006616   3% 0.031168  24%

revset #2: not public() and branch("default")
   plain         first         last
0) 0.092626      0.082687      0.000162
1) 0.000139   0% 0.000165   0% 0.000167
2015-06-10 19:26:16 -07:00
Anton Shestakov
ad43ca849f hgweb: don't point file links at tip hash where it doesn't make sense
Some pages, e.g. bookmarks, help and summary don't have a meaningful revision
context: they always either show information about tip or about the whole repo
(and not about any specific changeset). And error pages can just show hgweb
error messages, not related to any repo or changeset.

Having a hash in the links worked (even when '{node|short}' resolved to an
empty string on error pages), but seeing pages without revision context provide
links with hashes is a bit confusing (unless you keep current tip hash in your
head at all times) and not consistent with other template styles and other
links on the same page: they don't have a hash.

Let's just link to '/file', which is equal to '/file/tip'.
2015-06-12 18:34:10 +08:00
Anton Shestakov
4687d63f4f hgweb: don't point graph links at tip hash where it doesn't make sense
Some pages, e.g. bookmarks, help and summary don't have a meaningful revision
context: they always either show information about tip or about the whole repo
(and not about any specific changeset). And error pages can just show hgweb
error messages, not related to any repo or changeset.

When monoblue style was added in f9c487618909, however, all graph links had
tried to point at some hash, and on such pages as described above it didn't
make sense. On error pages '{node|short}' is empty string anyway.

Of course, it worked, but seeing such pages without revision context provide
links with hashes is a bit confusing (unless you keep current tip hash in your
head at all times) and wasn't consistent with other template styles, other
pages in monoblue and even other links on the same page.

Let's just link to '/graph', which is equal to '/graph/tip'.
2015-06-12 16:09:59 +08:00
Anton Shestakov
f6202490e9 hgweb: put help link in paper/search.tmpl separately for consistency
Just a cosmetic markup change, no .css changes required.
2015-06-12 15:29:12 +08:00
Pierre-Yves David
cb27f72a61 help: use 'color' as an example (instead of 'progress')
Progress is now deprecated, using it as an example is suboptimal.
2015-06-11 00:26:06 -07:00
Pierre-Yves David
92e8fb7619 progress: deprecate the progress extension
Activating it is a absolute no-op now.
2015-06-08 01:01:21 -07:00