Commit Graph

34927 Commits

Author SHA1 Message Date
Gregory Szorc
14c677b632 bundle2: implement consume() API on unbundlepart
We want bundle parts to not be seekable by default. That means
eliminating the generic seek() method.

A common pattern in bundle2.py is to seek to the end of the part
data. This is mainly used by the part iteration code to ensure
the underlying stream is advanced to the next bundle part.

In this commit, we establish a dedicated API for consuming a
bundle2 part data. We switch users of seek() to it.

The old implementation of seek(0, os.SEEK_END) would effectively
call self.read(). The new implementation calls self.read(32768)
in a loop. The old implementation would therefore assemble a
buffer to hold all remaining data being seeked over. For seeking
over large bundle parts, this would involve a large allocation and
a lot of overhead to collect intermediate data! This overhead can
be seen in the results for `hg perfbundleread`:

! bundle2 iterparts()
! wall 10.891305 comb 10.820000 user 7.990000 sys 2.830000 (best of 3)
! wall 8.070791 comb 8.060000 user 7.180000 sys 0.880000 (best of 3)
! bundle2 part seek()
! wall 12.991478 comb 10.390000 user 7.720000 sys 2.670000 (best of 3)
! wall 10.370142 comb 10.350000 user 7.430000 sys 2.920000 (best of 3)

Of course, skipping over large payload data isn't likely very common.
So I doubt the performance wins will be observed in the wild.

Differential Revision: https://phab.mercurial-scm.org/D1388
2017-11-13 20:03:02 -08:00
Gregory Szorc
589a08705a bundle2: implement generic part payload decoder
The previous commit extracted _payloadchunks() to a new derived class.
There was still a reference to this method in unbundlepart, making
unbundlepart unusable on its own.

This commit implements a generic version of a bundle2 part payload
decoder, without offset tracking. seekableunbundlepart._payloadchunks()
has been refactored to consume it, adding offset tracking like before.
We also implement unbundlepart._payloadchunks(), which is a thin
wrapper for it. Since we never instantiate unbundlepart directly,
this new method is not used. This will be changed in subsequent
commits.

The new implementation also inlines some simple code from unpackermixin
and adds some local variable to prevent extra function calls and
attribute lookups. `hg perfbundleread` on an uncompressed Firefox
bundle seems to show a minor win:

! bundle2 iterparts()
! wall 12.593258 comb 12.250000 user 8.870000 sys 3.380000 (best of 3)
! wall 10.891305 comb 10.820000 user 7.990000 sys 2.830000 (best of 3)
! bundle2 part seek()
! wall 13.173163 comb 11.100000 user 8.390000 sys 2.710000 (best of 3)
! wall 12.991478 comb 10.390000 user 7.720000 sys 2.670000 (best of 3)
! bundle2 part read(8k)
! wall 9.483612 comb 9.480000 user 8.420000 sys 1.060000 (best of 3)
! wall 8.599892 comb 8.580000 user 7.720000 sys 0.860000 (best of 3)
! bundle2 part read(16k)
! wall 9.159815 comb 9.150000 user 8.220000 sys 0.930000 (best of 3)
! wall 8.265361 comb 8.250000 user 7.360000 sys 0.890000 (best of 3)
! bundle2 part read(32k)
! wall 9.141308 comb 9.130000 user 8.220000 sys 0.910000 (best of 3)
! wall 8.290308 comb 8.280000 user 7.330000 sys 0.950000 (best of 3)
! bundle2 part read(128k)
! wall 8.880587 comb 8.850000 user 7.960000 sys 0.890000 (best of 3)
! wall 8.204900 comb 8.150000 user 7.210000 sys 0.940000 (best of 3)

Function call overhead in Python strikes again!

Of course, bundle2 decoding CPU overhead is likely small compared to
decompression and changegroup application. But every little bit helps.

Differential Revision: https://phab.mercurial-scm.org/D1387
2017-11-12 19:46:15 -08:00
Gregory Szorc
d2101718bc bundle2: extract logic for seeking bundle2 part into own class
Currently, unbundlepart classes support bi-directional seeking.
Most consumers of unbundlepart only ever seek forward - typically
as part of moving to the end of the bundle part so they can move
on to the next one. But regardless of the actual usage of the
part, instances maintain an index mapping offsets within the
underlying raw payload to offsets within the decoded payload.

Maintaining the mapping of offset data can be expensive in terms of
memory use. Furthermore, many bundle2 consumers don't have access
to an underlying seekable stream. This includes all compressed
bundles. So maintaining offset data when the underlying stream
can't be seeked anyway is wasteful. And since many bundle2 streams
can't be seeked, it seems like a bad idea to expose a seek API
in bundle2 parts by default. If you provide them, people will
attempt to use them.

Seekable bundle2 parts should be the exception, not the rule. This
commit starts the process dividing unbundlepart into 2 classes: a
base class that supports linear, one-time reads and a child class
that supports bi-directional seeking. In this first commit, we
split various methods and attributes out into a new
"seekableunbundlepart" class. Previous instantiators of "unbundlepart"
now instantiate "seekableunbundlepart." This preserves backwards
compatibility. The coupling between the classes is still tight:
"unbundlepart" cannot be used on its own. This will be addressed
in subsequent commits.

Differential Revision: https://phab.mercurial-scm.org/D1386
2017-11-13 19:22:11 -08:00
Gregory Szorc
96e04b10aa perf: add command to benchmark bundle reading
Upcoming commits will be refactoring bundle2 I/O code.

This commit establishes a `hg perfbundleread` command that measures
how long it takes to read a bundle using various mechanisms.

As a baseline, here's output from an uncompressed bundle1
bundle of my Firefox repo (7,098,622,890 bytes):

! read(8k)
! wall 0.763481 comb 0.760000 user 0.160000 sys 0.600000 (best of 6)
! read(16k)
! wall 0.644512 comb 0.640000 user 0.110000 sys 0.530000 (best of 16)
! read(32k)
! wall 0.581172 comb 0.590000 user 0.060000 sys 0.530000 (best of 18)
! read(128k)
! wall 0.535183 comb 0.530000 user 0.010000 sys 0.520000 (best of 19)
! cg1 deltaiter()
! wall 0.873500 comb 0.880000 user 0.840000 sys 0.040000 (best of 12)
! cg1 getchunks()
! wall 6.283797 comb 6.270000 user 5.570000 sys 0.700000 (best of 3)
! cg1 read(8k)
! wall 1.097173 comb 1.100000 user 0.400000 sys 0.700000 (best of 10)
! cg1 read(16k)
! wall 0.810750 comb 0.800000 user 0.200000 sys 0.600000 (best of 13)
! cg1 read(32k)
! wall 0.671215 comb 0.670000 user 0.110000 sys 0.560000 (best of 15)
! cg1 read(128k)
! wall 0.597857 comb 0.600000 user 0.020000 sys 0.580000 (best of 15)

And from an uncompressed bundle2 bundle (6,070,036,163 bytes):

! read(8k)
! wall 0.676997 comb 0.680000 user 0.160000 sys 0.520000 (best of 15)
! read(16k)
! wall 0.592706 comb 0.590000 user 0.080000 sys 0.510000 (best of 17)
! read(32k)
! wall 0.529395 comb 0.530000 user 0.050000 sys 0.480000 (best of 16)
! read(128k)
! wall 0.491270 comb 0.490000 user 0.010000 sys 0.480000 (best of 19)
! bundle2 forwardchunks()
! wall 2.997131 comb 2.990000 user 2.270000 sys 0.720000 (best of 4)
! bundle2 iterparts()
! wall 12.247197 comb 10.670000 user 8.170000 sys 2.500000 (best of 3)
! bundle2 part seek()
! wall 11.761675 comb 10.500000 user 8.240000 sys 2.260000 (best of 3)
! bundle2 part read(8k)
! wall 9.116163 comb 9.110000 user 8.240000 sys 0.870000 (best of 3)
! bundle2 part read(16k)
! wall 8.984362 comb 8.970000 user 8.110000 sys 0.860000 (best of 3)
! bundle2 part read(32k)
! wall 8.758364 comb 8.740000 user 7.860000 sys 0.880000 (best of 3)
! bundle2 part read(128k)
! wall 8.749040 comb 8.730000 user 7.830000 sys 0.900000 (best of 3)

We already see some interesting data. Notably that bundle2 has
significant overhead compared to bundle1. This matters for e.g. stream
clone bundles, which can be applied at >1Gbps.

Differential Revision: https://phab.mercurial-scm.org/D1385
2017-11-13 19:20:34 -08:00
Zuzanna Mroczek
344962042e sshpeer: add a configurable hint for the ssh error message
Adding a possibility to configure error hint to be shown in the case of problems with SSH. Example of such hint can be "Please see http://company/internalwiki/ssh.html".

Test Plan:
- Ran hg pull with broken link and verified the output has no hint by default:

```
pulling from ssh://brokenrepository.com//repo
remote: ssh: Could not resolve hostname brokenrepository.com: Name or service not known
abort: no suitable response from remote hg!
```

- Run hg pull --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html":

```
pulling from ssh://brokenrepository.com//repo
remote: ssh: Could not resolve hostname brokenrepository.com: Name or service not known
abort: no suitable response from remote hg!
(Please see http://company/internalwiki/ssh.html)
```

Differential Revision: https://phab.mercurial-scm.org/D1431
2017-11-20 01:40:26 -08:00
rlevasseur@google.com
f0bc85352f docs: add args/returns docs for some cmdutil, context, and registrar functions
When writing my first extension, I found it hard to figure out these functions.
I figured documenting their inputs/outputs would help future authors who
are new to the codebase.

Differential Revision: https://phab.mercurial-scm.org/D1440
2017-11-16 15:01:21 -08:00
Pulkit Goyal
0b53da01f1 commands: add value for cmdtype argument for read only commands
In the previous release we added an argument `cmdtype` to registrar.command()
which is a enum and tells whether the command is read only, recoverable write or
unrecoverable write command. This patch add the value of cmdtype argument for
commands which are read only.

Differential Revision: https://phab.mercurial-scm.org/D1468
2017-11-21 04:37:51 +05:30
Phil Cohen
1d563527a4 error: add InMemoryMergeConflictsError
We'll raise this exception in the merge code, and in-memory users like rebase
can catch it and retry without IMM.

Differential Revision: https://phab.mercurial-scm.org/D1210
2017-11-15 21:07:30 -08:00
Augie Fackler
7e6bf0f527 lfs: generate a large file by using python instead of yes | head
yes(1) on some systems (like gcc112) feels compelled to inform you of
broken pipes, such as those triggered by head(1). This works around
the problem portably.
2017-11-20 18:05:15 -05:00
Augie Fackler
31e42fb8de setup: add hgext.lfs to list of Python packages
This is needed for lfs to get installed. Probably could stand to go
into an earlier patch, but I just want to get this stuff pushed.
2017-11-20 18:00:02 -05:00
Matt Harbison
3956a5f4f7 test-lfs: add tests demonstrating the interaction with largefiles
Obviously the original series needs to be accepted first, but there are concerns
about how well these extensions will play together before proceeding.  It looks
like the answer is surprisingly well.  There are some merge surprises
(largefiles seems to combine the choice of "keep tracking as a large/normal
file" with taking the content of the large/normal file) and some existing diff
weirdness (largefiles diffs the standins, not the large file).  Converting the
repo to normal files seemlessly transitions to lfs on the fly.  I didn't test
going the other way, because I'm not sure why anyone would want to do that.

I flagged the lack of a repo requirement after converting, because some of the
unsubmitted changes I have add a requirement on commit, but this somehow misses
the convert case.

I flagged an issue where devel-warnings are emitted on convert, which is a
separate issue.
2017-11-18 12:54:06 -05:00
Matt Harbison
3fa74eec9e test-lfs: cast the flags printed to an int
On Windows, the flag values in the subsequent tests were printing with a 'L'
suffix.
2017-11-14 01:09:48 -05:00
Matt Harbison
37ca95c067 lfs: register config options
I'm not sure at what point we can get rid of the deprecated options, but for the
sake of making progress, they are registered too.
2017-11-14 01:03:22 -05:00
Matt Harbison
79bbdb4ae3 lfs: quiesce check-module-import warnings
Specifically, 'symbol import follows non-symbol import: mercurial.i18n'
2017-11-14 00:14:52 -05:00
Matt Harbison
85811b33f9 lfs: import the Facebook git-lfs client extension
The purpose of this is the same as the built-in largefiles extension- to handle
huge files outside of the normal storage system, generally to keep the amount of
data cloned to a lower amount.  There are several benefits of implementing the
git-lfs protocol, instead of using the largefiles extension:

  - Bitbucket and Github support (and probably wider support in 3rd party
    hosting sites in general). [1][2]

  - The number of hg internals monkey patched are several orders of magnitude
    lower, so it will be easier to reason about and maintain.  Future commands
    will likely just work, without requiring various wrappers.

  - The "standin" files are only written to the filelog, not the disk.  That
    should avoid weird edge cases where the largefile and standin files get out
    of sync. [3]  It also avoids the occasional printing of the "hidden" standin
    file in various messages.

  - Filesets like size() will work, even if the file isn't present.  (It always
    says 41 bytes for largefiles, whether present or not.)

The only place that I see where largefiles comes out on top is that it works
with `hg serve` for simple sharing, without external infrastructure.  Getting
lfs-test-server working was a hassle, and took awhile to figure out.  Maybe we
can do something to make it work in the future.

Long term, I expect that this will be highly preferred over largefiles.  But if
we are to recommend this to largefile users, there are some UI issues to
bikeshed.  Until they are resolved, I've marked this experimental, and am not
putting a pointer to this in the largefiles help.  The (non exhaustive) list of
issues I've seen so far are:

  - It isn't sufficient to just enable the largefiles extension- you have to
    explicitly add a file with --large before it will pay attention to the
    configured sizes and patterns on future adds.  The justification being that
    once you use it, you're stuck with it.  I've seen people confused by this,
    and haven't liked it myself.  But it's also saved me a few times.  Should we
    do something like have a specific enabling config setting that must be set
    in the local repo config, so that enabling this extension in the user or
    system hgrc doesn't silently start storing lfs files?

  - The largefiles extension adds a repo requirement when the first largefile is
    committed, so that the extension must always be enabled in the future.  This
    extension is not doing that, and since I only enabled it locally to avoid
    infecting other repos, I got a cryptic error about missing flag processors
    when I cloned.  Is there no repo requirement due to shallow/narrow clone
    considerations (or other future advanced things)?

  - In the (small amount of) reading I've done about the git implementation, it
    seems that the files and sizes are stored in a tracked .gitattributes file.
    I think a tracked file for this would be extremely useful for consistency
    across developers, but this kind of touches on the tracked hgrc file
    proposal a few months back.

  - The git client can specify file patterns, not just sizes.

  - The largefiles extension has a cache directory in the local repo, but also a
    system wide one.  We should probably implement a system wide cache too, so
    that multiple clones don't have to refetch the files from the server.

  - Jun mentioned other missing features, like SSH authentication, gc, etc.

The code corresponds to c0492b73c7ef in hg-experimental. [4]  The only tweaks
are to load the extension in the tests with 'lfs=' instead of
'lfs=$TESTDIR/../hgext3rd/lfs', change the import in the *.py test to hgext
(from hgext3rd), add the 'testedwith' declaration, and mark it experimental for
now.  The infinite-push, p4fastimport, and remotefilelog tests were left behind.

The devel-warnings for unregistered config options are not corrected yet, nor
are the import check warnings.

[1] https://www.mercurial-scm.org/pipermail/mercurial/2017-November/050699.html
[2] https://bitbucket.org/site/master/issues/3843/largefiles-support-bb-3903
[3] https://bz.mercurial-scm.org/show_bug.cgi?id=5738
[4] https://bitbucket.org/facebook/hg-experimental
2017-11-14 00:06:23 -05:00
Matthieu Laneuville
97d465a100 run-tests: outputdir also has to be changed if $TESTDIR is not $PWD
Following 30a570fd0165, running run-tests.py from outside tests/ would lead to
the creation of .testtimes and test-*.t.err in $PWD instead of $TESTDIR. This
patch fixes that and updates the relevant test.
2017-11-18 16:12:00 +09:00
Anton Shestakov
8859c1494a hgweb: use webutil.commonentry() for nodes (but not for jsdata yet) in /graph
This makes graphdata() simpler by using existing code that gets common
changeset properties for showing in hgweb. graphdata() is a nested function in
graph() that prepares entries for /graph view, but there are two different
lists of changesets prepared: "jsdata" for JavaScript-rendered graph and
"nodes" for everything else.

For "jsdata", properties "node", "user", "age" and "desc" are passed through
various template filters because we don't have these filters in JavaScript, so
the data has to be prepared server-side. But now that commonentry() is used for
producing "nodes" list (and it doesn't apply any filters), these filters need
to be added to the appropriate templates (only raw at this moment, everything
else either doesn't implement graph or uses JavaScript).

This is a bit of refactoring that will hopefully simplify future patches. The
end result is to have /graph that only renders the actual graph with nodes and
vertices in JavaScript, and the rest is done server-side. This way server-side
code can focus on showing a list of changesets, which is easy because we
already have /log, /shortlog, etc, and JavaScript code can be simplified,
making it easier to add obsolescence graph and other features.
2017-11-20 21:59:00 +08:00
Anton Shestakov
feae76d15e hgweb: check changeset's original branch in graphdata()
This piece of code checks if a changeset is the tip of its branch, but as can
be seen above in the context, "branch" was prepared for being displayed in
hgweb by making it unicode and passing it through url.escape. It's better to
use the original ctx.branch().
2017-11-20 21:47:11 +08:00
Anton Shestakov
df1a7f71ac hgweb: show instabilities of a commit
In paper, coal, gitweb and monoblue a new "tag" (or multiple, if there are many
instabilities) is added to the same line that has phase, branch, etc of a
changeset; in gitweb and monoblue this element has a light red background, in
paper and coal the element is black and underlined. In spartan theme
instabilities are shown on a separate line.

While test-obsolete.t uses first(phasedivergent()) revset to pick a changeset
to test, that particular changeset is also an orphan, so two different
instability tags are displayed.
2017-11-19 14:02:50 +08:00
Anton Shestakov
ac68d5ffe4 context: add instabilities() method to basefilectx
This method is now used in webutils.commonentry(), which adds common data items
(commit hash, author, date, etc) for rendering changesets in hgweb. Usually,
commonentry() is given a changectx as ctx; but in views related to files (e.g.
file view, diff, annotate) it's replaced by a filectx, so the latter also needs
to have instabilities() method.
2017-11-19 13:18:54 +08:00
Boris Feld
36f8a40cbc run-test: drop 'execfile' usage for 'common-pattern.py' file
This is required for Python 3.
2017-11-19 04:11:21 +01:00
Boris Feld
892a48dd6e run-test: use byte for 'common-pattern.py' path
This is required for Python 3.
2017-11-19 04:10:55 +01:00
Jordi Gutiérrez Hermoso
565b64a53b templates: reword 'back to filelog' link anchor text
This anchor text is problematic in two ways: first, the "back to" part
assumes that you got to the page showing it via the filelog. This is
not necessarily true, as there are other ways to get to that view
besides the filelog view, such as for example following the history of
lines from a file. Second, it uses "filelog" jargon, which refers to
how each file has its own revlog. This is internal jargon that has no
business being exposed to the end user.

I just reworded this template to improve understanding.
2017-11-20 14:30:54 -05:00
Anton Shestakov
980f6b961e hgweb: show obsolescence status of a commit
As with phases, spartan theme shows a simple "obsolete: yes" on its own line
(this allows replacing "yes" with something more useful in future, like output
of obsfate* template functions). Everywhere else a new "tag" is added to the
same line that has phase, branch, etc of a changeset; in gitweb and monoblue
the element has gray background, in paper and coal the element is gray with a
dashed underline.
2017-11-18 12:04:08 +08:00
Anton Shestakov
bc9b6ce350 context: add obsolete() method to basefilectx
This method is now used in webutils.commonentry(), which adds common data items
(commit hash, author, date, etc) for rendering changesets in hgweb. Usually,
commonentry() is given a changectx as ctx; but in views related to files (e.g.
file view, diff, annotate) it's replaced by a filectx, so the latter also needs
to have obsolete() method.
2017-11-18 11:58:57 +08:00
Anton Shestakov
67a7ac7635 check-code: grep's context flags don't need an extra space before number
A bit of useless trivia found while researching this: OpenBSD's grep's -C has a
default value (of 2) and disallows space before the argument (while -A and -B
allow).
2017-11-18 13:00:47 +08:00
Mark Thomas
f546f0cc70 dirstate: make map implementation overridable
Other implementations of dirstate will want to replace the class used for the
dirstate map.  Allow this to happen by making the class an attribute of the
dirstate.

Differential Revision: https://phab.mercurial-scm.org/D1347
2017-11-15 01:07:42 -08:00
Mark Thomas
286eb36174 fsmonitor: only access inner dirstate map if it is available
As part of the dirstate refactor, fsmonitor was updated to directly access the
inner map of the dirstatemap object.

Dirstatemap reimplementations may not use a map like this, so only access it if
it is there.

Differential Revision: https://phab.mercurial-scm.org/D1346
2017-11-15 01:07:42 -08:00
Mark Thomas
c35820b286 dirstate: add explicit methods for querying directories (API)
The set-like object returned by dirstate.dirs may be difficult for other
implementations of the dirstate to provide, and is unnecessary as it is
only ever used for __contains__.  Instead, provide an explicit method for
testing for a directory.

.. api::

   dirstate no longer provides a `dirs()` method.  To test for the existence of
   a directory in the dirstate, use `dirstate.hasdir(dirname)`.

Differential Revision: https://phab.mercurial-scm.org/D1345
2017-11-15 01:07:42 -08:00
Mark Thomas
42e81ca5f7 dirstate: remove _droppath method
This method now doesn't do very much interesting and can be removed.  The
updated files set can be updated where _droppath was originally called.

Differential Revision: https://phab.mercurial-scm.org/D1344
2017-11-15 01:07:42 -08:00
Mark Thomas
6e73355f6b dirstate: move dropping of folded filenames into the dirstate map
When dropping files from the dirstate, the corresponding entry in the
filefoldmap is also dropped.  Move this into the dirstate map object.  A future
implementation of the dirstate will maintain the filefoldmap differently.

Differential Revision: https://phab.mercurial-scm.org/D1343
2017-11-15 01:07:42 -08:00
Mark Thomas
6a69e130f5 dirstate: move management of the dirstate dirs into the dirstatemap
The dirstate dirs object is owned by the map, so move management of that object
there.  A future implementation of the dirstate will manage the dirs object
differently.

Differential Revision: https://phab.mercurial-scm.org/D1342
2017-11-15 01:07:42 -08:00
Mark Thomas
c5205a95ce dirstate: move management of nonnormal sets into dirstate map
The dirstate map owns the nonnormal sets, and so should be the class to update
them.  A future implementation of the dirstate will manage these maps
differently.

The action of clearing ambiguous times is now entirely controlled by the
dirstate map, so it moves there too.

Differential Revision: https://phab.mercurial-scm.org/D1341
2017-11-15 01:07:42 -08:00
Mark Thomas
f069b05e38 dirstate: add explicit methods for modifying dirstate
Instead of assigning dirstatetuple objects to entries in the dirstate, move
responsibility for creating tuples into the dirstatemap.

Differential Revision: https://phab.mercurial-scm.org/D1340
2017-11-15 01:07:42 -08:00
Mark Thomas
82685455a3 dirstate: document dirstatemap interface
Differential Revision: https://phab.mercurial-scm.org/D1380
2017-11-15 01:07:42 -08:00
Gregory Szorc
f5517d96d5 bundlerepo: rename "bundlefilespos" variable and attribute
Strictly speaking, this variable tracks offsets within the
changegroup, not the bundle.

While we're here, mark a class attribute as private because
it is.

.. api::

   Rename bundlerepo.bundlerepository.bundlefilespos to
   _cgfilespos.

Differential Revision: https://phab.mercurial-scm.org/D1384
2017-11-13 19:12:56 -08:00
Gregory Szorc
27bc3c9021 bundlerepo: rename "bundle" arguments to "cgunpacker"
"bundle" was appropriate for the bundle1 days where a bundle
was a changegroup. In a bundle2 world, changegroup readers
are referred to as "changegroup unpackers."

Differential Revision: https://phab.mercurial-scm.org/D1383
2017-11-13 19:12:17 -08:00
Gregory Szorc
8a88beb1d7 bundlerepo: use early return
I like avoiding patterns that lead to the pyramid of doom.

Differential Revision: https://phab.mercurial-scm.org/D1382
2017-11-11 18:55:04 -08:00
Boris Feld
5e36a9bc8b test-pattern: actually update tests using the patterns
We mass update the tests now. This will help the next soul touching the http
protocol.
2017-11-05 08:23:12 +01:00
Boris Feld
d4cfe52f57 test-pattern: substitute the HTTP log timestamp too
We add a pattern matching the infamous timestamp in http log. Now, we should be
able to have change appears in https log without having to re-glob the whole
thing over and over.
2017-11-05 08:23:53 +01:00
Boris Feld
b14cfc9866 test-pattern: register the current the bundle2 capabilities string
The bundle capabilites are sent with every getbundle ssh connection. Every time
the protocol is updated, that string is altered. We get the part about bundle2
string replaced by $USUAL_BUNDLE2_CAPS$ so that we only have to change the
substitution whenever this happens.
2017-11-13 04:59:45 +01:00
Boris Feld
0305ed990e test-pattern: register current the bundlecaps string
The bundle capabilites sent with every getbundle commands. Every time the
protocol is updated, that string is altered. We get that string replace by
$USUAL_BUNDLE_CAPS$ so that we only have to change the substitution whenever
this happens.
2017-11-05 06:43:40 +01:00
Boris Feld
e7093ea4bd test-pattern: substitute common compression list
The compression list as to be matched with a glob because zstd might not be part
of the option. By using a substitution for these, we won't have to re-glob them
over and over.
2017-11-05 06:41:38 +01:00
Boris Feld
01dc148f6e run-tests: allow to register any arbitrary pattern for replacement
We add a 'common-pattern.py' file that allow to define extra pattern. This seems
a cleaner approach than editing the 'run-test.py' file over and over. In
addition allowing arbitrary pattern registration will also help extension.

The format used is a python file is picked out of convenience defining a list of
tuple in 'substitutions' variable. This is picked out of convenience since it is
dead simple to implement.

The end goal is to register more pattern for Mercurial test. There are multiple
common patterns that change over time. That impact is annoying. Using pattern
emplacement for them would be handy.

The next patches will define all the needed patterns and the last patch will
mass-update the tests outputs as it was easier to do in a single pass.
2017-11-05 06:34:27 +01:00
Jun Wu
41d35f0ba7 crecord: fix revert -ir '.^' crash caused by 3649c3f2cd
3649c3f2cd (revert: do not reverse hunks in interactive when REV is not
parent (issue5096)) changed the record "operation" for the text version but
missed the curses version. Without this patch, running
`hg revert -ir '.^' --config ui.interface=curses` would crash with:

  ProgrammingError: unexpected operation: apply

Differential Revision: https://phab.mercurial-scm.org/D1381
2017-11-13 18:22:25 -08:00
Martin von Zweigbergk
979192be0c tweakdefaults: turn on ui.statuscopies
Seems obviously useful and probably off by default for historical
reasons.

Differential Revision: https://phab.mercurial-scm.org/D1444
2017-11-16 17:11:14 -08:00
Kyle Lippincott
4d4a9cfc92 run-tests: fix TESTDIR if testdescs are absolute paths
Commit 30a570fd0165 made TESTDIR be the location of the arguments that were
passed to run-tests.py instead of just PWD.  It assumed that these tests were
specified using relative paths, so if pwd was /tmp/foo, and the first argument
was /tmp/baz, it would set TESTDIR to /tmp/foo//tmp/baz.

Differential Revision: https://phab.mercurial-scm.org/D1433
2017-11-15 17:54:27 -08:00
Anton Shestakov
f8a893bdbf hgweb: show commit phase if it's not public
In spartan theme phase is shown on its own table row, because there's no single
line of "tags". Everywhere else phase is prepended to the list of "tags" of a
changeset. Its element has a purple-ish color in gitweb and monoblue, and a
dotted line under it and no color in paper and coal (as these themes are frugal
with colors).

This patch intentionally doesn't touch graph, because it needs a rewrite. I'll
get to it pretty soon and in the process will add phase and everything that's
still coming (e.g. obsolescence and instabilities).

.. feature::

   hgweb now displays phases of non-public changesets
2017-11-16 22:21:03 +08:00
Anton Shestakov
281eec2f1e hgweb: move changeset "tags" to a template in map file (paper and coal)
This patch puts all these changeset "tags" into one template shared everywhere
in paper and coal themes. But it should be noted that some of the templates had
different sets of tags, in some cases it was intended, in others - most likely
not.

First, what's up with all these different ways to get changeset's branch. There
are actually 3 ways to do it in hgweb, they can all be seen in this patch;
"branches", "inbranch" and "branch". They are all lists that consist of 1 or 0
items:

- "branches" has ctx.branch() if current changeset is the tip of that branch
- "inbranch" has ctx.branch() if current changeset is _not_ the tip of that
  branch and the branch is not "default"
- "branch" aka "changesetbranch" has ctx.branch() if the branch is not
  "default"

The majority of cases (7 vs 2 + /graph) in paper theme used only option 3,
which meant that "default" was never displayed. But other parts of the theme
disagreed with this and used option 1 and option 2 together. For example, the
default view (log) displays "default" on the branch tip (can be seen right
about now on m-s.o/repo/hg), but it disappears when you click on the commit.

Also, using option 3 alone meant that there was no way to tell if a changeset
is the tip of its branch or not (it was always assumed that it's not, see how
some css classes change from "branchname" to the correct "branchhead" in tests)
-- so the two different css styles that exist in paper just for this were
underused.

I think this patch improves the situation, even though it changes the old (even
if inconsistent) behavior. The new behavior matches that of gitweb and
monoblue.
2017-11-15 23:55:09 +08:00
Boris Feld
0d556fd8d6 logtoprocess: clean-up old comment
The comment was likely to be for runshellcommand code.

Differential Revision: https://phab.mercurial-scm.org/D1425
2017-11-03 21:01:20 +01:00