Commit Graph

14198 Commits

Author SHA1 Message Date
Gregory Szorc
0648c6a2bf bundle2: reword debug message for invalid .hgtags data
marmoute requested a follow-up to make the verb the first word.
2015-06-20 18:03:38 -07:00
Pierre-Yves David
0cb42d22dd bundle2.getunbundler: rename "header" to "magicstring"
This is more consistent with the name used in the bundler class. Thanks goes to
Martin von Zweigbergk for pointing this out.
2015-04-07 14:14:27 -07:00
Pierre-Yves David
49a86d13a5 ancestors: prefetch method outside of the loop
7d2ae1be8bad is yet another example where this is worthwhile when it comes to
performance, we blindly do it for all 'lazyancestors' methods.
2015-06-24 12:37:55 -05:00
Pierre-Yves David
7538ebe084 changelog: document the 'readpending' method
I happen to have spent some time understanding this logic, so I'm leaving
documentation for the next poor fellow.
2014-09-28 20:18:43 -07:00
Pierre-Yves David
e0e715574b revsets: use '&' instead of '.filter' in head
More high level operations are more likely to be optimised.
2014-10-10 17:30:09 -07:00
Matt Harbison
1306998af7 fileset: don't suggest private or undocumented queries
Unlike revsets, it looks like all of the filesets are documented, so there's
really nothing to test.  This is aimed more at parity with revsets and
future-proofing.
2015-06-20 11:07:36 -04:00
Matt Harbison
198604740e revset: don't suggest private or undocumented queries
I noticed when I mistyped 'matching', that it suggested '_matchfiles' as well.
Rather than simply exclude names that start with '_', this excludes anything
without a docstring.  That way, if it isn't in the help text, it isn't
suggested, such as 'wdir()'.
2015-06-20 10:59:56 -04:00
Matt Mackall
7c6674833f patch: add fuzz config flag (issue4697) 2015-06-18 15:42:40 -05:00
Pierre-Yves David
b62d73dc41 devel-warn: issue a warning for old style revsets
We have move to smartset class more than a year ago, we now have the tool to
aggressively nudge developer into upgrading their extensions.
2015-06-19 11:17:11 -07:00
Pierre-Yves David
40147b2819 devel-warn: move the develwarn function as a method of the ui object
We are going to use this feature in more and more place. Having to import
scmutil makes it an import cycle hell.
2015-06-19 11:19:45 -07:00
Yuya Nishihara
35e047f889 templates: fix missing closing brace in map-cmdline.status
Currently the parser does not validate the last closing brace, but future
patches will make it less permissive for this kind of syntax errors.
2015-06-18 23:08:27 +09:00
Matt Mackall
fa83df39d1 verify: clarify misleading fncache message
This is a message about cache corruption, not repository corruption or
actually missing files. Fix message and reduce to a warning.
2015-06-19 12:00:06 -05:00
Pierre-Yves David
e1c6c04ab3 phase: add a pointer to 'hg help phases' in the 'phase' help
The command and the general topic have very similar name. The topic is pointing
to the command, but the command was not pointing to the topic.
2015-06-19 11:07:15 -07:00
Matt Mackall
57fc0eca44 publishing: unconditionally trust publishing flag
Unfortunately, there are currently no tests for this behavior because
we lack a good way of testing trust.
2015-06-18 15:39:52 -05:00
Matt Mackall
e73d6537ab publishing: use new helper method 2015-06-18 15:34:22 -05:00
Matt Mackall
27839628f6 publishing: add helper method to localrepo 2015-06-18 15:33:24 -05:00
Pierre-Yves David
da0f39bd8a revset: make use of natively-computed set for 'draft()' and 'secret()'
If the computation of a set for each phase (done in C) is available,
we use it directly instead of applying a simple filter. This give a
massive speed-up in the vast majority of cases.

On my mercurial repo with about 15000 out of 40000 draft changesets:

revset: draft()
   plain         min           first         last
0) 0.011201      0.019950      0.009844      0.000074
1) 0.000284   2% 0.000312   1% 0.000314   3% 0.000315 x4.3

Bad performance for "last" come from the handling of the 15000 elements set
(memory allocation, filtering hidden changesets (99% of it) etc. compared to
applying the filter only on a handfuld of revisions (the first draft changesets
being close of tip).

This is not seen as an issue since:

* Timing is still pretty good and in line with all the other one,
* Current user of Vanilla Mercurial will not have 1/3 of their repo draft,

This bad effect disappears when phase's set is smaller. (about 200 secrets):

revset: secret()
   plain         min           first         last
0) 0.011181      0.022228      0.010851      0.000452
1) 0.000058   0% 0.000084   0% 0.000087   0% 0.000087  19%
2015-06-10 19:18:51 -07:00
Pierre-Yves David
71823c86d9 revset: refactor the non-public phase code
Code for draft and secret are the same. We'll make it more complex to
take advantages of the set recomputed in C, so we first refactor the
code to only have one place to update (and make sure all behave
properly).

We do not refactor the 'public()' code because it does not have a natively
computed set.
2015-06-17 19:19:57 -07:00
Pierre-Yves David
7dc4b61365 revset: translate node directly with changelog in 'head'
Using 'repo[X]' is much slower because it creates a 'changectx' object and goes
though multiple layers of code to do so. It is also error prone if there is
tags, bookmarks, branch or other names that could map to a node hash and take
precedence (user are wicked).

This provides a significant performance boost on repository with a lot of
heads.  Benchmark result for a repo with 1181 heads.

revset: head()
   plain         min           last          reverse
0) 0.014853      0.014371      0.014350      0.015161
1) 0.001402   9% 0.000975   6% 0.000874   6% 0.001415   9%

revset: head() - public()
   plain         min           last          reverse
0) 0.015121      0.014420      0.014560      0.015028
1) 0.001674  11% 0.001109   7% 0.000980   6% 0.001693  11%

revset: draft() and head()
   plain         min           last          reverse
0) 0.015976      0.014490      0.014214      0.015892
1) 0.002335  14% 0.001018   7% 0.000887   6% 0.002340  14%

The speed up is visible even when other more costly revset are in use

revset: head() and author("mpm")
   plain         min           last          reverse
0) 0.105419      0.090046      0.017169      0.108180
1) 0.090721  86% 0.077602  86% 0.003556  20% 0.093324  86%
2015-06-16 19:47:46 -07:00
Pierre-Yves David
2c584c4990 revset: use a baseset in _notpublic()
The '_notpublic()' internal revset was "returning" a set. That was wrong. We now
return a 'baseset' as appropriate. This has no effect on performance in most case,
because we do the exact same operation than what the combination with a
'fullreposet' was doing. This as a small effect on some operation when combined
with other set, because we now apply the filtering in all cases. I think the
correctness is worth the impact on some corner cases. The optimizer should take
care of these corner cases anyway.

revset #0: not public()
   plain         min           max           first         last          reverse
0) 0.000465      0.000491      0.000495      0.000500      0.000494      0.000479
1) 0.000484      0.000503      0.000498      0.000505      0.000504      0.000491

revset #1: (tip~1000::) - public()
   plain         min           max           first         last          reverse
0) 0.002765      0.001742      0.002767      0.001730      0.002761      0.002782
1) 0.002847      0.001777      0.002776      0.001741      0.002764      0.002858

revset #2: not public() and branch("default")
   plain         min           max           first         last          reverse
0) 0.012104      0.011138      0.011189      0.011138      0.011166      0.011578
1) 0.011387  94% 0.011738 105% 0.014220 127% 0.011223      0.011184      0.012077

revset #3: (not public() - obsolete())
   plain         min           max           first         last          reverse
0) 0.000583      0.000556      0.000552      0.000555      0.000552      0.000610
1) 0.000613 105% 0.000559      0.000557      0.000573      0.000558      0.000613

revset #4: head() - public()
   plain         min           max           first         last          reverse
0) 0.010869      0.010800      0.011547      0.010843      0.010891      0.010891
1) 0.011031      0.011497 106% 0.011087      0.011100      0.011100      0.011085
2015-06-10 19:58:27 -07:00
Anton Shestakov
d76c5b8c5a hgweb: link to revision by node hash in paper & coal
Unlike other styles, paper and coal had only one link to current revision: in
the sidebar. Since those links now use symbolic revisions after 4b263b99440b,
it's nice to have a link that allows going from /rev/tip to /rev/<tip hash>,
for instance. Let's make the node hash in the page header that new link.
2015-06-18 17:06:18 +08:00
Anton Shestakov
fa79758539 hgweb: link to revision by node hash in gitweb & monoblue
This allows going from /rev/tip to /rev/<tip hash> with ease.
2015-06-18 16:14:10 +08:00
Matt Harbison
abed66c145 archive: report the node as "{p1node}+" when archiving a dirty wdir()
This is more useful than reporting all 'f's, allowing the archive to be diffed
against a specific revision to see what changed.
2015-06-16 23:14:45 -04:00
Pierre-Yves David
bc1afdedda phase: remove a 'for x in "foo bar".split()' idiom in phasecache.replace
I find this idiom fairly horrible.
2015-06-15 16:06:17 -07:00
Pierre-Yves David
9c488819f9 phase: document the replace method
This is a minor documentation update to answer a co-worker question.
2015-06-15 16:06:24 -07:00
Pierre-Yves David
d05c4e4635 revset: ensure we have loaded phases data in '_notpublic()'
If we are the very first rev access (or if the phase cache just got
invalidated) the phasesets will be None even if we support the native
computation. So we explicitly trigger a computation if needed.

This was not an issue before because requesting any phase information
would have triggered such computation.
2015-06-15 16:16:02 -07:00
Pierre-Yves David
32f3ec0b50 phase: rename getphaserevs to loadphaserevs
This function is:
- already loading the data in place,
- used once in the code.

So we drop the return value and change the name to make this obvious. We keep
the function public because we'll have to use it in revset.
2015-06-15 16:04:14 -07:00
Anton Shestakov
eb4bfc238e hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Let's make paper (and coal, since it borrows so much from paper) templates use
symbolic revision in navigation links.

The majority of links (log, filelog, annotate, etc) still use node hashes.

Some pages don't have permanent links to current node hash (so it's not very
easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
patches.
2015-06-16 16:07:39 +08:00
Anton Shestakov
1ae5a3b17f hgweb: don't dereference symbolic revision in gitweb style
Let's make gitweb templates use symbolic revision in navigation links.

The majority of links (log, filelog, annotate, etc) still use node hashes.

Some pages don't have permanent links to current node hash (so it's not very
easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
patches.
2015-06-16 14:37:53 +08:00
Anton Shestakov
8daea28f61 hgweb: don't dereference symbolic revision in monoblue style
Let's make monoblue templates use symbolic revision in navigation links.

The majority of links (log, filelog, annotate, etc) still use node hashes.

Some pages don't have permanent links to current node hash (so it's not very
easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
patches.
2015-06-16 13:59:49 +08:00
Anton Shestakov
781227ef89 hgweb: don't dereference symbolic revision in spartan style
Let's make spartan templates use symbolic revision in navigation links.

The majority of links (log, filelog, annotate, etc) still use node hashes, and
many pages also have permanent link to current node hash (i.e. you can go from
/rev/tip to /rev/<tip hash> without manual url editing), so it's safe to
update navigation.
2015-06-16 11:52:10 +08:00
Anton Shestakov
90c74a4812 hgweb: provide symrev (symbolic revision) property to the templates
One of the features of hgweb is that current position in repo history is
remembered between separate requests. That is, links from /rev/<node_hash> lead
to /file/<node_hash> or /log/<node_hash>, so it's easy to dig deep into the
history. However, such links could only use node hashes and local revision
numbers, so while staying at one exact revision is easy, staying on top of the
changes is not, because hashes presumably can't change (local revision numbers
can, but probably not in a way you'd find useful for navigating).

So while you could use 'tip' or 'default' in a url, links on that page would be
permanent. This is not always desired (think /rev/tip or /graph/stable or
/log/@) and is sometimes just confusing (i.e. /log/<not the tip hash>, when
recent history is not displayed). And if user changed url deliberately to say
default instead of <some node hash>, the page ignores that fact and uses node
hash in its links, which means that navigation is, in a way, broken.

This new property, symrev, is used for storing current revision the way it was
specified, so then templates can use it in links and thus "not dereference" the
symbolic revision. It is an additional way to produce links, so not every link
needs to drop {node|short} in favor of {symrev}, many will still use node hash
(log and filelog entries, annotate lines, etc).

Some pages (e.g. summary, tags) always use the tip changeset for their context,
in such cases symrev is set to 'tip'. This is needed in case the pages want to
provide archive links.

highlight extension needs to be updated, since _filerevision now takes an
additional positional argument (signature "web, req, tmpl" is used by most of
webcommands.py functions).

More references to symbolic revisions and related gripes: issue2296, issue2826,
issue3594, issue3634.
2015-06-16 02:07:25 +08:00
Matt Harbison
0dc20be5d4 archive: support 'wdir()'
This is a step toward replacing the extdiff internals with archive, in order to
support 'extdiff -S'.  Only Mercurial subrepos are supported for now.

If a file is missing from the filesystem, it is silently skipped.  Perhaps it
should warn, but it cannot abort when working with extdiff because deleting a
file is a legitimate diff.
2015-06-16 23:06:57 -04:00
Matt Harbison
ba46b0e533 subrepo: allow a representation of the working directory subrepo
Some code cannot handle a subrepo based on the working directory (e.g.
sub.dirty()), so the caller must opt in.  This will be useful for archive, and
perhaps some other commands.  The git and svn methods where this is used may
need to be fixed up on a case by case basis.
2015-06-16 23:03:36 -04:00
Yuya Nishihara
83ca04362c templater: comment that gettemplate() has different name resolution order
I've tried to unify gettemplate() with buildtemplate(), but it didn't go well
because gettemplate() have to bypass mapping dict.

For example, web templates have '{tags%changelogtag}' and 'changelogtag' is
defined in both mapping, the default, and context.cache, sourced from map file.
In general, mapping shadows context variables, but gettemplate() have to pick
it from context.cache.
2015-06-16 22:13:19 +09:00
Yuya Nishihara
224d7d3d20 templater: drop strtoken argument from compiletemplate()
There's no "rawstring" template now.
2015-06-13 20:23:52 +09:00
Yuya Nishihara
7be294a6b8 templater: do not reevaluate rawstring as template (BC)
The previous patch made 'string' is always interpreted as a template. So
this patch removes the special handling of r'rawstring' instead. Now r''
disables template processing at all.
2015-06-10 21:44:43 +09:00
Yuya Nishihara
d95129ee92 templater: take any string literals as template, but not for rawstring (BC)
This patch series is intended to unify the interpretation of string literals.
It is breaking change that boldly assumes

 a. string literal "..." never contains template-like fragment or it is
    intended to be a template
 b. we tend to use raw string literal r"..." for regexp pattern in which "{"
    should have different meaning

Currently, we don't have a comprehensible rule how string literals are
evaluated in template functions. For example, fill() takes "initialindent"
and "hangindent" as templates, but not for "text", whereas "text" is a
template in pad() function.

  date(date, fmt)
  diff(includepattern, excludepattern)
  fill(text, width, initialident: T, hangindent: T)
  get(dict, key)
  if(expr, then: T, else: T)
  ifcontains(search, thing, then: T, else: T)
  ifeq(expr1, expr2, then: T, else: T)
  indent(text, indentchars, firstline)
  join(list, sep)
  label(label: T, expr: T)
  pad(text: T, width, fillchar, right)
  revset(query, formatargs...])
  rstdoc(text, style)
  shortest(node, minlength)
  startswith(pattern, text)
  strip(text, chars)
  sub(pattern, replacement, expression: T)
  word(number, text, separator)
  expr % template: T

  T: interpret "string" or r"rawstring" as template

This patch series adjusts the rule as follows:

 a. string literal, '' or "", starts template processing (BC)
 b. raw string literal, r'' or r"", disables both \-escape and template
    processing (BC, done by subsequent patches)
 c. fragment not surrounded by {} is non-templated string

  "ccc{'aaa'}{r'bbb'}"
   ------------------  *: template
   ---                 c: string
        ---            a: template
                ---    b: rawstring

Because this can eliminate the compilation of template arguments from the
evaluation phase, "hg log -Tdefault" gets faster.

  % cd mozilla-central
  % LANG=C HGRCPATH=/dev/null hg log -Tdefault -r0:10000 --time > /dev/null
  before: real 4.870 secs (user 4.860+0.000 sys 0.010+0.000)
  after:  real 3.480 secs (user 3.440+0.000 sys 0.030+0.000)

Also, this will allow us to parse nested templates at once for better error
indication.
2015-06-13 19:49:54 +09:00
Yuya Nishihara
138acd70e8 templater: move runtemplate function out of buildmap/runmap pair
The next patch will introduce buildtemplate function that should be defined
near runtemplate. But I don't want to insert it between buildmap and runmap.
2015-06-13 00:15:22 +09:00
Pierre-Yves David
17d4d70d6d phase: also overwrite phase's sets when replacing a phasecache
We need to copy this new attributes around too. This fix an issue where phases
data used by 'not public()' were not invalidated properly.
2015-06-15 16:08:22 -07:00
Pierre-Yves David
9f292fb23c phase: invalidate the phase's set cache alongside the revs
Invalidate was leaving set data around leading to possible bugs in revset.
2015-06-15 15:57:47 -07:00
Pierre-Yves David
49dfe34926 phase: also copy phase's sets when copying phase cache
We forgot to add such copy when we added the attributes.
2015-06-15 15:52:52 -07:00
Matt Harbison
bf8d482cfd verify: check the subrepository references in .hgsubstate
While hopefully atypical, there are reasons that a subrepository revision can be
lost that aren't covered by corruption of the .hgsubstate revlog.  Such things
can happen when a subrepo is amended, stripped or simply isn't pulled from
upstream because the parent repo revision wasn't updated yet.  There's no way to
know if it is an error, but this will find potential problems sooner than when
some random revision is updated.

Until recently, convert made no attempt at rewriting the .hgsubstate file.  The
impetuous for this is to verify the conversion of some repositories, and this is
orders of magnitude faster than a bash script from 0..tip that does an
'hg update -C $rev'.  But it is equally useful to determine if everything has
been pulled down before taking a thumb drive on the go.

It feels somewhat wrong to leave this out of verifymod (mostly because the file
is already read in there, and the final summary is printed before the subrepos
are checked).  But verifymod looks very low level, so importing subrepo stuff
there seems more wrong.
2015-06-16 16:15:15 -04:00
Matt Harbison
a1b56b9f59 context: override workingctx.hex() to avoid a crash
Since node is None for workingctx, it can't use the base class
implementation of 'hex(self.node())'.

It doesn't appear that there are any current callers of this, but there will be
when archive supports 'wdir()'.  My first thought was to use "{p1node}+", but
that would cause headaches elsewhere [1].

We should probably fix up localrepository.__getitem__ to accept this hash for
consistency, as a followup.  This works, if the full hash is specified:

  @@ -480,7 +480,7 @@
           return dirstate.dirstate(self.vfs, self.ui, self.root, validate)

       def __getitem__(self, changeid):
  -        if changeid is None:
  +        if changeid is None or changeid == 'ff' * 20:
               return context.workingctx(self)
           if isinstance(changeid, slice):
               return [context.changectx(self, i)

That differs from null, where it will accept any number of 0s, as long as it
isn't ambiguous.


[1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071166.html
2015-06-14 22:04:17 -04:00
Siddharth Agarwal
2da9583582 dirstate: use a presized dict for the dirstate
This uses a simple heuristic to avoid expensive resizes.

On a real-world repo with around 400,000 files, perfdirstate:

before: ! wall 0.155562 comb 0.160000 user 0.150000 sys 0.010000 (best of 64)
after:  ! wall 0.132638 comb 0.130000 user 0.120000 sys 0.010000 (best of 75)

On another real-world repo with around 250,000 files:

before: ! wall 0.098459 comb 0.100000 user 0.090000 sys 0.010000 (best of 100)
after:  ! wall 0.089084 comb 0.090000 user 0.080000 sys 0.010000 (best of 100)
2015-06-16 00:46:01 -07:00
Siddharth Agarwal
bba072811f parsers: add an API to create a new presized dict 2015-06-15 22:41:30 -07:00
Siddharth Agarwal
1be06bc8f4 parsers: factor out code to create a presized dict
In upcoming patches we'll expose this as an API.
2015-06-15 22:37:33 -07:00
Siddharth Agarwal
58df3405ad parsers: drop Python 2.4 compat in make_file_foldmap 2015-06-15 22:29:29 -07:00
Augie Fackler
200363343c progress: respect ui.quiet (issue4726)
Caught when I was running the hgsubversion testsuite and it started
printing progress bars over top of my test output lines.
2015-06-16 14:11:58 -04:00
Matt Mackall
a42ba8607a merge with stable 2015-06-15 13:31:22 -05:00