Commit Graph

12743 Commits

Author SHA1 Message Date
Liubov Dmitrieva
f776a334b5 obsshelve: use real user for shelve commits
Summary:
The reason why we would like to have a real user there is that

we may want to start push shelved changes in commit cloud, so

we should have correct user on the commit

Reviewed By: ryanmce

Differential Revision: D7380732

fbshipit-source-id: 27b07f992a3e394016ce69e1dc9694a4dd1c336b
2018-04-13 21:51:36 -07:00
Liubov Dmitrieva
ce46d0b01f fix import warnings and add log request time
Reviewed By: StanislavGlebik

Differential Revision: D7365309

fbshipit-source-id: 5984fa811b8d1cb9eb996700e6352ec9966b18ad
2018-04-13 21:51:35 -07:00
Martijn Pieters
85eb89e007 sparse: make listing profiles a subcommand
Summary:
This is based on the hg show implementation. hg sparse --list-profiles is not yet widely known, so now is the time to move it to a subcommand.

This is the first step in untangling the mess that is the `hg sparse` forest of options.

Currently, all switches on the command are mutually exclusive, except for `—force` and `—template`, which each only apply to a subset of the actions the other switches affect.

Subcommands are the right pattern for mutually-exclusive actions that can accept their own individual switches.

Reviewed By: quark-zju

Differential Revision: D7350928

fbshipit-source-id: d03014cf7edd2f089f670d11465c70940d96c070
2018-04-13 21:51:35 -07:00
Liubov Dmitrieva
1c8877987d https connector
Summary: https connector for commit cloud

Reviewed By: mjpieters

Differential Revision: D7306672

fbshipit-source-id: c95388964a1aced82579c0d55ccdd0a9ef391e81
2018-04-13 21:51:35 -07:00
Durham Goode
d87789e3e7 hg: store repo on manifestlog instead of changelog
Summary:
Previously we were storing the changelog on the manifestlog and using
it to resolve linkrevs before serializing them. It turns out the changelog can
be invalidated at a different rate than the manifestlog, so we could encounter
issues where the manifestlog held a reference to the old changelog.

To fix this, let's hold a reference to the repo and access the changelog from
there when we need it. This introduces a circular reference between the
manifestlog and the repo, but it's probably fine for now until we can get rid of
the need for changelog invalidation.

Reviewed By: singhsrb

Differential Revision: D7360321

fbshipit-source-id: 2317c7fcd6b307a50b64f0c5df97dda2955f3e21
2018-04-13 21:51:35 -07:00
Mark Thomas
0d739795cc progress: add fancyrenderer for colorful progress bars
Reviewed By: quark-zju

Differential Revision: D7329656

fbshipit-source-id: b6592319177387d615547ff27f8f38efe85838ba
2018-04-13 21:51:34 -07:00
Mark Thomas
8d01284b55 progress: re-implement progress bar engine
Reviewed By: quark-zju

Differential Revision: D7329657

fbshipit-source-id: 4ba5152269ea8a598f13f0ae1e9e792c3b9542bb
2018-04-13 21:51:34 -07:00
Mark Thomas
e09288137b ui: deprecate ui.progress
Summary:
Remove ui.progress as a method of updating progress.  All progress bars now go
through new-style progress bars.

This also splits out the rendering of progress bars from the reporting of
progress.  All tests are updated to use new-style debug progress bars, which
simply report the position of the progress bar.  Rendering of progress bars
will be tested separately once the progress bar engine has been rewritten.

Reviewed By: quark-zju

Differential Revision: D7329488

fbshipit-source-id: 14f8ab67365ddd98b74986aa25d9abc7a0546144
2018-04-13 21:51:34 -07:00
Mark Thomas
896813a257 treemanifest: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329497

fbshipit-source-id: aa19b579e6b57dd08271abf94f370e5491515d96
2018-04-13 21:51:34 -07:00
Mark Thomas
2f6ee7d5e2 patchbomb: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329489

fbshipit-source-id: 3ac24272c286d47a61ed131ba217a2a9d07d9839
2018-04-13 21:51:34 -07:00
Mark Thomas
ced425bc04 p4fastimport: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329509

fbshipit-source-id: 5006ab9555d37102e430a6c6d9994d869ec512dc
2018-04-13 21:51:34 -07:00
Mark Thomas
52d272277f fastannotate: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329490

fbshipit-source-id: 3c8bf8b0590b1d3e5bf567849de4b7c88ea8b894
2018-04-13 21:51:33 -07:00
Mark Thomas
eb318ffa63 convert: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329501

fbshipit-source-id: 5312f905b513200904c79acbdb1c7b17968a8aba
2018-04-13 21:51:33 -07:00
Mark Thomas
e0ebeb5325 subrepo: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329515

fbshipit-source-id: d35a7e4a6ad9a78da9b74863b83811dd4e9f2e9e
2018-04-13 21:51:32 -07:00
Mark Thomas
2640f4cf42 debugcommands: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329487

fbshipit-source-id: 74b4fabd62242556b04d29c3e8be40eeae444cc7
2018-04-13 21:51:32 -07:00
Mark Thomas
c13d19c577 cmdutil: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329499

fbshipit-source-id: 429fd5a7c1cbbfe4734f940b74a3333cb57af455
2018-04-13 21:51:32 -07:00
Mark Thomas
ded1a17e97 archiving: use new-style progress bars
Reviewed By: ryanmce

Differential Revision: D7329713

fbshipit-source-id: 49e6c17f7e54f6a728fc48cd6569ec1a7768cebe
2018-04-13 21:51:32 -07:00
Mark Thomas
f1508781f5 hg: use new-style progress bars for copystore
Summary:
Update hg.copystore and util.copyfiles to use the new-style progress bar
context manager.

Reviewed By: ryanmce

Differential Revision: D7329482

fbshipit-source-id: 4ac1def57e0ae4e7819c7c0c4d6f1715b8cbb625
2018-04-13 21:51:31 -07:00
Durham Goode
4ac2448524 hg: handle case when manifest revlog is missing a node
Summary:
Previously, when looking for a treemanifest we'd inspect the flat
manifest revlog to get a hint for which nearby manifests might exist. This
assumed the data was in the flat manifest though, and if it wasn't it threw an
exception which caused us to not look at the server for the tree.

This commit fixes the case where the flat manifest doesn't have the commit, so
it can still look at the server.

Reviewed By: quark-zju

Differential Revision: D7343608

fbshipit-source-id: 57d5da9a8b8d71e33df9a8a0647b7bfe8815e37b
2018-04-13 21:51:31 -07:00
Jun Wu
66a8415930 pushrebase: add a test about hash preservation behavior
Summary:
Tests pushrebase can preserve commit hash if rewritedates is set to False.
This is the desired property mentioned in T26625986.

Reviewed By: DurhamG

Differential Revision: D7280498

fbshipit-source-id: e8943ddfec55a524c5cfd1dc9de765eace1e5296
2018-04-13 21:51:31 -07:00
Martijn Pieters
36a3e5b595 sparse: use -l as the short option for --list-profiles
Summary: There's a precedent for `-l` for listing: `hg shelve -l`, `hg undo -l`, `hg resolve -l`.

Reviewed By: ryanmce

Differential Revision: D7337527

fbshipit-source-id: 3d9c340590e9756e39cad3bfdd0b017f45fd3a6e
2018-04-13 21:51:31 -07:00
Durham Goode
25ab786e07 hg: allow backfilling trees for a nullid manifest
Summary:
We have some repo's whose first commit didn't not add any files, which
means they have nullid as their manifest pointer which breaks backfilltrees.
This patch fixes that.

Reviewed By: singhsrb

Differential Revision: D7340678

fbshipit-source-id: 85b048b81c1861fd48d5cc082d414271aee7283b
2018-04-13 21:51:31 -07:00
Martijn Pieters
efd45069e3 sparse: use relglob to exclude readme files
Summary: Although the old glob *should* work, in practice the treemanifest matcher seems to have issues with glob:**/ paths, where relglob: works.

Reviewed By: ryanmce

Differential Revision: D7287992

fbshipit-source-id: d3802e730d937eeca7059dac691d8dac5a5de262
2018-04-13 21:51:31 -07:00
Durham Goode
df8173b17b hg: add --configfile global option
Summary:
This adds the ability to specify a config file to be used during the
command. This is useful during clones for letting the clone command use the
given repositories system specified repo-specific hgrc file.

Reviewed By: quark-zju

Differential Revision: D7311576

fbshipit-source-id: a97d8ebada2e0bea27c75a7650df8ede00dc10c6
2018-04-13 21:51:31 -07:00
Jun Wu
5ce4e0f541 patch: disable worddiff if HGPLAIN is set or color is disabled
Summary:
worddiff needs extra computation and does not have effect if color is
disabled. It should also be disabled with HGPLAIN=1.

Reviewed By: ryanmce

Differential Revision: D7315276

fbshipit-source-id: b59255bc708713186bd4ddafdc469763e1a66ea6
2018-04-13 21:51:31 -07:00
Jun Wu
97411a0738 patch: rewrite the worddiff algorithm
Summary:
There were recent complains about both quality [1] [2] and performance [3]
of the current word diff algorithm.

The current algorithm is actually bad in various ways:

  - Lines could be matched across hunks, which is confusing (report [1]).
  - For short lines, they can fail "similarity" check, which means they
    won't be highlighted when they are expected to be (report [2]).
  - Various performance issues:
    - Using difflib implemented by pure Python, which is both slow and
      suboptimal comparing with xdiff.
    - Searching for matched lines across hunks could be O(N^2) if there are
      no match found.

Thinking it in a "highlight" way is actually tricky, consider the following
change:

```
  # before
  foo = 10

  # after
  if True:
      foo = 21 + 3
```

It's obvious that "10" and "21 + 3" need highlighting because they are
different.  But what about "if True:"? In theory it's also "different" and
need highlighting. How about purely inserted or deleted hunks then?
Highlighting all of them would be too noisy.

This diff rewrites the word diff algorithm. It differs in multiple ways:

  1. Get rid of "matching lines by similarity" step.
  2. Only diff words within a same hunk.
  3. Dim unchanged words. Instead of highlighting changed words.
  4. Treat pure insertion or deletion hunks differently - do not dim or
     highlight words in them.
  5. Use xdiff instead.
  6. Use a better regexp to split words. This reduces the number of tokens sent
     to the diff algorithm.

1, 2, 5, 6 help performance. 1, 2, 3, 4 make the result more predictable and
trustworthy. 3 avoids the nasty question about what to highlight. 3 and 4 makes
it more flexible for people to tweak colors. 6 makes the result better since it
merges multiple space tokens into one so xdiff will less likely miss important
matches (than meaningless matches like spaces).

"bold" and "underline" were removed so the changed words will have regular
red/green colors. The output won't be too "noisy" even in cases where code are
changed in a way that inline word matching is meaningless. For people who want
more contrast, they can set:

  [color]
  diff.inserted.changed = green bold
  diff.deleted.changed = red bold

Practically, when diffing D7319718, the old code spends 4 seconds on finding
matched lines preparing for worddiff:

```
           | diffordiffstat                     cmdutil.py:1522
            \ difflabel (17467 times)           patch.py:2471
             ....
> 3927        \ _findmatches (22 times)         patch.py:2537
   348          \ __init__ (8158 times)         difflib.py:154
   340           | set_seqs (8158 times)        difflib.py:223
   328           | set_seq2 (8158 times)        difflib.py:261
   322           | __chain_b (8158 times)       difflib.py:306
  1818          \ ratio (8158 times)            difflib.py:636
  1777           | get_matching_blocks (8158 times) difflib.py:460
  1605            \ find_longest_match (51966 times) difflib.py:350
    38             | __new__ (51966 times)      <string>:8
    29            \ _make (36035 times)         <string>:12
   143      \ write (17466 times)               ui.py:883
```

The new code takes 0.14 seconds:

```
             | diffordiffstat                   cmdutil.py:1522
              \ difflabel (23401 times)         patch.py:2562
               ....
>  140          \ consumehunkbuffer (23346 times) patch.py:2585
   130           | diffsinglehunkinline (23240 times) patch.py:2496
   215        \ write (23400 times)             ui.py:883
   118    \ flush                               cmdutil.py:1606
   118     | write                              ui.py:883

```

[1]: https://fburl.com/lkb9rc9m
[2]: https://fburl.com/0r9bqf0e
[3]: https://fburl.com/pxqznw31

Reviewed By: ryanmce

Differential Revision: D7314726

fbshipit-source-id: becd979cb9ac3fd3f4adae11cb10804d535f58df
2018-04-13 21:51:30 -07:00
Jun Wu
582d06422e patch: buffer lines for a same hunk
Summary:
Instead of yielding tokens directly, buffer them if they belong to a same
hunk. This makes it easier for the upcoming new worddiff algorithm to only
focus on the diff hunk, instead of having to worry about other contents.

This breaks how the existing experimental worddiff algorithm works, so the
algorithm was removed, and related tests are disabled for now.

Reviewed By: ryanmce

Differential Revision: D7314725

fbshipit-source-id: 344e502cd185b2412fbd2ee299131bbb4560ac17
2018-04-13 21:51:30 -07:00
Durham Goode
b964f5d745 hg: always send all trees to the main server
Summary:
A prior diff optimized push/pull to not send public trees between
peers, since those trees can be downloaded from the main server. Let's be
careful when sending data to the main server and always send everything.

In the future we should add validation on the server that the received data is
complete, but Mercurial doesn't currently do that today.

Differential Revision: D7296253

fbshipit-source-id: 49513685d19991a70d66da1d734ddae23491ed0c
2018-04-13 21:51:30 -07:00
Durham Goode
d7d4e3f019 hg: enable pushing treeonly commits without pushrebase
Summary:
This allows pushing a treeonly pack to a server without using
pushrebase.

Differential Revision: D7295686

fbshipit-source-id: b0bfe4fbb04bc765e57f1db82909fa1ae7b3063b
2018-04-13 21:51:30 -07:00
Phil Cohen
67a6bf19bd add repack --looseonly
Summary:
It can sometimes be nice to be able to just repack loose data and avoid existing packs.

This came up during building the megarepo, which creates many loose files, but including the packs added too much repack time.

Differential Revision: D7209296

fbshipit-source-id: 10afed40e409733e0ee004f025013cf86f3f7bf6
2018-04-13 21:51:30 -07:00
Ryan McElroy
b2007943be templater: provide hint for templates with parse errors
Summary: Help people debug issues by providing useful hints when templates fail to parse.

Differential Revision: D7148780

fbshipit-source-id: bd2b0f2bdeb0c970732fcaf53854d4a003b08571
2018-04-13 21:51:30 -07:00
Ryan McElroy
2e2949fcbf revsetlang: add a hint for more useful parse errors
Summary:
This logic is largely based on the similar logic added to template error
messages in D2608 and D2609, but with a few tweaks based on how revsets
actually work.

Differential Revision: D7148779

fbshipit-source-id: fb435788711a2c4ef881dfaeac5176fc1972c07a
2018-04-13 21:51:30 -07:00
Durham Goode
50392ae4cf hg: fix linknodes in new trees
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. This diff updates manifestlog.add to pass
linkrevs to mutablehistorypack, which get resolved at serialization time into
the appropriate linknode.

Reviewed By: ryanmce

Differential Revision: D7280104

fbshipit-source-id: bbc8a7bfad31da296a1b65973875ba2e1e1f7a95
2018-04-13 21:51:30 -07:00
Durham Goode
668b782de4 hg: support linkrevs in mutablehistorypack
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. This diff updates mutablehistorypack to allow
resolving the linknodes at serialization time instead of add time. This will be
used in a future diff to fix storing linknodes in trees.

Reviewed By: ryanmce

Differential Revision: D7280105

fbshipit-source-id: 70063e627d0fd7baeb017bac5ac55957a100d06c
2018-04-13 21:51:29 -07:00
Durham Goode
e2ab772767 hg: use the correct linknode in converttotrees
Summary:
Previously converttotrees relied on being passed a linkrev to pass to
manifestlog.add(). If a linkrev wasn't provided though, it would pass None and
no linknode was stored. If a linknode is available, let's prefer that, and only
use the linkrev when we have to.

Reviewed By: ryanmce

Differential Revision: D7280109

fbshipit-source-id: d17015789a213fab6ff57563216e6943d2525fee
2018-04-13 21:51:29 -07:00
Durham Goode
ae52f1bd3c hg: don't send tree packs as part of pushrebase pushes
Summary:
Previously pushrebase pushes would send a tree pack part as well as a
rebase pack part. The tree pack part was ignored. Let's make receiving tree pack
parts on the server an error, and instead make the client not send them if it's
doing a pushrebase push.

A future diff will come back and add support for non-pushrebase push of tree
packs. This diff just makes use sure that the new logic won't run during
pushrebase.

Reviewed By: ryanmce

Differential Revision: D7267802

fbshipit-source-id: cabff989c178afb3706b77a03a299bcf3195f289
2018-04-13 21:51:29 -07:00
Durham Goode
0803faf09d hg: make infinitepush convert flat manifests to trees during rebundling
Summary:
Currently infinitepush relies on the ability to send flat manifests to
tree clients and the clients doing the conversion. This relies on a hack where
we don't pass the bundlecaps to the infinitepush changegroup creator, so it
doesn't realize it's talking to a treeonly client and therefore sends flat
manifests to a treeonly client. This is hacky. To fix this, let's start by
making it possible for the server to generate trees on demand from the flat
manifests. This will also be useful later when the server is treeonly, so it can
ondemand generate old flat bundles into a treeonly one.

A later diff will then pass the appropriate bundlecaps to the rebundle
changegroup function.

Reviewed By: ryanmce

Differential Revision: D7256554

fbshipit-source-id: 40d5d9537a5e11b3d186c8ec9a2579261f1b772e
2018-04-13 21:51:29 -07:00
Mark Thomas
93b97b7fe1 clienttelemetry: record client details in server telemetry
Summary:
Add a new extension, `clienttelemetry`, which sends information about the
client to the server.  This information is logged by the server, which can use
the `sampling` extension to store this information for later analysis.

Includes a few basic pieces of information by default, including a correlator
which can be used to correlate logs from the client and the server.

Reviewed By: mjpieters

Differential Revision: D7271508

fbshipit-source-id: f152fe177d8bc73179d3a2c4d0d070d468885e2a
2018-04-13 21:51:29 -07:00
Durham Goode
a5c5d43e98 hg: fix infinitepush phases test
Summary:
I somehow had a brain fart before landing my infinitepush phases diff
and replaced a hash with a rev number, even though rev numbers don't work with
infinitepush. This fixes that.

fbshipit-source-id: aa85614d40e173f6472cb9570af8510eb15ea353
2018-04-13 21:51:28 -07:00
Mark Thomas
4cea23b3a9 commitcloud: sync obsmarkers
Summary:
Add obsmarkers to the things that are synced.

For the LocalService, obsmarkers are stored base64-encoded using version 1 of
the obsmarker binary format.  This is sufficient for unit tests.

Differential Revision: D7181399

fbshipit-source-id: 61377105986de561622a160134d20fdbd54bb88f
2018-04-13 21:51:28 -07:00
Mark Thomas
6660438ea2 commitcloud: add basic cloudsync command
Summary:
Adds the initial skeleton of the `commitcloud` extension to Mercurial, which
will synchronise heads and bookmarks (and later, obsmarkers) with commit cloud.

Current limitations:
  - only supports a stub version of the service that uses local files
  - requires manual pushbackup to send commits to the server via infinitepush
  - doesn't do anything with obsmarkers

Differential Revision: D7167715

fbshipit-source-id: 53443f3fb8dff0fe52257d7b20fc601dbe10c883
2018-04-13 21:51:28 -07:00
Martijn Pieters
37547cff41 sparse: list profile titles
Summary: Put titles, if present, into a second 'column' in the plain output.

Differential Revision: D7258046

fbshipit-source-id: dedbb04ecbf0b2262c4c507683262e4b7bef8d70
2018-04-13 21:51:28 -07:00
Martijn Pieters
a8786716bf sparse: load metadata from profiles
Summary:
Profiles can now have a [metadata] section, with key-value pairs defining some metadata to be associated with the profile.

This supports multiline entries by starting a continuation line with some whitespace:

```
[metadata]
title = Some cool title
description = A longer description
 will be joined with newlines
 provided you start with a space
 or a tab.
```

Differential Revision: D7257628

fbshipit-source-id: d6b09161d54cb6824f691d07caee83d0f8bd0a84
2018-04-13 21:51:28 -07:00
Martijn Pieters
8bb4e6a0ec sparse: include a filename when reporting sparse profile parsing issues
Summary: We regularly parse multiple profiles, through includes or when discovering. Be clear what profile file caused the issue.

Differential Revision: D7257636

fbshipit-source-id: 1203c13f6c6a4e4d1397ace818aee21b9db38550
2018-04-13 21:51:28 -07:00
Durham Goode
44255f76a8 hg: fix incorrect public phases during infinitepush pulls
Summary:
infinitepush manipulates what phases are sent back to the client. The
old behavior was that it would report every commit from the bundle to the client
as draft, even if the commit wasn't related to the heads being fetched and even
if the commit wasn't actually a root. The mercurial client logic expected these
values to actually be roots, and this caused some logic to act incorrectly and
mark commits unrelated to the pulled head public.

The fix is to only send roots, and only ancestors of the requested head.

Reviewed By: singhsrb

Differential Revision: D7265155

fbshipit-source-id: 709c3c807258049e44e493b0668f3034a0b11328
2018-04-13 21:51:28 -07:00
Durham Goode
e3898ae004 hg: add test for infinitepush messing up phases
Summary:
There's a bug in infinitepush where it can cause client phases to get
screwed up. This affects pulls where multiple stacks were uploaded at once, then
only part of the stack is pulled. Let's add a test to expose the bug.

Reviewed By: singhsrb

Differential Revision: D7265104

fbshipit-source-id: ec1320d46ec865e8fbcf324e8d94737a5c111ef7
2018-04-13 21:51:28 -07:00
Xinjie Lei
3963adf502 Delete unnecessary test command
Summary: Delete an unnecessary test command which delete a non-existed local bookmark.

Reviewed By: StanislavGlebik

Differential Revision: D7216466

fbshipit-source-id: f8fc4215ef1fa725c5e5f92ef03cc2616326ac59
2018-04-13 21:51:27 -07:00
Durham Goode
bdff1aaa60 hg: infinitepush fix sending files with infinitepush bundles
Summary:
Previously, if we weren't sending trees we would not attempt to process
what files needed to be sent. This was incorrect, since files may be sent
independent of what trees are decided to be sent. So let's update the code to
care about shouldaddfilegroup instead of cansendtrees.

This exposed an additional bug where we wouldn't look at the treemanifests
during the file computation, so when sending treeonly infinitepush bundles we
would get an error.

Reviewed By: singhsrb

Differential Revision: D7240340

fbshipit-source-id: a9be69597f4f1cbbecdd7cb1661f1023114bf621
2018-04-13 21:51:27 -07:00
Durham Goode
c41de80f47 hg: fix infinitepush treeonly rebundling
Summary:
Sometimes infinitepush has to rebundle the data it's trying to send to
the client (like if you pull only part of a bundle). Previously, this was broken
for treeonly bundles because we did not correctly extend the bundlerepo's
data/history store on treemanifest servers. This patch fixes that and updates a
test.

Reviewed By: quark-zju

Differential Revision: D7240343

fbshipit-source-id: a9dd3ae884ace3fa9f4a748fe753fc394e69d6c9
2018-04-13 21:51:27 -07:00
Durham Goode
d80a47a7a7 hg: add test for treeonly rebundling during infinitepush
Summary:
If we're pulling just part of an infinitepush bundle, it needs to
rebundle the data. We had a test for this for flat manifests, but we need a test
for treeonly commits as well. The test currently fails with an error. A future
diff will fix the error.

Reviewed By: quark-zju

Differential Revision: D7240342

fbshipit-source-id: 6acda3dfa6059f0957507a951df1b5e97df6dc4e
2018-04-13 21:51:27 -07:00