Commit Graph

721 Commits

Author SHA1 Message Date
David Soria Parra
90b5ead814 p4fastimport: remove documentation of non-existing option
Summary: remove the documentation of a non-existing option

Test Plan: none

Reviewers: #mercurial, #idi, rmcelroy

Reviewed By: rmcelroy

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5535512

Signature: t1:5535512:1501591226:97d663cdc550eb2bbb88aca3a88a8ff0a944dbc4
2017-08-02 00:00:47 -07:00
David Soria Parra
d6f8bf23ca p4fastimport: don't inline data as a workaround for an inline separation issue
Summary:
Writing multiple entries to a revlog at the same time can trigger a bug
in revlog caching when a revlog separation of inlined data happend. New
transaction postprocessing callbacks will cause a changelog read which
triggers this bug, therefore we force revlogs to be separated from the
beginning, as a workaround for this bug until it's fixed upstream.

Test Plan:
Run an import of 600 revisions on a test server. Saw failure.
Run import with patch appleid of 600 revisions on test server. Failured
disappeared.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, rmcelroy, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5535509

Signature: t1:5535509:1501613606:97a0a2dca19ae6e915d4777ec6b14d1e9db46242
2017-08-02 00:00:47 -07:00
David Soria Parra
af652e100e p4fastimport: append transactions instead of overwriting
Summary:
We overwrite existing transactions instead of appending them. So let's just
append them instead. This problem becomes apparent when we started separating
changelog data files from changelog index files which breaks the tests.

Test Plan: python ../../hg-crew/tests/run-tests.py test-p4fastimport-transaction.t

Reviewers: #idi, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mitrandir, rmcelroy, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5535507

Signature: t1:5535507:1501613588:efeead423ca6d6fb50a4d4f83af68e8f87688912
2017-08-02 00:00:47 -07:00
Felix Merk
9eb0bc6078 undo: prevent nested calls of log
Certain extensions (specifically infinite push) call full fledge mercurial
commands.  Since all proper mercurial commands might change the repo state,
these are tracked and changes are recorded, which at best causes confusing repo
states for the user and at worst prevents the user from undo-ing due to
precieved gaps in the log.  By using an env flag we can avoid this.

This change was tested in a repo with infinite push enabled with unit tests.

Differential Revision: https://phab.mercurial-scm.org/D198
2017-08-01 12:26:16 -07:00
Felix Merk
c63a96535a undo: cover lock error cases and add timeout
Lock error handling reduces likelyhood undo hangs or breaks other commands.
Fixes known bug of undo in read-only repo.  Undo is not neccesary for mercurial
to work and handles missing data (decently) well.  Failing silently (potentially
logging to scuba for timeouts) is acceptable, since if the issue is real we will
fail not silently when trying to undo.

Differential Revision: https://phab.mercurial-scm.org/D200
2017-08-01 12:24:44 -07:00
Mark Thomas
3bc43d7087 age: add age revsetpredicate extension
Summary:
Adds a new revsetpredicate: `age()`, which matches changesets that are
older or younger than a certain age.

Test Plan: Add new unit test for the predicate.

Reviewers: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D196
2017-08-01 03:12:04 -07:00
Saurabh Singh
f86c1f069f stat: template which outputs diffstat-style summary of changes
Summary:
There is an existing template "diffstat" which gives a minimal and not
very useful output containing the overall number of files that changed, total
number of lines inserted for all associated files, and total number of lines
deleted for all associated files.

On the other hand, the output from the command line option "stat" is much more
descriptive. Therefore, users end up using commands of the form



  hg log -r . -T '{author}{date}' --stat



When they would have preferred something like



    hg log -r . -T '{author}{date}{stat}'



This change adds the template "stat" which will allow for the desired behavior.

Test Plan:
  # Added a new test test-template-stat.t
  # Ran arc unit

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: akushner, medson, mjpieters, quark, rmerizalde

Differential Revision: https://phabricator.intern.facebook.com/D5521665

Tasks: 12422741

Signature: t1:5521665:1501287682:2afaea56b3dc863c52e6300c6bc482ae132a6a61
2017-07-31 11:09:50 -07:00
Zhihui Huang
784c334b8e p4fastimport: handle race condition in git fusion commits
Summary:
When a user commits changes to a git-fusion repo, it pushes commit to perforce as user git-fusion-user, and then update the commit's author to be the actual author. We want p4fastimporter to skip the git-fusion-user commit and import the commit by the actual author. This diff sets the basic workflow, where we specify the constraint to be commits by git-fusion-user that is less than 30 seconds old.
// TODO: make the constraint configurable.

Test Plan:
$ cd ~/facebook-hg-rpms/fb-hgext/tests/
// test race condition
$ python ../../hg-crew/tests/run-tests.py test-p4fastimport-gitfusion-race-condition.t
// test all
$ python ../../hg-crew/tests/run-tests.py test-p4*

Reviewers: #idi, davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5509536

Tasks: 20141882

Signature: t1:5509536:1501521842:17dd767615b8218980eda68d4113433d30805d92
2017-07-31 11:06:31 -07:00
Durham Goode
ab78eca81d perftweaks: add logging for rebase size
Summary:
Let's add logging for the size of rebases (the number of commits being rebased
and the distance over which they are rebased).

Test Plan: Ran a rebase and saw the data show up in ptail

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: stash, quark, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D169
2017-07-31 10:57:44 -07:00
Durham Goode
dcf434110d perftweaks: add update sizes to logging
Summary:
Let's log the number of commits we're traversing and the number of files
changed by an update.

Test Plan:
Ran it with --config
sampling.key.update_size=perfpipe_dev_command_timers and watched the entry show
up via ptail

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D166
2017-07-31 09:57:23 -07:00
Mateusz Kwapich
502f666449 metaedit: switch to scmutil.cleanupnodes for cleanup
Summary:
That switches us to use the higher level abstractions and allows us to
beneefit from things like showupdated (see: D173)

Test Plan: ran metaedit tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D191
2017-07-31 08:52:22 -07:00
Stanislau Hlebik
b88304992e fastlog: show all hg log output even if fastlog request failed
Summary:
We had a few troubles where fastlog failed with a weird error and people got
incorrect log output. While I still don't know why fastlog failed in the first
place, I've found the reason why log output was truncated. And this diff fixes
it. See the comments in the code for details.

Test Plan: Run unit-test

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D193
2017-07-31 00:58:55 -07:00
Kostia Balytskyi
6203a99ed4 sparse: also apply relative-path logic to --delete
Summary: Add `--delete` to the list of sparse options that understand cwd-relative paths.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D197
2017-07-30 08:42:40 -07:00
Kostia Balytskyi
99b1950cd9 sparse: make path absoluteness checks cross-platform
Summary: Let's be friendlier to our friends on Windows.

Test Plan: rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D194
2017-07-28 06:23:52 -07:00
Stanislau Hlebik
4e6c705cbd fastlog: cleaning up and remove dead code
Test Plan: Run unittests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D187
2017-07-28 02:33:00 -07:00
Jun Wu
fd71c30d42 inhibit: fix date handling and add more tests
Previously, inhibit may use a wrong date when writing markers. This patch
fixes that. Also add a test to check the date and make sure `revive` takes
effects inside a transaction.

Differential Revision: https://phab.mercurial-scm.org/D182
2017-07-27 12:33:43 -07:00
Jun Wu
c68b5e5cdb pushrebase: move bookmarks as well
Differential Revision: https://phab.mercurial-scm.org/D181
2017-07-27 12:33:43 -07:00
Mateusz Kwapich
89aa9cf5dd fbamend: add unhide command for easy unhiding of commits
Summary:
This command helps the user to bring back the commits to life with an explicit
command - wihtout the need to change working copy parent or create bookmarks.

Test Plan: see test

Reviewers: #fbhgext, durham, kulshrax, quark

Reviewed By: #fbhgext, quark

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D179
2017-07-27 03:39:01 -07:00
Mateusz Kwapich
ad3ecb91d5 fbamend: add hide - a simple command for hiding commits
Summary:
We have two commands for hiding commits:
 * strip - which has a lot of legacy options and legacy name
 * prune - which allows for creating arbitrary obsolescence markers

Both of them have complicated UI and are suboptimal experiences for unadvanced
user. The `hg hide` command is very simple, does one job and does it well.

Test Plan: see test

Reviewers: #fbhgext, durham, quark, kulshrax

Reviewed By: #fbhgext, quark

Subscribers: akushner

Differential Revision: https://phab.mercurial-scm.org/D178
2017-07-27 03:39:01 -07:00
David Soria Parra
f9f5201867 p4fastimport: ignore keyword expansion when using cvs tools
Summary:
When we are falling back to cvs tools to read content of a file, we still do
keywrod expansion through cvs `co` command. This patch disables the keyword
expansion.

Test Plan: run tests on test-p4*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5485123

Signature: t1:5485123:1500948788:fe4bc2fb8c50858ba7d8689bbf41d1de41b81000
2017-07-26 14:21:15 -07:00
David Soria Parra
6c6df646bf p4fastimport: use new bookmarks.applychanges API
Summary: Use new bookmarks.applychanges API to silence devel warnings.

Test Plan: python ../../tests/test-p4*

Reviewers: #idi, #mercurial, quark

Reviewed By: quark

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5485091

Tasks: 20395842

Signature: t1:5485091:1500948768:ab8c0a61e57791d4c871daa221f2ad78381fbe81
2017-07-26 14:21:15 -07:00
Simon Farnsworth
bb9d88ea1a githelp: don't crash when user does githelp -- git
Summary:
We didn't check for sanity when the user asked for hg githelp -- git -
oops. Fix the args test to catch you if you ask for help for git, as opposed to
(say) git commit.

Test Plan: Ran the new test cases.

Reviewers: #fbhgext, ikostia

Reviewed By: ikostia

Differential Revision: https://phab.mercurial-scm.org/D183
2017-07-26 08:51:21 -07:00
Mihails Smolins
d5c1c31862 tweakdefaults: show warnings when ':' is used to specify revs
Summary:
Wrapped _analyze parser to display developer warnings whenever ':' is used
implicitly or explicitly.

Test Plan: Added test cases

Reviewers: simonfar, durham, stash

Reviewed By: stash

Subscribers: medson, mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D5479645

Tasks: 12333181

Signature: t1:5479645:1501056920:304cbda9c0d7fe25dd600ec40c5d7540146c7889
2017-07-26 01:58:18 -07:00
Kostia Balytskyi
475c6c93fd sparse: add a config option to decide if paths are reporoot-relative
Summary:
Adding a knob to control how we perceive supplied paths is a good intermediated
step towards getting every user to use cwd-relative paths.

Test Plan: - rt

Reviewers: mjpieters, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D175
2017-07-25 10:43:55 -07:00
Jeroen Vaelen
5a8a556073 tweakdefaults: output new hashes when nodes get updated
Summary:
Users and particularly automation can benefit from having the new
revision hashes as part of the output of rebase and other operations that
update nodes. Right now, hacks such as getting the tip revision are used to get
that information.

Test Plan: unit tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce, durham, stash, quark

Differential Revision: https://phab.mercurial-scm.org/D173
2017-07-25 04:50:28 -07:00
Jeroen Vaelen
f786cd6bdb pushrebase: fix typo
Test Plan: unit tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D177
2017-07-24 11:42:24 -07:00
Lukas Piatkowski
8d71aaf0cf histedit: add --retry and --show-plan options
Summary:
--retry can be used instead of --continue when histedit failed on "exec" (due to it returning a non-zero exit code) and the user wants to repeate that command rather than continuing past it
--show-plan will print the remaining plan of histedit during an interrupted histedit

Test Plan: cd fb-hgext/tests/ && rt

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash, quark

Differential Revision: https://phab.mercurial-scm.org/D176
2017-07-24 09:32:47 -07:00
Ryan McElroy
eebb039cd7 tweakdefaults: remove --nocheck flag
Summary:
Core mercurial has a much better "nocheck" option now that we should just start
using. It's better and it's built-in!

Test Plan: Updated tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D164
2017-07-24 05:37:45 -07:00
Kostia Balytskyi
6b62dd3f52 sparse: properly error out when absolute paths are used
Summary: Current behavior does not even do what it says, let alone the right thing.

Test Plan: - rt

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D174
2017-07-24 02:12:37 -07:00
Jun Wu
2bb9371eef hiddenoverride: optionally log details
This allows us to log what nodes are pinned by what commands. So we can
manually investigate what was happening when we get user complaints.

Differential Revision: https://phab.mercurial-scm.org/D158
2017-07-21 10:50:30 -07:00
Jun Wu
35b19c0b64 uncommit: allow power users to leave an empty commit around
Some power user workflow requires `uncommit` to leave an empty commit so
they can run `hg amend` afterwards. I don't find easy alternatives so let's
allow that if `ui.allowemptyconfig` is set.

Note: `ui.allowemptyconfig` is an internal config that is not documented for
end-users. Core Mercurial seems to be trying to prevent the empty commit
case from normal users (like, comment disallows that, rebase will skip a
commit if after rebasing it becomes empty). So it seems better to still use
that undocumented config instead of a more discoverable flag.

Differential Revision: https://phab.mercurial-scm.org/D156
2017-07-21 08:06:47 -07:00
Stanislau Hlebik
932d143025 smartlog: do not draw public commits between draft commits and master
Summary:
We've seen a couple of issues when there are lots of public commits between a
head and master bookmark. Smartlog tries to draw all of the public commits
and drawing it can be too slow. See example below

```
   o - some commit that smartlog wants to draw
  /
o
.
.    -- many commits
.
o  - master bookmarks
```

This issue happens often while using infinitepush extension.
Let's fix it by drawing just one public commit between a head and master.
We could of course avoid drawing this public commit at all, but in that case
output would be smth like

```
   o - some commit that smartlog wants to draw
  /
o
|     - many commits in betwee, but user doesn't see it because there are no dots
o  - master bookmarks
```

Test Plan: Slowly run tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D168
2017-07-21 07:10:08 -07:00
Stanislau Hlebik
76ac8d65ff smartlog: nit fixes
Test Plan: Slowly run tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D167
2017-07-21 07:09:19 -07:00
Mark Thomas
03968e0663 uncommit: keep parent phase for full uncommit
Summary:
When fully uncommitting a commit on top of a public commit, uncommit
erroneously marks the new current commit with the same phase as the old
commit.  It should only do that in the case of a partial commit,
where the new current commit is a new commit.

Test Plan: Add tests to test-uncommit.t.

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D165
2017-07-21 13:27:57 +01:00
Simon Whitaker
d6b24eb1fe githelp: improve output of hg githelp -- git blame
Summary:
Adds user (-u), date (-d) and line number (-l)

If you use Phabricator, also adds Phabricator diff ID (-p)

Test Plan: run-tests.py -l test-githelp.t

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5469590

Tasks: 11078001

Signature: t1:5469590:1500633342:7be15f60e371dab7016ec44866ea369c696cb0a8
2017-07-21 12:08:18 +01:00
Jun Wu
dc9bcdf448 hiddenoverride: be more conservative about pinning nodes
I think the code works well but it might leave unnecessary pinned nodes
around. This patch makes it more conservative so that only a movement
(update or bookmark) on an obsolete commit would write new pinned nodes.

Differential Revision: https://phab.mercurial-scm.org/D157
2017-07-20 22:22:38 -07:00
Jun Wu
ee3c7459d5 logginghelper: resolve devel-warn 2017-07-20 22:09:22 -07:00
Adam Simpkins
39b79308d5 upgradegeneraldelta: update to work with upstream revlog changes
Summary:
Upstream mercurial commit c20590e65d36 changed revlog.versionformat from a
string to a struct.Struct object.  The upgradegeneraldelta extension needs to
be updated to deal with this.

Test Plan:
Confirmed existing tests pass, and manually tested using pull with
upgradegeneraldelta enabled.  I believe this extension shouldn't really be in
use in any repositories any more, but somehow some users did run into this.

Reviewers: #fbhgext, sid0

Reviewed By: #fbhgext, sid0

Differential Revision: https://phab.mercurial-scm.org/D162
2017-07-20 19:48:21 -07:00
Jun Wu
a63a59059c split: check unfinished first
Differential Revision: https://phab.mercurial-scm.org/D161
2017-07-20 18:21:58 -07:00
Stanislau Hlebik
214387fb21 infinitepush: re-enable lfs support
Summary:
D17 was reverted because it broke creating bundle for non-general delta repos.
The reason is the following: D17 made infinitepush extension override
changegroup.supportedoutgoingversion() function and discard '01' version.
For non-general delta repositories it resulted in broken `hg bundle ...`
command.
`abort: repository does not support bundle version 01`

This diff fixes it by not overriding supportedoutgoingversion(). Instead
getscratchbranchpart() has its own logic of selecting changegroup version.

Test Plan:
Run unit-test
Run `hg bundle -r . --base .^ somefile` in non-general delta repo,
make sure it works fine.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D81
2017-07-20 01:14:35 -07:00
Felix Merk
782636d475 undo: file corruption handling
Basic file corruption handling: if file is corrupted, we nuke our history.
Downside is that we won't be able to undo furter back in case of a corruption,
but considering corruption this is expected.

Differential Revision: https://phab.mercurial-scm.org/D111
2017-07-19 17:49:21 -07:00
Felix Merk
82603807d7 undo: meaningful obs markers for undos
Makes obs markers for undos more meaningful.  When an undo performs a strict one
to one change, the written obs marker reflects that and the user even gets a
helpful ui message in smartlog.  One to many undos do not support such obs
markers (currently) because we can't tell splits and divergence apart easily.

Differential Revision: https://phab.mercurial-scm.org/D108
2017-07-19 17:49:21 -07:00
Felix Merk
0077b01e13 undo: add --keep to maintian working copy changes
Allow user to keep working copy changes after undo, mimicking unamend and
uncommit behavior.  As discussed at the team lunch, this allows undo to remain
ignorant of what command the user has run while conforming to user expectations.
In the future this could be done in a smarter way where we properly restore hg
status dynamically.

Differential Revision: https://phab.mercurial-scm.org/D55
2017-07-19 17:49:21 -07:00
Felix Merk
b86893cb84 undo: adds -f flag and gap edge case handling
Prevents users from accidentally crossing gaps in their history and adds an
overwride.  In most cases undoing across a gap isn't desired as the connection
between the pre and post states is unkown.  While undoing across a gap is not
destructive or inherently risky, it is inherently confusing to the user since
we don't know how many and what commands where run.  Furthermore, there is no
guarantee that the pre and post states of a gap are actually connected in any
sane way.

Differential Revision: https://phab.mercurial-scm.org/D53
2017-07-19 17:49:21 -07:00
Felix Merk
1fd69b2cab undo: implements relative undo, hg redo and tests
Implements, and makes default relative undos and adds redos.  A relative undo
behaves differently only if you haven't performend any repo changing operations
since your previous undo or redo, in which case you operate relative to that
undo/redo.  This means that a second undo will not undo the previous undo but
instead bring you furter back.

Differential Revision: https://phab.mercurial-scm.org/D52
2017-07-19 17:49:21 -07:00
Felix Merk
683f74bc3b undo: bare bones undo without tests
Adds undo command that changes working copy parent, bookmarks and
visible draft commits to a previous repo state.

Differential Revision: https://phab.mercurial-scm.org/D51
2017-07-19 17:49:21 -07:00
Felix Merk
c18c86359b hiddenoverride: in memory/disc out of sync fix
Before, out of syncness of in memory state and on disc state caused certain
commands to (appear to) perform repo changes after they had returned.  This
broke hg undo.  This change fixes this by using the in memory state.

Differential Revision: https://phab.mercurial-scm.org/D150
2017-07-19 17:49:21 -07:00
Adam Simpkins
6a5431e1a3 phabstatus: query conduit more efficiently for "hg log"
Summary:
Update the phabstatus code to peek ahead at revisions to be logged by
`hg log` and `hg log --graph` and query phabricator for multiple revisions at
once, rather than having to query them one at a time.

Previously it had special integration with the smartlog where it could do this
for smartlog, but not for the normal "hg log" command.

Wrapping the revset iterator this way feels somewhat hacky, but this seems like
the best way to achieve the desired results without upstream changes.  (In an
ideal world we would perhaps update the log code to process things in an
asynchronous fashion, to better support templates that may take a non-trivial
amount time to render.  Ideally the revset query would be processed in parallel
with template rendering.)

Test Plan:
Confirmed existing tests still pass, and manually tested various combinations
of `hg log`, `hg log --graph` and `hg smartlog`

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D80
2017-07-19 12:34:46 -07:00
Adam Simpkins
98d62c4a8a phabstatus: clean up showsyncstatus()
Summary:
Refactor the showsyncstatus function to clean up the code a little bit.

- Don't bother to call populateresponseforphab() if the current commit does not
  contain a differential revision ID.
- Only call getdiffstatus() once instead of 4 times.  getdiffstatus() does
  cache the result instead of hitting phabricator each time, but it is still
  better to just re-use the return value ourselves instead of hitting the
  memoization code.
- Refactor the error handling to avoid having deeply nested conditional blocks.

Test Plan: Confirmed existing tests still pass, and manually tested using the template.

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D79
2017-07-19 12:34:46 -07:00
Jun Wu
6ed0a1e206 smartlog: only count visible successors
Invisible successors could be confusing. Therefore only show visible
successors.

Differential Revision: https://phab.mercurial-scm.org/D149
2017-07-19 10:43:01 -07:00
Fano Yong
050a2705e7 pushrebase.py modification to skip cache when _data is not found
Summary: pushrebase.py modification to skip cache when _data is not found

Test Plan: hg-dev rt pushrebase*

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mitrandir, medson, mjpieters, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D5367059

Tasks: 19603920

Tags: hg

Signature: t1:5367059:1500457213:d9870e1af74a4e27c1be2b08f440dc5e3f905947

Blame Revision: n/a
2017-07-19 09:09:04 -07:00
Ryan McElroy
f95c4e8f49 drop: fix check-code failures
Summary: These issues broke test-check-code-hg.t

Test Plan: test-check-code-hg.t now passes

Reviewers: #fbhgext, stash, simonfar

Reviewed By: #fbhgext, stash, simonfar

Differential Revision: https://phab.mercurial-scm.org/D145
2017-07-19 07:08:21 -07:00
Ola Kopczynska-Dobosz
379f8596da Adding drop command
Summary: Adding a drop extension which drops specified commit from the stack.

Test Plan: Unit tests which are part of this diff and manual testing.

Reviewers: durham, gshanbhag, #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: mitrandir, quark, #mercurial, phillco, avig, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5346014

Tasks: 19602078

Signature: t1:5346014:1500438430:b38acce97940fdeb7103ae70844cce71fdd79698
2017-07-18 21:57:03 -07:00
Arun Kulshreshtha
79baca1fcf fbamend: add --clean flag to hg prev/next
Summary: This patch adds a `--clean` flag to `hg prev` and `next` that discards any pending changes, similar to `hg update --clean`.

Test Plan: See included test changes.

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D140
2017-07-18 20:13:25 -07:00
Jun Wu
0e6e370774 hiddenoverride: avoid race condition updating the state file
Previously there is a race condition:

    origpinned = loadpinnednodes(repo)
    newpinned = ....
    with repo.lock(): # the lock might be taken by process X
        # get the lock after some time. at this time, the state file might
        # be updated by process X but we are not aware of it.
        savepinnednodes(...) # process X's change gets discarded

This patch solves that by making the write function takes a delta instead of
full content, and apply that delta inside a lock. Using repo lock is
expensive so we use a single-file lightweight flock instead.

Differential Revision: https://phab.mercurial-scm.org/D139
2017-07-18 16:07:33 -07:00
Jun Wu
2211d677b5 pushrebase: move working copy parent
When pushing the current changeset like `hg push -r . --to x`, try to update
the working copy parent.

Differential Revision: https://phab.mercurial-scm.org/D123
2017-07-18 12:16:04 -07:00
Jun Wu
c1a9fbc79e undo: move undolog to vfs and mark as lock-safe
The upstream has added some warning around repo.svfs/vfs write operations
without taking locks. For undo, we don't want to take the repo lock (since
that means read-only operations like `hg log` will be blocked by another
`hg commit`). So undo has its own locking and own transaction (for lower
overhead). Therefore move all files we may write (including lock and
transaction files) to `.hg/undolog` and whitelist the directory at
`localrepository._wlockfreeprefix` to bypass the checks.

Differential Revision: https://phab.mercurial-scm.org/D112
2017-07-18 11:30:05 -07:00
Ryan McElroy
1ba39b35d7 copytrace: remove unused error module import
Summary: This broke the check-code linter.

Test Plan: run linters and unit tests

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D137
2017-07-18 10:11:06 -07:00
Ryan McElroy
7a5f7434d2 config: do not pass defaults to registered config items
Summary: This prevents some recently-introduced devel-warnings from breaking the tests.

Test Plan: fewer devel-warns while running tests

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D131
2017-07-18 10:09:28 -07:00
Ryan McElroy
55611588d1 bookmarks: use new applychanges api in all extensions
Summary: This eliminates the recently-added devel-warnings.

Test Plan: fewer `devel-warn`s during tests

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D130
2017-07-18 10:09:28 -07:00
Ryan McElroy
b4c0bebf74 perftweaks: start using cachevfs
Summary:
Without this, we get develwarnings about vfs being deprecated for accessing
files under .hg/cache/.

Test Plan: run-tests, more tests pass

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D129
2017-07-18 10:09:28 -07:00
Mark Thomas
9d389170da copytrace: add fast copytracing for amends 2017-07-18 08:52:20 +01:00
Felix Merk
4fdf562a93 undo: improved performance and prep for hg undo
Implements lighttransaction(repo) which improves performance of hg undo and
prevents infinite loops caused by hooks that run true hg commands.  Also adds
_getrevlog and _invertindex commands, factoring out code that will be reused.
Changes output for gaps when typing hg debugundohistory -l for slightly
better ui and clearer testing. Lastly, changes lock from repo lock to new
undolog lock and tests this.  In the future, with some changes to undo.log,
we may be able to take the lock later, bypassing the need to take it for
read-only operations.

Differential Revision: https://phab.mercurial-scm.org/D50
2017-07-17 13:18:54 -07:00
Jun Wu
285b5a92e6 codemod: rewrite nested with
This is the result of running a codemod script:

  python ~/hg/contrib/codemod/codemod_nestedwith.py **/*.py

Plus a manual cleanup that removes the comment in `absorb/__init.py`.

See D76 for the codemod script.

Differential Revision: https://phab.mercurial-scm.org/D78
2017-07-17 12:02:08 -07:00
Stanislau Hlebik
196a16380c fastpartialmatch: fix devel.warn
Summary:
Upstream hg recently introduced new developer warning if files inside .hg are
modified without taking a lock. The usual fix is to add file in
localrepository._wlockfreeprefix list, but it doesn't work for "needrebuild"
fastpartialmatch file because it's stored inside .hg/store.
So to get rid of developer warning let's move needrebuild file to .hg/.
And since we are detecting that partial index needs to be rebuilt in revlog class,
I also had to wrap `runcommand()` and create needrebuild file there, because
`runcommand()` has vfs object, while revlog class doesn't.

Test Plan: Run tests

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D99
2017-07-17 04:03:15 -07:00
Durham Goode
655c9a4f08 obsshelve: update savebackup signature
Summary:
Upstream has changed the signature of saveback to include the full name. Let's
update to match it.

Test Plan: The test now passes

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D105
2017-07-17 04:02:43 -07:00
Durham Goode
d651fab9a8 tweakdefaults: take wlock when changing bookmarks
Summary:
Upstream has added devel-warnings when writing to vfs files without taking the
wlock. We need to take the wlock here.

Test Plan: The test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D103
2017-07-17 04:02:43 -07:00
Durham Goode
0afce8a31b cleanobsstore: fix devel-warning
Summary:
Upstream now warns when writing a vfs file outside of a lock. For this
particular file, it's safe to write it outside the lock, so let's add it to the
whitelist.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D102
2017-07-17 04:02:43 -07:00
Durham Goode
3c1c4327b8 mergedriver: move state writing into wlock
Summary:
Upstream has added devel-warnings for writing files without the wlock. This was
one instance.

Test Plan: Test now passes

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D100
2017-07-17 04:02:43 -07:00
Jun Wu
cd181c7ec8 fastannotate: mark as wlock safe
fastannotate has its own file-level flock implementation and does not need
to use the repo lock.

Differential Revision: https://phab.mercurial-scm.org/D91
2017-07-14 16:11:55 -07:00
Durham Goode
fd07b800c7 morestatus: add wlock around updateargs file
Summary:
Upstream has added a warning around writing files with locks. Since this file is
written as part of an update, let's just take the wlock.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D90
2017-07-14 15:55:26 -07:00
Durham Goode
9c003295c7 gitlookup: move writes into wlock
Summary:
Upstream has introduced a new warning when writing to a repo outside of the
lock. gitlookup triggers this during getgitmeta. Let's take the wlock.

Test Plan: Ran the tests. They now pass

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D88
2017-07-14 15:55:26 -07:00
Jun Wu
4e032f7260 hiddenoverride: improve writing logic
Avoid writing if nothing changes, and write inside a lock.

Differential Revision: https://phab.mercurial-scm.org/D86
2017-07-14 15:00:18 -07:00
Sen Li
b974a7cf2c adding hg amend --to option so it amends to a specific commit
Summary: adding hg amend --to option so it can amends to a specific commit

Test Plan: will add a test for this

Reviewers: juehui, durham

Reviewed By: durham

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5396805

Signature: t1:5396805:1499986779:d555d75c636e37adbe484b5b77c1844fcacfdc86
2017-07-14 12:06:22 -07:00
Durham Goode
e3a87e44e3 pushrebase: add pack files to storage during hooks
Summary:
Hooks should run with awareness of the tree pack data, so we need to pass the
temporary pack location as part of the hook environment.

Test Plan: Added a test

Reviewers: #fbhgext, simpkins

Reviewed By: #fbhgext, simpkins

Subscribers: simpkins

Differential Revision: https://phab.mercurial-scm.org/D8
2017-07-14 11:47:12 -07:00
Durham Goode
e1b7318640 pushrebase: add config for switching to treemanifest reading
Summary:
Adds functionality and a test for when clients pushes a tree pack to the server
without any flat manifest data, and the server writes the correct flat and tree
manifests during pushrebase.

Test Plan: Added tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: phillco, quark, dsp

Differential Revision: https://phab.mercurial-scm.org/D5
2017-07-14 11:47:12 -07:00
Durham Goode
937ee01b7d sparse: fix interaction with treemanifest
Summary:
Treemanifest relies on the matcher visitdir function, which was not implemented
in our special sparse matchers. Long term we should migrate to using the core
sparse extension. For now let's just implement visitdir().

Test Plan: Added a test. Previously the test would throw a big exception.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D84
2017-07-14 11:13:39 -07:00
Durham Goode
3102e456ab infinitepush: backout lfs fix
Summary: This broke hg bundle on non-generaldelta repositories.

Test Plan: Ran the tests

Reviewers: #fbhgext, stash, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D74
2017-07-13 13:53:40 -07:00
Jun Wu
0b38d6d44e hiddenoverride: unhide permanently by bookmark and working parent
We want these behaviors:

  - Checking out an obsoleted revision makes it visible even if another
    revision was checked out later
  - Putting a bookmark on an obsoleted revision makes it visible even if the
    bookmark was removed later
  - Strip/prune could make them hidden again

This is basically a lightweight version of independent hidden.

Differential Revision: https://phab.mercurial-scm.org/D70
2017-07-13 11:04:56 -07:00
Yan Yan
8e95eaafb0 Let non-existing client fail the import early
Summary: Check if the client exists, and if not, exit the import. Added a test for non-regression.

Test Plan: running test-p4fastimport-import-badclient.t

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5405340

Signature: t1:5405340:1499965824:394077f0d148be2e5fef15902c69703eaf360bbb
2017-07-13 10:18:39 -07:00
stash@fb.com
35d988093a infinitepush: handle lfs correctly
Summary:
Make sure that infinitepush work fine with lfs. To achieve it we try to use
changegroup3 if it's available and also run prepush hook before infinitepush.

Test Plan: Run `arc unit`

Reviewers: #fbhgext, quark, dsp

Reviewed By: #fbhgext, dsp

Differential Revision: https://phab.mercurial-scm.org/D17
2017-07-12 09:52:03 -07:00
Jun Wu
73aa574018 smartlog: remove temporary hack for old revset compatibility
The old smartlog revset is no longer used.

Test Plan:
Confirmed no user uses `smartlog('all')` or `smartlog('recent')` by searching
`smartlog(` globally.

Differential Revision: https://phab.mercurial-scm.org/D48
2017-07-12 02:25:01 +00:00
Durham Goode
5fe640c293 pushrebase: add comments and basic cleanup
Summary:
As part of refactoring the main pushrebase function, let's add some more
comments and move some declarations closer to where they are used (or delete
them entirely if the initial declaration is not used).

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340604

Signature: t1:5340604:1498751551:714faa78b8a3a01e165d7f5335484b89b7205995
2017-07-10 15:53:12 -07:00
Durham Goode
f9d954a907 pushrebase: refactor post rebase hooks to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340597

Signature: t1:5340597:1498751423:8b7ddce604ff7c9bfeea897afecaa7e7cfa8beb4
2017-07-10 15:53:12 -07:00
Durham Goode
c9fba7ef9e pushrebase: refactor rebase into a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340592

Signature: t1:5340592:1498751349:cf7172ac9c603db0d18a189dc02394f2f0a547f3
2017-07-10 15:53:12 -07:00
Durham Goode
4fc972bfe9 pushrebase: refactor push messaging to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340586

Signature: t1:5340586:1498751296:f931fb170e0092222a125dc34e2f6ffac74dcfb7
2017-07-10 15:53:12 -07:00
Durham Goode
433f6f1cd4 pushrebase: refactor onto resolution to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340576

Signature: t1:5340576:1498751222:7ba075ef49ea9d0ad368e6402fb9e61f0d1d0c94
2017-07-10 15:53:12 -07:00
Durham Goode
81959671dd pushrebase: refactor post-lock cache filling to be a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340571

Signature: t1:5340571:1498751172:4d926642c68611989ee439fbb0327d6e403cb555
2017-07-10 15:53:12 -07:00
Durham Goode
02bd7b1d57 pushrebase: refactor pre rebase cache prefetching to a function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340565

Signature: t1:5340565:1498751154:81c70d75131977defdaa7f92ef0a3b2214b86381
2017-07-10 15:53:12 -07:00
Durham Goode
dee8ff410d pushrebase: refactor prepushrebase hooks to function
Summary:
The pushrebase main function is too huge. Let's refactor it into smaller
functions so we can add treemanifest support safely later.

Test Plan: Ran the tests

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5340559

Signature: t1:5340559:1498751124:9c4542e0bbd041fcc584a8eb1122269135fe92c8
2017-07-10 15:53:12 -07:00
Durham Goode
474765111d pushrebase: handle incoming pack parts
Summary:
Now that packs are being sent across the wire during push, pushrebase needs to
handle those packs. It does so by adding them to the store list and replacing
the bundlerepo's data and history store with new ones that include the temporary
packs.

Test Plan: Future patch adds test around receiving trees in pushrebase.

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5329893

Signature: t1:5329893:1499706143:44afeacf594a4f87cdc0d96c3f2700dbd4aadd75
2017-07-10 15:53:12 -07:00
Durham Goode
f762741367 pushrebase: generate tree pack parts during push
Summary:
We want to enable pushing tree packs during pushrebase, and eventually we can
stop including flat manifest information entirely. The first step is to generate
the tree packs during push. A future patch will handle the incoming parts.

Test Plan: Ran the tests. A future patch adds pack file handling to test this

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5329775

Signature: t1:5329775:1499705168:43ea77c9a5c85c09b40910e102535d89a0504a4d
2017-07-10 15:53:12 -07:00
Jun Wu
18c1406b18 inhibitold: add back the old extension
Summary:
This allows us to quickly switch back to the old behavior somehow by using
Chef overrides.

Test Plan: The file was copied from the old revision. Therefore not tested.

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5392986

Signature: t1:5392986:1499722593:a895f94b3281ccba709fc219f927e8f6c770054a
2017-07-10 15:45:52 -07:00
Jun Wu
99386e40fd inhibit: update existing code to work with the rewritten version
Summary:
debuginhibit was removed since we no longer have a separate inhibit state.

smartlog hack about changing "o" to "x" was removed since "obsolete()"
revset is correct and the hack is unnecessary now.

directaccess was removed from tests since inhibit does not depend on it.

`- obsolete()` was added to some revsets to avoid divergence and other
surprises.

Use `inhibit.revive` API in infinitepush and reset to revive changesets
properly.

Remove various hacky code that mangle inhibit state in corner cases.

Most test changes are `o` changed to `x` in output since we draw
`obsolete()` state correctly now. `test-infinitepush-backup-remotefilelog.t`
change was because output could be `bytes/sec` instead of `KB/sec`.

Test Plan: arc unit

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: kulshrax, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5391361

Signature: t1:5391361:1499722618:d3c1cf629f0c59ecdf1dfd5e653c1eb6176646b8
2017-07-10 15:45:31 -07:00
Jun Wu
40503c20fb inhibit: completely rewrite the extension
Summary:
The main feature we want is to be able to unobsolete an already obsoleted
changeset. The old inhibit code is causing all kinds of unsolvable weird
cases and is hard to deubg or maintain.

This patch rewrites it completely. Basically, we now require people to use
obsmarkers to "unobsolete" changesets. We treat cycles in obsstore as a
normal case and break the cycle using date information.

It should be a neat and correct solution until we want marker exchange.

A "revive" API was provided for other extensions to use.

Tests and other code changes will be fixed in a follow up.

Test Plan:
`test-inhibit.t` was rewritten to test the new features.

Other tests are broken and skipped for now. The next diff will fix them.

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5391320

Signature: t1:5391320:1499716172:a946381421cc242411f5175ee3b7a3a0bc5a4f07
2017-07-10 15:45:07 -07:00
Jun Wu
b757e7498c codemod: use obsutil
Upstream has moved APIs to obsutil, and removed some APIs from obsolete.py
2017-07-07 20:54:19 -07:00
Adam Simpkins
4a7be070d7 phabstatus: fix interaction with the smartlog extension
Summary:
Previously phabstatus.extsetup() would throw an exception if the smartlog
extension was not in use and already loaded.

This fixes the code to use extensions.afterloaded() to ensure that we try to
wrap smartlog functions only after smartlog is loaded.  It also handles the
lookup error if smartlog is not in use at all.

Test Plan: Included a new unit test.

Reviewers: #mercurial, phillco

Reviewed By: phillco

Subscribers: medson, mjpieters, net-systems-diffs@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D5375301

Tasks: 16939242

Signature: t1:5375301:1499323251:4bc00c9cba79d60cbbb6738e8f1d648e75055cdb
2017-07-06 09:38:14 -07:00
Felix Merk
5ddcdfffe8 undo: add olddraft revset to return previous drafts
Summary: Register `olddraft([index])` revset returning draft changesets using undo data.

Test Plan: unit tests

Reviewers: stash, #mercurial, quark

Reviewed By: quark

Subscribers: mitrandir, quark, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5359322

Tasks: 19646287, 19261492

Signature: t1:5359322:1499122771:0a1e952a9bb4cd6b31d95a229ccb398cd6aafd1f
2017-07-03 19:01:09 -07:00
Felix Merk
ba1dce8f88 undo: deal with --hidden flag edge case
Summary:
Makes sure repo is filtered by the "visible" filter which hides hidden commits.
Otherwise --hidden flag can mass up "draftheads" storage.

Test Plan: Added a new test case.

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5357222

Tasks: 19822306

Signature: t1:5357222:1499102417:ce78065d36841601fe0dfb1d615d7b3be28c5870
2017-07-03 19:01:09 -07:00
Felix Merk
955a9bfcce undo: allow user to list or see details about undoable commands run
Summary: add hg debugundohistory -l to view recent undoable transactions

Test Plan: unit test

Reviewers: #mercurial, stash, quark

Reviewed By: quark

Subscribers: quark, mitrandir, durham, stash, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5325772

Tasks: 19646287

Signature: t1:5325772:1499122626:48dd25cee8ed8912c07a6c1dabb3d4286483a8b7
2017-07-03 19:01:09 -07:00
Jun Wu
605fa025ff morecolors: colorize uncaught exceptions
Summary:
Previously morecolors only changes "ui.traceback". This diff makes it replace
uncaught exceptions. It now conflicts with errorredirect (whichever loads last
will be effective) but that's probably fine since morecolors is intended for
the team only.

Test Plan: Added a test case.

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5347030

Signature: t1:5347030:1498751985:b8c750c5bfe4a25f1e0a4dd1cebcfa74fa8739b0
2017-06-29 09:55:25 -07:00
Kostia Balytskyi
d9a8476274 obsshelve: adopt upsteam changes regarding applybundle
Summary:
Upstream made a coupld of changes (including 4fadfa7f05a2a49a2554f0d70f9a35e085109d44), which changed how bundles are supposed to be applied. This breaks obsshelve's compatibility with old shelves.

This commit just ports the aformentioned upstream change into obsshevlve.

Test Plan: rt

Reviewers: quark, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5347598
2017-06-29 09:52:11 -07:00
Felix Merk
1abcb63689 undo: amend transacts twice
Summary: amend performs two transactions, second without command which breaks our assertion, but possibly isn't an issue. This fixes the assertion.

Test Plan: unit tests

Reviewers: #mercurial, stash, quark

Reviewed By: quark

Subscribers: quark, stash, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5326358

Tasks: 19261492

Signature: t1:5326358:1498684945:0fde1df243cdbac67ceb092d30599ebd56a731a5
2017-06-28 15:28:40 -07:00
Sen Li
3a87ac6ec2 errorredirect: modify errorredirect extension to send crash log to scuba table
Summary: Modify error redirect extension to send crash log, type and traceback to scuba table hgerrors

Test Plan:
Sample that is being sent to Scuba:
```
{
"int":{"time":1498528572},
"normal":{
  "host":"devvm26497.prn1",
  "metrics_type":"hgerrors",
  "msg":"exception has occurred: ** unknown exception encountered, please report by visiting\n** Source Control @ FB group\n** Python 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]\n** Mercurial Distributed SCM (version 4.2.1+842-79c3f212a9c9)\n** Extensions loaded: tweakdefaults, hgk, absorb, arcdiff, automv, blackbox, chistedit, color, debugcommitmessage, debuginhibit, evolve, fbhistedit, githelp, hiddenerror, histedit, inhibit, journal, logginghelper, lz4revlog, morestatus, moreversion, myparent, pager, patchrmdir, perftweaks, phabdiff, phabstatus, phrevset, pullcreatemarkers, purge, rage, rebase, record, remotefilelog, remotenames, reset, sampling, fbshow, sigtrace, simplecache, smartlog, sshaskpass, strip, directaccess, uncommit, conflictinfo, extorder, obsshelve, sqldirstate, fastmanifest, hgsubversion, traceprof, dialect, grpcheck, errorredirect, fbamend, pushvars, pushrebase\n",
  "traceback":"Traceback (most recent call last):\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 326, in _callcatch\n    return scmutil.callcatch(ui, func)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/scmutil.py\", line 145, in callcatch\n    return func()\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 308, in _runcatchfunc\n    return _dispatch(req)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 938, in _dispatch\n    cmdpats, cmdoptions)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/fastmanifest\/cachemanager.py\", line 318, in runcommandtrigger\n    result = orig(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/fastmanifest\/__init__.py\", line 175, in _logonexit\n    r = orig(ui, repo, cmd, fullargs, *args)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext3rd\/perftweaks.py\", line 263, in _tracksparseprofiles\n    res = runcommand(lui, repo, *args)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext3rd\/perftweaks.py\", line 248, in _trackdirstatesizes\n    res = runcommand(lui, repo, *args)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext\/journal.py\", line 76, in runcommand\n    return orig(lui, repo, cmd, fullargs, *args)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 674, in runcommand\n    ret = _runcommand(ui, options, cmd, d)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext\/pager.py\", line 69, in pagecmd\n    return orig(ui, options, cmd, cmdfunc)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 946, in _runcommand\n    return cmdfunc()\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/dispatch.py\", line 935, in <lambda>\n    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext3rd\/absorb\/__init__.py\", line 977, in _amendcmd\n    return orig(ui, repo, *pats, **opts)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext3rd\/tweakdefaults.py\", line 627, in cmd\n    return origcmd(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext3rd\/tweakdefaults.py\", line 694, in amendcmd\n    return orig(ui, repo, *pats, **opts)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/extensions.py\", line 273, in closure\n    return func(*(args + a), **kw)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/hgext\/automv.py\", line 63, in mvcheck\n    return orig(ui, repo, *pats, **opts)\n  File \"\/usr\/lib64\/python2.7\/site-packages\/mercurial\/util.py\", line 1056, in check\n    return func(*args, **kwargs)\n  File \"\/data\/users\/lsen\/facebook-hg-rpms\/fb-hgext\/hgext3rd\/fbamend\/__init__.py\", line 169, in amend\n    raise Exception(\"testing\")\nException: testing\n",
  "type":"<type 'exceptions.Exception'>"}
}
```

Reviewers: juehui, akushner, durham

Reviewed By: durham

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5326253

Tasks: 19602850

Signature: t1:5326253:1498577444:c62977ec782519a22b9dc64b33f2a575c544b83c
2017-06-27 09:44:29 -07:00
Jun Wu
e7998929ab inhibitwarn: temporarily add the extension back
Summary:
This extension is still enabled by other code that has a longer release
cycle. Add back the placeholder extension temporarily until we confirm their
release removed the config.

Test Plan: Adding an empty file should be harmless.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5321153

Signature: t1:5321153:1498500260:941dd1738a2ab3d3389c4251d86bf7c2ccc17648
2017-06-26 11:08:30 -07:00
Therin Irwin
66b64d8fb6 fbamend: change hint text to suggest running restack
Summary: Instead of referencing `hg rebase` --restack option, just reference the `restack` subcommand.

Test Plan:
1. Make a few commits 1, 2, 3, 4 on any branch
2. `hg update 1`
3. Try to amend commit 1
4. Warning message should appear about children left behind
expected: Hint text does not mention `hg rebase --restack`

Reviewers: durham, kulshrax

Reviewed By: kulshrax

Subscribers: medson, mjpieters, kkrewink

Differential Revision: https://phabricator.intern.facebook.com/D5313108

Tasks: 19601780

Signature: t1:5313108:1498249314:98f31f4424341ef51997687293bf99b7297b6cd0
2017-06-26 07:31:28 -07:00
Jun Wu
14440f1fcf tweakdefaults: add bookmark -D support
Summary:
It got removed from inhibit by D5258813. It's a useful feature so let's
re-implement it in tweakdefaults.

Test Plan: Added test cases with plain strip and fbamend's safe strip.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5313291

Signature: t1:5313291:1498321590:03e61a5b1acc2df44afcfd6ceb723e17c648ce79
2017-06-24 23:18:52 -07:00
Jun Wu
17886e370b fbamend: remove troublesome tr.release()
Summary:
`tr` could be None and `tr.release()` there is causing issues.

The next line actually checks `tr` and call `tr.release()` if `tr` is not None.

Test Plan: arc unit

Reviewers: #mercurial, wez

Reviewed By: wez

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5314538

Signature: t1:5314538:1498255892:084e1f5f1521ff7794be43b24510d2b54bf2148e
2017-06-23 15:12:46 -07:00
Felix Merk
fbd87d6923 undo: store op history
Summary: Store basic operational history: bookmarks, commands, private heads, date and working copy parent

Test Plan: Unit tests

Reviewers: durham, #mercurial, mitrandir, quark

Reviewed By: quark

Subscribers: stash, mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D5293596

Tasks: 19261492, 19563903, 19450726

Tags: Hg Undo

Signature: t1:5293596:1498245082:264e344054ee5061a439dec1c6071c2a60ffcf55
2017-06-23 12:19:09 -07:00
Jun Wu
c35c433212 smartlog: be graceful when ancestorcache db is corrupted
Summary:
We have seem some errors when closing the database during `db.close()`. This
diff nukes the database if that happens.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5305123

Signature: t1:5305123:1498166056:8355e861c18c670e6342e541f2bc55d65bc7b1c8
2017-06-22 14:15:56 -07:00
Mateusz Kwapich
afebcb5512 phabdiff: add singlepublicbase revset
Summary:
This revset will be used by jellyfish to set the proper base in sandcastle. Anyway: a public ancestor is
a valuable commit information so there should be a template for it.

Test Plan: see test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: durham, quark, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5275811

Tasks: 19186426

Signature: t1:5275811:1497979632:9589491be723daf0b127703a7bc4571f7539bd84
2017-06-21 17:03:50 +01:00
Jun Wu
ce21516db2 smartlog: use dagop.reachableroots
97fbbbc2ac35 moved reachableroots from revset to dagop.
2017-06-20 13:58:40 -07:00
Jun Wu
2df622a724 cleanup: remove fbmetaedit and inhibitwarn
Summary: We no longer use those extensions. Remove them.

Test Plan: arc unit

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D5286709
2017-06-20 13:58:40 -07:00
Durham Goode
55f677869b remotefilelog: use a connection pool instead of a long running connection
Summary:
Previously remotefilelog would open a connection and leave the getfiles command
running on that connection, so it didn't have to reopen the ssh connection each
time. We want to reuse this ssh connection for treemanifest and fastannotate, so
let's switch it to a pool model where the connection is kept open but the
getfiles command is not left open.

If an exception happens while the connection is out of the pool, it is discarded
instead of being added back to the pool.

Test Plan:
Ran the tests. The fastannotate tests changed to reflect the new way
the connectionpool allows use.

Reviewers: quark, #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mitrandir, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5280323

Signature: t1:5280323:1497975420:e3ae1ee854a1afc90816502543a19ff36f59b497
2017-06-20 11:08:15 -07:00
Jun Wu
32dd7f7841 fbamend: fix tests
Fix test issues caused by importing 0e0ff0ef4ad6.
2017-06-19 13:24:41 -07:00
Adam Simpkins
13bd099e74 pushrebase: improve blocknonpushrebase error message
Summary:
Improve the error message from the blocknonpushrebase hook to inform the user
that they need the pushrebase extension enabled.

Previously the message indicated that you mush push using
`hg push --to <bookmark>`, but this is not sufficient.  Enabling the pushrebase
hook is the most important step here.  (The `--to` flag is not part of vanilla
mercurial, and is added by pushrebase, but other extensions like remotenames
also add a `--to` flag.)

Test Plan:
Added a unit tests for `hg push --to <bookmark>` with remotenames enabled but
pushrebase disabled.

Reviewers: #mercurial, davidsp, zhihuih

Reviewed By: zhihuih

Subscribers: quark, medson, mjpieters, net-systems-diffs@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D5276550

Signature: t1:5276550:1497899421:3656bcc3e7358f97fc852e14307b34d8aa4d9951
2017-06-19 12:48:46 -07:00
Zhihui Huang
5e0994a87f p4fastimport: handle keyword extension
Summary:
Perforce has a feature called [[ http://answers.perforce.com/articles/KB/3482 | keyword expansion ]].

When a file is marked +k or +ko and you have a string like $Id$, it get's expanded to $Id: SOMETHING$ on Perforce. When importing a file like this from Perforce into Mercurial we need to do the reverse, renaming $Id: SOMETHING$ to $Id$ (and equivalent for all other expansion types).


Test Plan:
$ cd ~/facebook-hg-rpms/fb-hgext/tests/
$ python ../../hg-crew/tests/run-tests.py test-p4fastimport-import.t
$ python ../../hg-crew/tests/run-tests.py test-p4*

Reviewers: #idi, davidsp

Reviewed By: davidsp

Subscribers: davidsp

Differential Revision: https://phabricator.intern.facebook.com/D5266323

Tasks: 19211063

Signature: t1:5266323:1497890444:a1cced5faa5e48c708c2721510952ca4d27d1bd4
2017-06-19 11:54:10 -07:00
Tony Tung
6c4e900989 add date=implicitupdate option to automagically update the commit date 2017-06-19 09:50:32 -07:00
Tony Tung
c4d7df0a0f add the --date and --user parameters that commit supports 2017-06-19 09:50:32 -07:00
Mateusz Kwapich
250c2c7c4a metaedit: fix editing multiple commits
Summary: The recent refactoring brought back the original condition from metaedit that was preventing multi-commit metaedits.

Test Plan: see test

Reviewers: #mercurial, quark, stash

Reviewed By: stash

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5274562

Signature: t1:5274562:1497884504:f46988cd1926f52227a907e4e081e65de24080ad
2017-06-19 16:03:17 +01:00
Jun Wu
3d461ae600 check-ext: make checks stricter
Summary:
Enhance check-ext script to be more strict:

 - Only one foreign extension is allowed: `remotenames`
 - Require explicit path for in-repo extensions to avoid wrong extensions
   being tested

This would make the test more predicatable since system extensions
will be less likely to be imported. Explicit path is better than
setting `PYTHONPATH` since `hgext/name.py` could override
`hgext3rd/name.py` regardless of `PYTHONPATH`.

Test Plan: arc unit

Reviewers: phillco, durham, ikostia, #mercurial, stash

Reviewed By: stash

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5271430

Signature: t1:5271430:1497861776:7dd35ec7c522cd9b26aa0871cb4306b4f1b8993a
2017-06-19 08:02:38 -07:00
Stanislau Hlebik
7b8cb0004c debugcommitmessage: fix tests
Upstream 608e426d0577d44f4d5030dc6d71e57d691ca3da changed the API. Now template
ref should be passed instead of template itself. This diff fixes it.
2017-06-19 03:01:18 -07:00
Jun Wu
a6c7fc128f allowunstable: remove the extension
Summary: allowunstable is no longer used. So remove it.

Test Plan: arc unit

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5258845

Signature: t1:5258845:1497602890:4b9c7cffc2132df0a7059fe2fdbeddf3e21c1875
2017-06-16 15:54:15 -07:00
Jun Wu
be7ac42b50 codemod: replace evolve by fbamend
Summary:
Now that fbamend has most of the features we want. Replace evolve
used by tests.

Minor changes are made to some extensions to make test pass:
- reset: drop commit reviving support (was provided by "hg touch")
- smartlog: do not assume who provides "allsuccessors" revset
- fbamend: return 1 on "nothing changed"
- fbamend: write operation data for split and fold
- fbamend: do not print incompatibility notice
- fbamend: do not disable itself when rebase is not enabled
- inhibit: remove `bookmark -D` option - use `prune -B` instead

Test Plan: arc unit

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5258813

Signature: t1:5258813:1497604051:0c7334f9a6554cf31aaaaa2a4995b17d4e445847
2017-06-16 15:50:01 -07:00
Jun Wu
2dc367dac3 inhibitwarn: nuke the extension
Summary:
We are going to remove evolve and inhibit. So the warning is no longer
useful.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: ikostia, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254984

Signature: t1:5254984:1497518474:80649544fef3aee90bf9a407d45ddeb9f6d85dba
2017-06-16 14:40:31 -07:00
Jun Wu
d06133e837 fbamend: backport prune
Summary:
Backport the prune command and its strip wrapper from mutable-history changeset
cb0d62ed5e2a using GPL2 license.

There are some adjustments to make the ported code work well with existing
code better, namely:

  - Add a `safestrip` option to control whether `strip` is replaced to `prune`
    or not.


Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254961

Signature: t1:5254961:1497518704:91b200bf791297ff797cc0ff28ab31d7eb294963
2017-06-16 14:39:04 -07:00
Jun Wu
2852dabbc8 fbamend: merge fbmetaedit
Summary:
Merge fbmetaedit which uses a fast path to change commit messages.

Make fbmetaedit a no-op.

Test Plan: arc unit

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254867

Signature: t1:5254867:1497524975:c7cc3ad9d1162332fbdd665eb5a2f6d7ce87a585
2017-06-16 14:12:32 -07:00
Jun Wu
87b248dd27 fbamend: backport metaedit command
Summary:
Backport the metaedit command and its test from mutable-history changeset
cb0d62ed5e2a using GPL2 license.

There are some adjustments to make the ported code work well with existing
code better, namely:

  - Removed allowunstable check to simplify the code.
  - Make "nothing changed" return 1.
  - Minor i18n and check code fixes.

Note: this backport does not include fbmetaedit changes.

Test Plan: arc unit

Reviewers: #mercurial, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254807

Signature: t1:5254807:1497524996:abf856dc9bb8225316ca6c17f41ffa2c9d8d9964
2017-06-16 14:11:43 -07:00
Jun Wu
04579ab177 fbmetaedit: do not assume evolve provides metaedit
Summary: This is temporary as fbmetaedit will be merged into fbamend.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254803

Signature: t1:5254803:1497520047:2c6eb22ce8cb80e4c785fd0b82311706487f6c7e
2017-06-16 14:07:02 -07:00
Jun Wu
c7c3280b44 fbamend: backport fold command
Summary:
Backport the fold command and its dependencies (`rewrite`) from mutable-history
changeset cb0d62ed5e2a using GPL2 license.

There are some adjustments to make the ported code work well with existing
code better, namely:

 - The `--norebase` flag was renamed as `--no-rebase` and moved to the
   backported command so we no longer wrap the split command.
 - Rebase now runs inside a same transaction.
 - `bookmarksupdater` now accepts multiple revs so bookmarks on all changesets
   being folded will be updated correctly. It is a bugfix to the ported code.

Test Plan:
`arc unit`.
Some tests are changed. It seems the new behavior looks better.

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: ikostia, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254681

Signature: t1:5254681:1497520003:f7ec3622286804fead059ab9a8021bb8f3067e64
2017-06-16 14:06:24 -07:00
Jun Wu
020ff84b79 fbamend: backport split command
Summary:
Backport the split command and its dependencies (namely, `bookmarksupdater`)
from mutable-history changeset cb0d62ed5e2a using GPL2 license.

There are some adjustments to make the ported code work well with existing
code, namely:

 - The `--norebase` flag was renamed as `--no-rebase` and moved to the
   backported command so we no longer wrap the split command.
 - Rebase now runs inside a same transaction.

The glob change in tests is because `(tip)` shows up.


Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: ikostia, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254544

Signature: t1:5254544:1497519470:fe8a7308b35b578fd4f1257cebba15062e752c2f
2017-06-16 13:59:12 -07:00
Jun Wu
08e9bc0bbf fbamend: make restack take inhibithack
Summary:
This hack is needed to make split + rebase work well inside a same transaction.

inhibit does special things at the end of a transaction which may override deinhibit.
Sometimes we want deinhibit to override the transaction close handler.

The hack will be removed once inhibit gets removed.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: ikostia, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254517

Signature: t1:5254517:1497519294:89b6de077514252c42fb128760cf9f9241180242
2017-06-16 13:55:29 -07:00
Jun Wu
30b417ea27 allowunstable: do not assume evolve provides split and fold
Summary:
split and fold will be backported and removed from evolve. So do not assume
evolve provides them.

Test Plan: Not breaking existing tests

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254455

Signature: t1:5254455:1497519005:aca0373cc61ca5438cee1c9d85f2df77f33d8455
2017-06-16 13:54:03 -07:00
Jun Wu
edf220db3a inhibit: allow _deinhibitmarkers inside a transaction
Summary:
inhibit hacks transactioncallback so _deinhibitmarkers might be ineffective
inside a transaction. This diff adds a flag to allow _deinhibitmarkers
effective inside a transaction. It will be used by the split backport.

Test Plan: No new test being added since inhibit is a hack and is going to be removed.

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254416

Signature: t1:5254416:1497519161:b01f3fa59004ded5beaf5dcfc7d18eb2b5227130
2017-06-16 13:52:29 -07:00
Jun Wu
200a9b16fb fbamend: implement successors and precursors revsets
Summary:
We are depending on `allprecursors` and `allsuccessors` revsets in multiple
places. Re-implement them in fbamend.

Also reimplement `successors` and `precursors` since they are used by some
other code.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5254403

Signature: t1:5254403:1497519041:8c6f001a6acf8056b5f795575b42922a476ac34b
2017-06-16 13:48:14 -07:00
Jun Wu
7e8b62aef6 lfs: add retry logic for transferring a single object
Summary:
We got TCP RESETs frequently. It's hard to pinpoint the root cause so let's
just add retry for now.

Test Plan: eyes

Reviewers: #mercurial, #ovrsource_warroom, steaphan

Reviewed By: steaphan

Subscribers: steaphan, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5265928

Tasks: 19419154

Signature: t1:5265928:1497635499:17cf5d5cb69b406330326d693a9eceb1d22861f8
2017-06-16 10:54:07 -07:00
Jun Wu
3556ad01c5 fbamend: rename conflicted evolve commands instead of removing them
Summary: This unbreaks `experimental.evolutioncommands`.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5256903

Signature: t1:5256903:1497547902:9af6930776fc272db0c7d1bbfca2f4e76342255a
2017-06-15 10:35:28 -07:00
Felix Merk
88a744be9e smartlog: let smartlog revset take recentday argument
Summary: Add an optional `recentdays` parameter to smartlog revset.

Test Plan: Added test to test-smartlog.t

Reviewers: #mercurial, durham, quark

Reviewed By: quark

Subscribers: durham, stash, mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5211513

Tasks: 19179819

Signature: t1:5211513:1497487196:f7d59ec32c09680ed769977890f3031369f7652e
2017-06-15 10:06:09 -07:00
Stanislau Hlebik
6c09d4ce19 rage: add a hack to make rage work on osx
Summary: Add a config option to specify rpm binary

Test Plan: arc unit

Reviewers: #mercurial, quark, ikostia, luk

Reviewed By: ikostia, luk

Subscribers: luk, mjpieters, medson, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5255174

Tasks: 19361425

Signature: t1:5255174:1497518216:d78a66e27a1073921f06d9dd0e7036bab3e4010a
2017-06-15 04:20:52 -07:00
Stanislau Hlebik
31e9c3d80b copytrace: fix logging
ctx.node() is None, so it's bettter to use ctx.hex()
2017-06-15 04:08:49 -07:00
Felix Merk
5c4ff4f39f tweakdefaults: add --inactive flag to update command
Summary:
People want update to optionally not activate a bookmark.
This diff adds an `--inactive` flag to do that.

Test Plan: Added test-update-i.t

Reviewers: durham, #mercurial, quark

Reviewed By: quark

Subscribers: mitrandir, mjpieters, medson, durham, akushner, quark

Differential Revision: https://phabricator.intern.facebook.com/D5228552

Tasks: 8097957

Signature: t1:5228552:1497396566:16322e1a2dfdab30a213ddc37cbde4fc71bffcc0
2017-06-14 16:42:39 -07:00
Olivier Trempe
7b57890313 pushrebase: make pretxnchangegroup and changegroup hook arguments consistent with mercurial hook documentation
Before this patch, the pretxnchangegroup 'node' argument would be the last
added node whereas mercurial documention specifies that it should be the first
new changeset. The 'node_last' argument has also been added to both
pretxnchangegroup and changegroup hooks as per mercurial documentation.
2017-06-14 16:29:16 -07:00
Olivier Trempe
602a765fe6 pushrebase: bring variable initialization closer to first usage 2017-06-14 16:29:16 -07:00
Jun Wu
8d58d00052 fbamend: move restack to a separate file
Summary: This makes `__init__.py` smaller.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5223421

Signature: t1:5223421:1497387183:9ce70419c3c63ca55f1a225192ae7a6556316ea3
2017-06-13 17:09:34 -07:00
Jun Wu
3ab3ee018a fbamend: move next, previous to a movement.py
Summary:
Move movement commands (next, previous) to `movement.py`. Some common utilities
were moved to `common.py`. I did some minor cleanups on the help output.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5222981

Signature: t1:5222981:1497265815:5dbba53fe7a16dbf924898331496a5c50b54b9f2
2017-06-13 17:09:16 -07:00
Jun Wu
e1f58d87e3 fbamend: move unamend to a separate file
Summary:
Going to split fbamend into individual files by commands. `unamend` seems
self-contained to be moved out.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5221159

Signature: t1:5221159:1497261013:d371bcf4406277228fc4f3f6c6aaa4600dab4823
2017-06-13 17:08:50 -07:00
Jun Wu
f1b6191c18 fbamend: move to a package
Summary: `fbamend.py` is already long. It will become more complex so let's move it.

Test Plan: arc unit

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Differential Revision: https://phabricator.intern.facebook.com/D5209475

Signature: t1:5209475:1497260957:e84aec4a2f90c8dd1d247b2b0caef48cfbb59c55
2017-06-13 17:08:20 -07:00
Olivier Trempe
0e2e9efbc7 pushrebase: add node_onto argument to prepushrebase hook
This helps doing some validation before accepting a pushrebase.
For example, if you want to prevent users to accidentally pushrebase
changesets to the wrong branch by checking if all pushed changesets are
on the same branch as the destination (--to)
2017-06-13 16:32:25 -07:00
Stanislau Hlebik
defa69c1d8 extorder: fix test
Summary:
There was a change in core mercurial b319e3173a9534a2b7750b69ef446a803c3145ff
that catches all exception from uisetup and extsetup. Let's throw subclass of
BaseException in this case.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters, medson, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5236650

Signature: t1:5236650:1497363414:9bbde3cabb696bb77a7ffddcb576923e5743c993
2017-06-13 09:13:41 -07:00
Stanislau Hlebik
300bc72abd absorb: fix test
Upstream e0fc50267c46 removed makememctx() function and requires filectxfn to
be an instance of patch.filestore.
2017-06-13 07:17:36 -07:00
Stanislau Hlebik
b82acd87f7 conflictinfo: fix test
There was a bug that was introduced upstream in 469914605447 and fixed in
758d59a5f3515b18c767af69f4ed28060f8af56c. This diff reflects the changes.

Also filestat was changed in 4091c920ac07e27ee8536715297127e56d536dab.
2017-06-13 07:15:54 -07:00
Stanislau Hlebik
5a69e3d88a tweakdefaults: dump per file diff statistic in json
Summary:
Upstream mercurial --stat option shows only aggregated statistics for all
files. This diff make it possible to get diff statistics per file.
It can be used by automation.

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, medson, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5203835

Tasks: 18508761

Signature: t1:5203835:1496981602:c8a649158892d05442d8d0aa717589974b92ff6b
2017-06-13 03:38:54 -07:00
Stanislau Hlebik
0077886854 copytrace: do not log if file contexts were the same
Summary:
One one more improvement to logging to better measure the impact. Do not log if
file contents are the same as it is explained in the comment.

Depends on D5217007

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters, medson, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5218112

Tasks: 18508761

Signature: t1:5218112:1497317521:e73e8ebe01a4a8ca73ad9fc87b5608d4c9f5484c
2017-06-13 01:57:07 -07:00
Stanislau Hlebik
cb9f3c9a22 copytrace: log file paths and hashes
Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D5217007

Tasks: 18508761

Signature: t1:5217007:1497020693:a42d44bf26ca991e3143f41b77148e3803c0267d
2017-06-12 02:49:20 -07:00
Stanislau Hlebik
84ab17a89a copytrace: exlude added files
Summary:
Previously if file was added in source then it would be considered missing in
destination. This behaviour won't add incorrect copies, but it would do
additional work of checking move candidates for the added file. This diff fixes
it.

Test Plan: arc unit

Reviewers: #mercurial

Subscribers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5190369

Tasks: 18508761
2017-06-07 03:40:54 -07:00
David Soria Parra
b0d59e858a p4fastimport: implement transaction.find and .replace
Summary:
revlog uses transaction.find and transaction.replace in cases where a
datafile is separated from an index (>= revlog._maxinline). In these cases the
importer broke as we did not implement find and replace in filetransaction.

We implement the two methods. However we ned a save way to store the data
portion which find must correclty return. We cannot store json as some
serializations aren't bidirecitonal. We can't store pickle as \n is a common
separator in pickle, and we use that to separate our entries. So we use pickle
and then base64 encode it. This is cumbersome but works.

The fix is aimed to make things "work" and I want to explore options to better
implement find and replace.

Test Plan:
- Working on a test that correclty triggers inline -> separation.
- Deployed it to our test system with test data and see commits comming in.

Reviewers: #idi, #ovrsource_warroom, #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D5189308
2017-06-06 19:54:29 -07:00
Kostia Balytskyi
afad4c3c15 inhibitwarn: stop using strftime('%s') because it is wrong
Summary:
%s is not supported, works on Linux by accident, does not work on Windows.
https://stackoverflow.com/questions/11743019/convert-python-datetime-to-epoch-with-strftime

Test Plan: - run tests

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5191450
2017-06-06 12:02:00 -07:00
Kostia Balytskyi
666b06e763 obsshelve: get rid of isobsshelve function and its uses
Summary:
Since it is now an independent extension, we don't need to have a knob
to enable/disable obs-based shelve, we can just enable/disable the entire
extension itself.

Test Plan: - run a test

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5181001
2017-06-06 05:50:19 -07:00
Kostia Balytskyi
cc087222de obsshelve: make sure shelve and obsshelve cannot be enabled same time
Summary: Just for an early detection of bad config being distributed.

Test Plan: - add a test case

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5180986
2017-06-06 05:48:28 -07:00
Kostia Balytskyi
222003b2ac obsshelve: copy the patched shelve.py from core
Summary:
Grand goal is to remove all of the shelve-related hotfixes and just have
a separate extension, obsshelve, which we could roll out to all FB users
without worrying about upstream.

This commit just copies current version of core's shelve.py with FB hotfixes
applied on top of it. The only changes are changes in testedwith and a
description at the top of the file and an import of rebase from hgext rather
than '.'.

Test Plan: - it is not enabled and tests are added in a later commit in this stack

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5180947
2017-06-06 05:43:39 -07:00
Stanislau Hlebik
b03156c294 tweakdefault-blame: fix test
Upstream 135567a9d3e46a5686343e3a40f15482f7787a48 changed blame formatting.
This diff fixes tweakdefault to use this new formatting.
2017-06-05 14:56:36 -07:00
Stanislau Hlebik
0aa84957c7 copytrace: remove useless and add useful logging
Summary:
Previously we logged every time there is a changed/deleted file conflict.
This generates lots of useless log entries. Most of these entries are valid
conflicts where one file was deleted and another was added. Besides analyzing
these log entries is manual and very time consuming. Let's instead log cases
where copytracing actually helped.

Test Plan:
arc unit
Run with hg-crew test suite with --extra-config-opt

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5175656

Tasks: 18508761

Signature: t1:5175656:1496651487:fe710731213b21aefd1b957d259dc93470c9545c
2017-06-05 02:17:54 -07:00
Stanislau Hlebik
ce077253b5 copytracing: trace copies in draft commits
Summary:
Simple copy tracking for draft commits. It doesn't use db to save move info
because getting move info is quite fast already.

Depends on D5137372

Test Plan: Run tests

Reviewers: #mercurial, durham, quark, rmcelroy

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5137886

Tasks: 18508761

Signature: t1:5137886:1496348869:8f4a9761fdeb26ddee5e18a318cc85582ef4adbb
2017-06-02 01:27:13 -07:00
Jun Wu
767de0233b annotate: use keyword arguments for skiprevs and diffopts
Summary: This will be safer if upstream API ever changed again.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5147881

Signature: t1:5147881:1496326141:c70559ffe2bb43953a1a0584163ca24c3235c5f3
2017-06-01 08:58:00 -07:00
Stanislau Hlebik
9e8ca3ae43 copytrace: use filename heuristics to quickly find moves
Summary:
Copytracing that is based on a simple idea: most moves are either directory
moves or moves of the file inside the same directory. That means that either
basename of the moved file or the dirname of the moved file is the same.
More details in the comments.

Test Plan: Run unit-tests

Reviewers: #mercurial, durham, quark, rmcelroy

Reviewed By: quark, rmcelroy

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5137372

Tasks: 18508761

Signature: t1:5137372:1496243148:8d229c1593da196b674318ee8b37af15a60831c8
2017-06-01 04:39:27 -07:00
Adam Simpkins
1b9a5fdc5c tweakdefaults: fix hg pull --rebase with a --tool argument
Summary:
Fix the tweakdefaults code to extract the --tool argument when extracting
--rebase, and to pass it in to the rebasemodule.rebase() function correctly.

Test Plan: Included a new test.

Reviewers: #mercurial, rmcelroy, quark

Reviewed By: quark

Subscribers: quark, net-systems-diffs@fb.com, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5134466

Tasks: 18770938

Signature: t1:5134466:1495848690:308a8d3fbad39e6ecfeaee04b1b3267c1fa1118c
2017-05-31 10:58:49 -07:00
Stanislau Hlebik
72641e2afc copytrace: remove useless sorting
Summary: It was added by mistake, let's remove it.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.intern.facebook.com/D5155301

Tasks: 18508761

Signature: t1:5155301:1496246623:a650cbffa7edf4311f96071e57c61697dae8014e
2017-05-31 09:04:59 -07:00
Stanislau Hlebik
699e45aef6 copytrace: better copytracing logging
Summary:
1) Log commit hashes. Since we have infinitepush we may see the actual commits that caused the problems.
2) Log reponame
3) Wrap logging code in try/catch so that any errors in this code won't affect clients

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5146976

Tasks: 18508761

Signature: t1:5146976:1496241350:1d8a921527a0e2d984f6a46452697428df1757be
2017-05-31 07:51:29 -07:00
Kostia Balytskyi
44cd7a5717 smartlog: use dbm implementation, available on the system
Summary:
`gdbm` is unavailable on Windows. Python provides module called `anydbm` which
abstracts the implementation of `dbm` and is even capable of using a dump
Python-only implementation if nothing is installed.

Test Plan: - rt

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5154620
2017-05-31 04:11:53 -07:00
Phil Cohen
45b775ae72 pushrebase: exchange -> bundle2
Summary: Broken by an upstream refactor

Test Plan: Fixes test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5149611
2017-05-30 13:13:36 -07:00
Jun Wu
cc95aa58ff test-inhibit: fix the test
Summary: Fix lint errors and make the test pass.

Test Plan: arc unit

Reviewers: #sourcecontrol, sid0

Reviewed By: sid0

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5142477

Signature: t1:5142477:1496173824:bf941d895d3259fc788c09d4fefca7dddd11a33b
2017-05-30 12:56:20 -07:00
Jun Wu
e3e36e37ec inhibit: vendor inhibit and directaccess from mutable-history
Summary:
Vendored using GPL2 license from https://bitbucket.org/marmoute/mutable-history
changeset c9f1118b33d60f8faa4b89988a8155c544f5bb0d without modification.

Test Plan: N/A. The code was imported as is.

Reviewers: #sourcecontrol, sid0

Reviewed By: sid0

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5142063

Signature: t1:5142063:1496173803:d0a9fa50a8423a531432ac3cff378b50952684b1
2017-05-30 12:55:33 -07:00
Jun Wu
78c76613b9 annotate: add skiprevs parameter
Summary:
This adds the `skiprevs` parameter to all `filectx.annotate` methods
to match the upstream change.

For fastannotate, things is a bit more complex since it's a mix of two
algorithms. For now we just fallback to the slow path for correctness.

I'll think about adding back a fast path later.

Test Plan: arc unit

Reviewers: sid0, #mercurial, quark

Subscribers: stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5128392
2017-05-30 09:29:33 -07:00
Stanislau Hlebik
23e41d98e5 copytrace: move to hgext3rd
Summary:
copytracing extension is going to be simpler than I expected in the beginning.
There is no need to separate folder, let's move it to hgext3rd

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5146585

Tasks: 18508761

Signature: t1:5146585:1496147733:ad6ad14f663a8b9bf4b687f0767395321f9840b7
2017-05-30 06:39:31 -07:00
Stanislau Hlebik
bbe014cb96 perftweaks: remove newhiddencache
Summary: Upstream dropped hidden cache in 2f38ac4af04e70af3ffce4700c5a15252391e391, let's drop newhiddencache too

Test Plan: arc unit

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5146661

Signature: t1:5146661:1496140799:a5a4ddeac577f58a7e1998a5f9fb2eac305cc9d2
2017-05-30 03:42:56 -07:00
Jun Wu
3ed8d7b512 smartlog: add a simple ancestor cache
Summary:
`revlog.ancestor` is expensive on long changelog, but is only called a few
(about 30) times for smartlog usage. Therefore we could simply cache the
result in a key-value database.

This speeds up smartlog by about 200ms.

Test Plan: Added a new test

Reviewers: #mercurial, stash

Reviewed By: stash

Subscribers: stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5135746

Signature: t1:5135746:1495783503:411260551fd29fda42c9fc809b56f8f77fb2eaf4
2017-05-26 09:03:58 -07:00
Durham Goode
5caecec1ee sparse: switch to using repr for hash computation
Upstream is refactoring the matcher api (952017471f9) and recommends using repr
for hash computation now. This is how fsmonitor in core now does it.
2017-05-24 09:24:19 -07:00
Durham Goode
0d916abbed perftweaks: rename _getdynamicblocks to revealedrevs
Upstream has renamed this function.
2017-05-24 09:18:45 -07:00
Durham Goode
56be761d2e chistedit: fix lint error 2017-05-23 15:38:09 -07:00
Jun Wu
3b9d8cf876 traceprof: store raw Python code object
Summary:
Previously, the tracer extracts file name, function name from Python code
objects and stores them as std::string. And frame the de-duplication logic
hashes those strings, which is actually quite expensive.

`hg id` takes 1.0 seconds without frame de-duplication, and 2.5 seconds with
de-duplication.

This diff assumes Python code object is unique (i.e. Python won't generate two
code objects for a single code segment). That seems reasonable and `lsprof`
seems to make a same assumption.

With that assumption, just store `PyCodeObject` (contains file, method name and
line number) instead of `std::string` (for file, method names) and line numbers
for code identity and use the raw address of `PyCodeObject` to do frame
de-duplication.

That is helpful during profiling and de-duplication:

  - During profiling, no need to copy strings (convert to std::string),
    therefore less overhead
  - During frame de-duplication, no need to read long strings and hash them,
    therefore much faster

Debug flag during compilation is added to make debugging easier as the code
starts to mix of C++ and Python objects, which means mistakes could be made
more easily.

Test Plan:
With this patch, `hg id` with frame de-duplication takes 1.0 seconds.
There is no visible overhead doing de-duplication. Cheers!

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5112636

Signature: t1:5112636:1495562232:dd0724198ebb7f2eb4e9fd3a83517fc9160fa01e
2017-05-23 11:51:10 -07:00
Jun Wu
85be37794d traceprof: implement frame deduplication
Summary:
Previously, traceprof hashes frames using their raw memory addresses, which
causes a same frame (same traceback) being recorded multiple times because
of memory address change. That's for low overhead because hashing all the
way back to the top frame is slow.

This patch implements slow frame hashing and de-duplication so the output
could look tidier in some cases. The slow de-duplication runs after
profiling ends so it won't affect profiling accuracy.

Test Plan:
Trace IPython, before:

```
  6211          \ run                           posix.py:50
  6152            \ call_inputhook (10 times)   inputhook.py:60
                    ....
  6147              \ select_fds (10 times)     select.py:194
     6                \ select                  select.py:85
     6                 | select                 select.py:179
   501                \ select                  select.py:85
*  501                 | select                 select.py:179
  3775                \ select                  select.py:85
* 3775                 | select                 select.py:179
*  627                \ select (2 times)        select.py:85
   736                \ select (3 times)        select.py:85
*  736                 | select (6 times)       select.py:179
   501                \ select                  select.py:85
*  501                 | select (2 times)       select.py:179
```

After:

```
  4397          \ run                           posix.py:50
  4350            \ call_inputhook (4 times)    inputhook.py:60
  4349             | select_fds (4 times)       select.py:194
  4348             | select (4 times)           select.py:85
* 4348             | select (8 times)           select.py:179
```

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5112561

Signature: t1:5112561:1495562165:bf86c3283156d3b67918706dc875e6d3e28eac18
2017-05-23 11:50:33 -07:00
Jun Wu
c41d432bb1 fastannotate: move to hgext3rd
Summary: Extensions should belong there.

Test Plan: Updated existing tests

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5113146

Signature: t1:5113146:1495562344:47bae69e6b22c14b32a8a9511878e88e89759d8f
2017-05-23 11:47:22 -07:00
Jun Wu
a97e026674 remoteid: move to hgext3rd
Summary: This is what extensions should belong to.

Test Plan: Changed existing test.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5113042

Signature: t1:5113042:1495561987:d1af0f7cebfdb8b0c1a6bb71cdc826d817a4e441
2017-05-23 11:47:04 -07:00
Martin von Zweigbergk
050cb5d1db chistedit: fail only when attempting to run if curses is not found
If curses is not available, we can still be nice and not fail until
the user actually tries to run the chistedit command.
2017-05-22 23:00:54 -07:00
Jun Wu
f1be725a71 traceprof: new extension to perform accurate profiling
Summary:
Instead of sampling periodically like the default profiler `statprof`, trace
every function call so the report is accurate. The output is designed to be
similar to `statprof`.

Written in C++ and inline assembly to minimize overhead. Cython is used as a
glue layer.

Comparing to `lsprof`, the overhead is similarly small. The major difference is
this profiler cares about "frame object" and records `frame->f_back` (parent
frame) so it could draw a statprof-like tree of the callgraph. `lsprof` records
"code object" instead and could have difficulty to deal with recursive calls.

The following code could demostrate the difference:

```
def fib(x):
    if x < 2:
        return x
    return fib(x - 1) + fib(x - 2)

# lsprof - recorded 1 code object for fib and no way to figure out callgraph
import _lsprof
p = _lsprof.Profiler()
p.enable(subcalls=True)
fib(5)
p.disable()
for s in p.getstats():
    print(s)

'''output:
_lsprof.profiler_entry(code="<method 'disable' of '_lsprof.Profiler' objects>", callcount=1, reccallcount=0, totaltime=0.0, inlinetime=0.0, calls=None)
_lsprof.profiler_entry(code=<code object fib at 0x7f27ca587530, file "a.py", line 1>, callcount=15, reccallcount=14, totaltime=8e-06, inlinetime=8e-06, calls=[_lsprof.profiler_subentry(code=<code object fib at 0x7f27ca587530, file "a.py", line 1>, callcount=14, reccallcount=12, totaltime=6e-06, inlinetime=6e-06)])
'''

# traceprof (with timethreshold set to 0) - callgraph drawn correctly
import sys
from hgext3rd import traceprof
with traceprof.profile(None, sys.stderr):
    fib(5)

'''output:
    | <module>                                  a.py:1
  0  \ fib                                      a.py:1
  0    \ fib                                    a.py:1
  0      \ fib                                  a.py:1
  0        \ fib                                a.py:1
  0         | fib                               a.py:1
  0        \ fib                                a.py:1
  0      \ fib                                  a.py:1
  0       | fib                                 a.py:1
  0    \ fib                                    a.py:1
  0     | fib                                   a.py:1
     \ __exit__                                 contextlib.py:21
'''
```

There are some performance / correctness tradeoffs. The current implementation
takes `frame` address and several (but not theoretically complete) fields to
hash a frame.  That could in theory lead to inaccurate frame information being
recorded. But hashing all fields recursively incurs significant overhead. The
related logic is the `hashframe` function, which could be tweaked later.

This is an initial version. It probably does not cover all corner cases like
exception handling well. And it may duplicate a same frame multiple times
because of the way it hashes a frame. The duplicated frame issue could be
solved by adding post-profiling filtering though.

Here is a real-world example of `hg log -r .` on `hg-committed`:

```
      | <module>                                hg:10
      | run                                     dispatch.py:81
      | dispatch                                dispatch.py:132
      | _runcatch                               dispatch.py:202
      | _callcatch                              dispatch.py:309
      | callcatch                               scmutil.py:133
      | _runcatchfunc                           dispatch.py:215
      | _dispatch                               dispatch.py:744
    2  \ repository                             hg.py:166
    2   | _peerorrepo                           hg.py:151
    2   | instance                              localrepo.py:2025
    2   | __init__                              localrepo.py:275
  863  \ runcommand                             dispatch.py:656
  863   | _runcommand                           dispatch.py:926
  863   | <lambda>                              dispatch.py:918
  863   | check                                 util.py:1059
  863   | log                                   commands.py:3262
  480    \ getlogrevs                           cmdutil.py:2236
  479     | _logrevs                            cmdutil.py:2190
  479     | revrange                            scmutil.py:429
  479     | anyrevs                             localrepo.py:622
  478     | mfunc                               revset.py:2275
  478     | __init__ (4 times)                  smartset.py:1033
  478     | __init__ (4 times)                  smartset.py:919
  478     | __len__ (4 times)                   localrepo.py:587
  478     | changelog                           repoview.py:309
  477     | filterrevs (11 times)               repoview.py:260
  477     | computehidden                       repoview.py:171
  455      \ hideablerevs                       repoview.py:24
  455       | getrevs                           obsolete.py:1114
  455       | _computeobsoleteset               obsolete.py:1143
    3        \ __get__ (2 times)                localrepo.py:76
    7        \ node (5760 times)                changelog.py:359
    4         | node (8938 times)               revlog.py:482
    9        \ __get__ (5760 times)             localrepo.py:76
  428        \ __get__                          util.py:798
  428         | successors                      obsolete.py:672
  225          \ __get__                        util.py:798
  224           | _all                          obsolete.py:662
    6            \ tryread                      vfs.py:32
    6             | read                        vfs.py:60
  200            \ _readmarkers                 obsolete.py:442
* 199             | _fm1readmarkers             obsolete.py:430
   15            \ _checkinvalidmarkers         obsolete.py:523
* 203          \ _addsuccessors                 obsolete.py:504
    3      \ tryreadcache                       repoview.py:166
    3       | cachehash                         repoview.py:98
    3       | heads                             localrepo.py:1884
   17      \ <genexpr> (5225 times)             repoview.py:191
   15       | __contains__ (5226 times)         ancestor.py:334
    5       | parentrevs (4010 times)           changelog.py:371
    2       | parentrevs (4332 times)           revlog.py:479
    9    \ pager                                ui.py:843
    9     | _runpager                           ui.py:906
    8     | __init__                            subprocess.py:330
    8     | _execute_child                      subprocess.py:880
    5     | _eintr_retry_call                   subprocess.py:118
  374    \ show                                 cmdutil.py:1308
  374     | _show                               cmdutil.py:1316
  365      \ _changesetlabels                   cmdutil.py:1266
  365       | troubled                          context.py:225
   12        \ unstable (2 times)               context.py:207
   12         | getrevs                         obsolete.py:1114
   12         | _computeunstableset             obsolete.py:1154
    3          \ set (322 times)                localrepo.py:610
    3            \ revs (3 times)               localrepo.py:593
    8            \ __getitem__ (963 times)      localrepo.py:566
    4          \ parents (321 times)            context.py:246
    4           | __get__ (321 times)           util.py:798
    4           | _parents (321 times)          context.py:562
    3          \ <genexpr> (642 times)          obsolete.py:1164
    3           | obsolete (321 times)          context.py:199
    2           | getrevs (321 times)           obsolete.py:1114
  319        \ bumped (2 times)                 context.py:211
  319         | getrevs                         obsolete.py:1114
  319         | _computebumpedset               obsolete.py:1181
    4          \ set (322 times)                localrepo.py:610
  312          \ allprecursors (2021 times)     obsolete.py:850
  308           | __get__                       util.py:798
  308           | precursors                    obsolete.py:678
* 308           | _addprecursors                obsolete.py:509
   34        \ divergent (2 times)              context.py:218
   34         | getrevs                         obsolete.py:1114
   33         | _computedivergentset            obsolete.py:1204
    4          \ set (322 times)                localrepo.py:610
   24          \ successorssets (1368 times)    obsolete.py:899
    3            \ __get__ (1368 times)         localrepo.py:76
    4            \ __contains__ (200 times)     localrepo.py:575
    9      \ names (2 times)                    namespaces.py:184
    9       | <lambda>                          namespaces.py:43
    9       | nodetags                          localrepo.py:741
    8       | __get__                           util.py:798
    8       | _tagscache                        localrepo.py:646
    8       | _findtags                         localrepo.py:685
    7       | findglobaltags                    tags.py:170
    7       | _readtagcache                     tags.py:370
    6       | filteredhash                      scmutil.py:307
       \ __exit__                               contextlib.py:21
        | maybeprofile                          profiling.py:199
        | __exit__                              contextlib.py:21
        | profile                               profiling.py:148
        | __exit__                              contextlib.py:21
Total time: 867 ms
```

Some example conclusions from reading the above output include:

  1. `_fm1readmarkers`, `_addsuccessors`, `_addprecursors` are slow
  2. `changelog.node` and `changelog.parentrevs` are called thousands of times,
     but they are just a few milliseconds.
  3. Reading the `obsstore` file (`vfs.read`) takes 5ms exactly

While `statprof` may get 1 right, `lsprof` may get 2 right, neither of them is
helpful for 3. `statprof` is not accurate enough to be confident about 5ms,
`lsprof` will include other `vfs.read` calls so it's impossible to see just the
read for obsstore.


Test Plan:
With the upstream [patch](https://patchwork.mercurial-scm.org/patch/20822/), run:

```
 HGPROF=traceprof hg id --config extensions.traceprof= --profile
```

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters, jiangyuan

Differential Revision: https://phabricator.intern.facebook.com/D5104851

Signature: t1:5104851:1495480386:666847ea08bb6a94658bc10d7f0e91c225d56836
2017-05-22 15:49:45 -07:00
Durham Goode
dcaee39e39 obsmarkers: update obsmarker operation wrapping to work with upstream
Summary:
Upstream has added an optional operation argument to createmarkers, which we
need to also accept. This argument is currently only processed if a config
option is set, so for now we will still put the operation in the metadata dict
manually.

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5106511

Signature: t1:5106511:1495485044:23d45d9ba389cf0d49b31705ae36902310c5056c
2017-05-22 13:38:37 -07:00
Durham Goode
0766a3469c dirstate: switch to new parentchange context
Summary: Upstream has deprecated begin/endparentchange in favor of a context object.

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5106500

Signature: t1:5106500:1495485058:8377335a0f678de7bb50cb93fff29bcfeb53fe1d
2017-05-22 13:38:37 -07:00
Durham Goode
e34660b057 commands: update to use registrar instead of cmdutil
Summary: Upstream has deprecated cmdutil.commands() in favor of registrar.commands()

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5106486

Signature: t1:5106486:1495485074:0e20f00622cc651e8c9dda837f84dd84cc51099e
2017-05-22 13:38:37 -07:00
Jun Wu
f532dddaa4 lfs: implement byte-level progress bar
Summary:
Previously, the progress bar is file-level - it moves when a file is transferred.

When uploading or downloading a single giant file, progress bar matters. And
this diff adds it to make people more patient.

Test Plan:
Manually upload and download several big files.
Make sure the progress bar appears in both cases.

Also make sure the output is sane with `-v`.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5100014

Signature: t1:5100014:1495316719:c500ccd63d3a495e41575cadd72419a41f5fb259
2017-05-22 11:03:14 -07:00
Durham Goode
f02e3e0686 revlog: rename revlog constants
Upstream has renamed some revlog constants, so we need to update our code
accordingly.
2017-05-21 17:09:08 -07:00
Jun Wu
65b1cff91e dirsync: use _fileset
Upstream has renamed _fileroots to _fileset.
2017-05-19 21:39:47 -07:00
Jun Wu
0fd94f75db fixcorrupt: use REVLOGV1
Upstream has renamed REVLOGNG to REVLOGV1.
2017-05-19 21:32:02 -07:00
Jun Wu
3e43e09a97 lfs: add a lfs_files template
Summary:
This allows automation to know which modified or added files are LFS for
specific changesets.

Test Plan: Added a test

Reviewers: #mercurial, davidsp

Reviewed By: davidsp

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5091591

Signature: t1:5091591:1495163606:138638d8ccc57b8ed6c1e324750ec5dc15c198a0
2017-05-18 22:18:20 -07:00
Jun Wu
546cff40f8 lfs: skip uploading when remotestore is a null store
Summary:
When remotestore is a null store, uploading is a no-op and can be skipped.
This diff makes it so.

Test Plan: arc unit

Reviewers: #mercurial, davidsp

Reviewed By: davidsp

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5090686

Signature: t1:5090686:1495144964:956549307912f4a44201aa305959bf8de26ac028
2017-05-18 15:10:39 -07:00
Misha Shneerson
cbdaa23f88 conduit: added correct Content-Type header for conduit queries
Summary:
conduit HTTP POST request did not have correct content-type header set.
Now they do. Ideally we should use python-request package to do HTTP
but I do not know enough how to import these dependencies so I just went
with the minimal changes.

Test Plan:
ran hg log from dev environment and eventually got it all working.
{P57411895}

Reviewers: simpkins

Reviewed By: simpkins

Subscribers: net-systems-diffs@fb.com, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5080725

Tasks: 18294945

Signature: t1:5080725:1495052201:1bbd6edad4c1c4b3482a7479259460a815947630
2017-05-17 13:50:37 -07:00
Rainer Alves
37fdd68496 morestatus: make conflict paths relative
Summary: morestatus: make conflict paths relative

Test Plan: Output: https://phabricator.intern.facebook.com/P57402806

Reviewers: rmcelroy, mgorven

Differential Revision: https://phabricator.intern.facebook.com/D5062074

Tasks: 10366065
2017-05-17 07:13:41 -07:00
Jun Wu
24d8640017 absorb: do not strip innocent children
Summary:
`repair.strip` removes required revisions and their children unconditionally.
That means innocent children may be removed. This patch fixes it.

We may want to have an in-core function for this feature to not strip innocent
children.

Thanks Zibi Braniecki from Mozilla for reporting [1]!

[1]: https://bitbucket.org/facebook/hg-experimental/issues/6/hg-absorb-merges-diverged-commits

Test Plan: Added a test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5073342

Signature: t1:5073342:1494972231:ca2a9881415119047771c8f35e059f4bfb1749e5
2017-05-16 16:25:00 -07:00
Jun Wu
a82574317b lfs: upload blobs during 'hg bundle'
Summary:
When a bundle is created, the bundle could be exchanged via copy and possibly
eventually reach to a publishing repo. If we don't upload LFS blobs, hg server
could have revisions that can never be checked out or verified.

So let's just assume bundles generated by `hg bundle` will be public, and
upload LFS blobs automatically, without depending on other code review tooling.

Note: there is a `preoutgoing` hook which will be triggered in this case,
however it's not useful since it does not have the `outgoing` information.

Test Plan: Will add a new test

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5050945

Signature: t1:5050945:1494958648:0c46ab1d85755838ba189bbb1e0673882922bb58
2017-05-16 15:49:32 -07:00
Jun Wu
7098094e7e lfs: cleanup file headers
Summary:
This diff removes `# coding=UTF-8` and adds standard GPL2 headers to lfs
files.

Test Plan: arc unit

Reviewers: davidsp, #mercurial, simonfar, rmcelroy

Reviewed By: simonfar, rmcelroy

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5067881

Signature: t1:5067881:1494947941:e669d4d9485c390138f76031608a7f727c57bf55
2017-05-16 15:44:06 -07:00
Jun Wu
f0c7a3cef9 lfs: remove util.py
Summary:
`util.py` only contains 2 small things: `lfsvfs` and `sha256`. Both of them
only have one user (in terms of files). Therefore just move the code to
related files to make it simpler.

Test Plan: arc unit

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5067862

Signature: t1:5067862:1494955824:b99021f1bb44568dc0c738b0e472eb732f2bc91a
2017-05-16 15:43:36 -07:00
Jun Wu
ae8a1ccb8f lfs: update old PointerDeserializationError error handling
Summary:
The error was renamed to `InvalidPointer`. This diff updates error handling
to catch that instead.

Test Plan: arc unit

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5067496

Signature: t1:5067496:1494955510:5f0162a8cc6f1d0d83e3ab6319ec3202028684d8
2017-05-16 15:42:30 -07:00
Jun Wu
acfcc44094 lfs: add a fctx.islfs method
Summary:
This simplifies code a bit, and could be useful for 3rd party code. We already
have `isbinary`, `islink`, `isexec`, `isabsent`. So another `is` method looks
fine.

Test Plan: Run existing tests

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5067369

Signature: t1:5067369:1494955466:ae17e310e743c704cc0d9bb73e0d2e82adcffff8
2017-05-16 15:41:39 -07:00
Jun Wu
2eef188bc0 lfs: add a filectx.cmp fast path
Summary:
The `filectx.cmp` fast path allows us to show "binary file changed" diff output
when two binaries have the same size but different content.

Test Plan: Added a test case

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5067266

Signature: t1:5067266:1494954783:a41e8213782afe24618ef2930c9576f21610fd3e
2017-05-16 15:38:51 -07:00
Jun Wu
9eedb98b61 lfs: downgrade "computing set of blobs to upload" to debug message
Summary:
Calculating what blobs to upload should be fast since we use changelog `files`
information. Users will see `lfs: uploading ...` very soon. So let's downgrade
`lfs: computing set of blobs to upload` to a debug message to make `-v`
cleaner.

Test Plan: Updated existing test.

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5066600

Signature: t1:5066600:1494954115:c00925a1930f9b53e914078d32b6c4e4161099ee
2017-05-16 15:27:25 -07:00
Jun Wu
ae541c9f80 lfs: show status per object when ui.verbose is set
Summary:
Downloading or uploading a single LFS object could take long. Instead of
showing a summary of what objects are downloaded or uploaded, print a message
per object if --verbose is provided.

Test Plan: Added a test

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5066327

Signature: t1:5066327:1494953894:3593436ff53eaff117a2932476dfc4b867fb9f17
2017-05-16 15:24:04 -07:00
Jun Wu
28de141267 lfs: handle "wrong action" error earlier
Summary:
Previously, when an object is not found server-side, we error out during the
basic transfer API. This diffs move the check to the batch metadata API so the
check is preformed earlier.

That also means, when batch fetching many LFS objects, we could report multiple
objects being missing instead of just one.

Test Plan: Modified an existing test

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5065623

Signature: t1:5065623:1494952131:cb1df73e1cea21e07bfd0ec630bacec60e5b385c
2017-05-16 15:19:40 -07:00
David Soria Parra
aca5b8465c p4fastimport: filelog transaction wtih support for concurrent access
Summary:
We are adding a simple transaction that works only with filelogs but
allows for concurrent access from multiple workers. This allows for a proper
rollback in case of a failure in a worker process, which previously would result
in bad data in the repositoriy.

Test Plan: rt test-p4* test-check*

Reviewers: #mercurial, durham, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5070340

Signature: t1:5070340:1494958313:b10b1eac5b42b36d1a587c4ae1c95fc2f8b5ad35
2017-05-16 12:36:23 -07:00
Jun Wu
b78dbc3dad lfs: check object errors from batch API early
Summary:
The batch API allows server to return errors per object, handling them early
seems to be a good idea.

This is an attempt to distinguish "cannot upload - no permission" from
"no need to upload - already exist".

Unfortunately, `lfs-test-server` reference implementation does not provide
the error message so it's not reflected in tests.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057816

Signature: t1:5057816:1494951879:07f2b67408e9d77255104b932baae2e50af9890b
2017-05-16 12:30:23 -07:00
Jun Wu
adb61e1976 lfs: split basic transfer API out from _batch
Summary:
The basic transfer API [1] worths a separate method.

[1]: https://github.com/git-lfs/git-lfs/blob/master/docs/api/basic-transfers.md

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057683

Signature: t1:5057683:1494951784:de3d3a28a69366fbbc4546f9e68b4d664ba00dfa
2017-05-16 12:26:30 -07:00
Jun Wu
d5a9c91ff9 lfs: move batch API to a separate method
Summary:
The LFS uploading or downloading process consists of 2 parts: a batch API to
get metadata about objects, followed by `len(objects)` requests.

This diff moves the first metadata API out from a giant `_batch` method to
make the code structure easier to maintain. Later diffs will further split
`_batch` method.

A side effect is `lfs: mapping blobs to #{action} URLs` message is removed.
More user-friendly message will be added back in a later patch.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057541

Signature: t1:5057541:1494949989:d510c3d9369744e7ee776c0d0a26d263dfaf8352
2017-05-16 12:24:20 -07:00
Jun Wu
31882a9791 lfs: remove total parameters from remote store APIs
Summary:
Displaying total bytes to upload is currently inaccurate - the server could
already have some objects so only a subset of selected objects will be
uploaded.

Besides, we pass `pointers` to related upload and download APIs so `total`
could be calculated from them.

This diff removes the inaccurate "need to upload" message and unnecessary
parameters. An accurate message will be added in a later patch.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057470

Signature: t1:5057470:1494949554:07e637a8b58c894598b3f0c2dd53f80a5ade25a8
2017-05-16 11:19:39 -07:00
Don Stewart
bc85e8a4cf hgext: accept a --unified param for lines of diff context
Summary: Added -U/--unified NUM to fbshow.py, and used that to set diff.unified=NUM.

Test Plan: hg show --help; hg show -U 1; hg show -U 2; hg show -U by induction.

Reviewers: mburman, simonfar, ikostia

Differential Revision: https://phabricator.intern.facebook.com/D5052156

Tasks: 10006036

Tags: python
2017-05-15 05:59:55 -07:00
Jun Wu
f484dba4a0 lfs: narrow down try block
Summary:
A try block is only effective for the HTTP error. Let's narrow it down to
just the HTTP request.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057107

Signature: t1:5057107:1494634308:584877babc6a4705fa0740788dcf58affdf51bec
2017-05-12 17:28:45 -07:00
Jun Wu
853b228a8a lfs: handle batch API's HTTP and JSON error
Summary:
There are `1+n` HTTP requests. `n` of them is handled. But the first one
about JSON metadata is not. Let's handle it.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057053

Signature: t1:5057053:1494634184:fa0e562dc7879379106bf37915a2e5ea3cc01a4d
2017-05-12 17:26:06 -07:00
Jun Wu
d5e501b573 lfs: provide more detailed message on network error
Summary:
The server or the HTTP library may provide more detailed error message.
Let's use them. `RequestFailedError` is also renamed to `LfsRemoteError` to
make it clear it's related to LFS and network.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5057014

Signature: t1:5057014:1494634052:00c1cb1b337a0e4cb92828cd49e95b7b0ff7e540
2017-05-12 17:22:02 -07:00
Jun Wu
b808e0f70f lfs: remove UnavailableBatchOperationError
Summary:
It's caught, and re-raise with RequestFailedError. We can just raise
RequestFailedError directly.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5056886

Signature: t1:5056886:1494633307:3fdf2fab13e783224d343266a1278c41ed4394e8
2017-05-12 17:18:05 -07:00
Jun Wu
34ffa6d4ce lfs: use ProgrammingError for invalid action in _batch
Summary:
_batch is called by programmers. If action is not expected, it's a
ProgrammingError.

Test Plan: arc unit

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5056822

Signature: t1:5056822:1494634121:59737eb0d3f42d706ee8b0dc18ec7a4b49ada34f
2017-05-12 17:14:52 -07:00
David Soria Parra
07292913da p4fastimport: move p4fastimport under hgext3rd
Summary:
move p4fastimport under hgext3rd as that's where it belongs.
Also has the benefit that we package it up.

Test Plan: rt test-p4*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5056664

Signature: t1:5056664:1494631758:4892f47922d8fbbd2c1f7793f3f29ee73fa8fa42
2017-05-12 17:03:20 -07:00
Jun Wu
d3b28f4b42 lfs: remove StoreID
Summary:
For long I have been wondering - we have `oid` already and an `oid` could
identify an object already, why do we need a `StoreID` which contains both
`oid` and `size`? It does not seem necessary?

I figured out the answer - the batch download or upload API *requires* size
information per object [1].

Since we will have LFS pointers during upload or download, we can just use
pointers. This diff removes `StoreID`, changes remote blob store to take
`pointers` directly, and local blob store to take `oid` directly.

As a side effect, `debuglfsupload` no longer takes `-o`, which seems fine
because `-r` should be more useful.

[1] https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md

Test Plan: `arc unit`

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.intern.facebook.com/D5043694

Signature: t1:5043694:1494496522:ea10f3dd12fc2ae3ab77b8f623eeead84dcc25fa
2017-05-11 17:57:42 -07:00
Jun Wu
8641f3cc37 lfs: rename GithubPointer to gitlfspointer
Summary:
It's Git-LFS, not GitHub.
Besides, mercurial uses lowercase for class names.

Test Plan: Run existing tests

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5043570

Signature: t1:5043570:1494493515:1df24d12d8b9be51480909ef75cad56cd9e22a2e
2017-05-11 17:54:33 -07:00
Jun Wu
a024f96812 lfs: add validation to pointer
Summary:
Read the Git-LFS specification [1] and implement most checks to prevent
programming error and detect data corruption.

The new code should be stronger than what was before the refactoring, since the
old code only checks keys but not values.

[1]: https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md

Test Plan: Added a new test

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5046740

Signature: t1:5046740:1494543072:2f0dbfc07cd52a10572550a277d850bdf3f78d27
2017-05-11 17:51:44 -07:00
Jun Wu
143b8c67d9 lfs: rewrite pointer logic
Summary:
Since we decided to only support GitHub's Git LFS specification, there is no
need to support multiple pointer types, so the code could be simplified.

The old code special case keys like `version`, `oid`, `hashalgo`, which makes
it longer than necessary. The new code is a rewrite treating everything as a
normal dict entry so the pointer class is much shorter: 76 -> 21 lines.

Data validation is temporary lost, which will be added back (and stronger) by
the next diff. It is separated to make review easier.


Test Plan: Run existing tests

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.intern.facebook.com/D5043547

Signature: t1:5043547:1494543031:ac1100939a10a79dfd749ab6ac9c3bb7fcd84dbf
2017-05-11 17:48:21 -07:00
Rodrigo Damazio Bovendorp
641bb65374 githelp: making the unknown message footer configurable
Facebook probably doesn't want external users reaching out to them directly
for support, so this should be customizable to specify other possible courses
of action (especially in cases where githelp is further extended to document
git-related company-internal commands in other companies).
2017-05-11 07:19:32 -07:00
Jun Wu
ec852f8f5f lfs: disable lfs code path if filenode is None
Summary:
`filelog.filenode` could be `None` when it's unknown - like working copy. That
breaks `isbinary` test. Let's modify `_islfs` check to return False to disable
lfs code path in that case.

Test Plan: Added a new test.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5034058

Signature: t1:5034058:1494431790:a02b69addf5d2f9b6b9a27ad71ed4f136b2bfd2b
2017-05-10 13:28:39 -07:00
Jun Wu
ee34d8ca1e lfs: remove lfs.bypass config option
Summary:
The config option was designed to be used server-side to avoid accessing remote
LFS blob stores. However, we now have `lfs.url=null:` as a clean alternative,
which will explicitly raise if the server ever tries to download remote
content. So `bypass` is no longer needed.

`bypass` could also be used for displaying raw content. That is doable using
`debugdata`.

Test Plan: Modified existing tests

Reviewers: #mercurial, rmcelroy, davidsp

Reviewed By: davidsp

Subscribers: davidsp, rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009725

Signature: t1:5009725:1494260384:332d7bd658359c004342efd01e4f13b6fc5499b1
2017-05-08 11:22:01 -07:00
Jun Wu
8909f8ded8 lfs: remove lfs.blobstore option
Summary:
`lfs.blobstore` is a path used to store local blobs. Some of the blobs are not
uploaded yet so they couldn't be easily discarded. Although blobs downloaded
from the server could be removed if necessary.

It does not make much sense to make this a config option - the data should be
stored reliably. It's also dangerous to allow write to arbitrary paths under
`repo.vfs`.

This diff makes the local blob store fixed path at `.hg/store/lfs/objects`.
The choice is similar to `.git/lfs/objects`, but with `store`, shared repo
could share their lfs stores.

Test Plan: Modified existing test.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009664

Signature: t1:5009664:1493978440:c3f6351d0ea0cca2ce3caa9f7260c5d65bcc0e5f
2017-05-08 11:21:34 -07:00
Jun Wu
186df9d185 lfs: add a command to upload lfs blobs
Summary: This makes it possible to upload lfs blobs without going through push.

Test Plan: The feature will be used in the next change.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009622

Signature: t1:5009622:1494230385:0df33ed12c96bc91f6252398ce5091057fe32a21
2017-05-08 11:21:11 -07:00
Jun Wu
4532efb04d lfs: split prepush hook into individual functions
Summary:
This makes it possible to reuse part of them - like uploading blobs for
given revisions without going through prepush hook.

`pointer.tostoreids()` was changed to `pointer.tostoreid()` to simplify
things a bit.

Unnecessary remoterepo assignment was removed.

Test Plan: `arc unit`

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009560

Signature: t1:5009560:1494230285:6469a2701baa8cfa4511a08149a37fc429733343
2017-05-08 11:20:50 -07:00
Jun Wu
3793eee754 lfs: remove 40 char length limit
Summary:
The `lfs-test-server` reference implementation [1] validates the hash, and
40-byte sha256 hexdigest will not pass that check.

[1]: https://github.com/git-lfs/lfs-test-server

Test Plan: A test will be added in the next diff.

Reviewers: #mercurial, davidsp

Reviewed By: davidsp

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009319

Signature: t1:5009319:1494006078:32950c5490935d9786553fc07d01f1fc92aacf25
2017-05-08 11:12:11 -07:00
Jun Wu
3f004c2689 lfs: ensure storeid.size is an integer
Summary:
The request JSON data used in the batch API should have `size` field as an
integer, not a string. This was discovered when testing against GitHub's
`lfs-test-server` implementation [1]. The latter was written in Golang and has
strong type requirement, it will treat `{"size": "42"}` as `{"size": 0}`.

[1]: https://github.com/git-lfs/lfs-test-server

Test Plan:
An integration test with `lfs-test-server` will be added once remaining issues
are resolved.

Reviewers: #mercurial, ikostia, davidsp

Reviewed By: ikostia, davidsp

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5009248

Signature: t1:5009248:1493977299:5daf8d32cd8c933be71a41afcc7ff832eb7edb5a
2017-05-08 11:11:47 -07:00
Jun Wu
fd5d8b9996 lfs: simplify blobstore config options
Summary:
This diff simplifies lfs remote server configs to a single item: `url`,
similar to what git-lfs has.

Compare:

```
  Before                        | After
 -------------------------------+-----------------------------------
  remoteurl = http://a.com/lfs  | url = http://foo:pass@a.com/lfs
  remoteuser = foo              |
  remotepassword = pass         |
  remotestore = git-lfs         |
  ------------------------------+-----------------------------------
  remotepath = /tmp/lfs-test    | url = file:///tmp/lfs-test
  remotestore = dummy           |
```

Test Plan: Modified existing cases.

Reviewers: #mercurial, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5008882

Signature: t1:5008882:1494230125:822b0e92f45dff2a37e26e6b3e44b559b4a47e6d
2017-05-08 11:11:14 -07:00
Jun Wu
2baf329dc2 tweakdefaults: let commit -M support revset
Summary: This will allow `-M` to have complex queries like `REV^'.

Test Plan: Test `scmutil.revsingle` in debugshell.

Reviewers: #mercurial, ikostia, rmcelroy

Reviewed By: ikostia, rmcelroy

Subscribers: ikostia, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5008983

Signature: t1:5008983:1493977159:7e105be95330b498d25033565be8594789406cae
2017-05-06 10:26:20 -07:00
David Soria Parra
cd7eed4dd0 lfs: ensure svfs is set
Summary:
Some remotestores (in particular null) do not have a svfs.
Check for it before we set it.

Test Plan:
Used a nullstore with a threshold set during push and saw it
now worked.

Reviewers: quark

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4984664
2017-05-04 16:18:32 -07:00
Jun Wu
64daf52ec8 lfs: use lfsvfs in dummy store
Summary: This simplifies code a lot.

Test Plan: Updated existing test

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5001837

Signature: t1:5001837:1493885337:eea8b5cba7234453b32eba46fd58b4d5904367bf
2017-05-04 09:25:20 -07:00
Jun Wu
fb4cd9891d lfs: remove chunking feature
Summary:
Per discussion with @davidsp, we want to stick to Git-LFS specification and
avoid non-standard behavior. The chunking behavior will happen at LFS server
transparently.

The direct motivation for this is to make it possible to implement an
efficient `filectx.cmp` that just compares hashes.

Test Plan: Updated existing test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, davidsp

Differential Revision: https://phabricator.intern.facebook.com/D5001827

Signature: t1:5001827:1493914639:c58694873e79a8ca910bb8ee01bf593885896664
2017-05-04 09:20:34 -07:00
Jun Wu
3d56581781 lfs: store isbinary information in LFS metadata
Summary:
Usually LFS files are binary files. But there could be exceptions. This diff
adds a new customized field `x-is-binary` to record those exceptions.

The `filectx.isbinary` API is changed to use that metadata as a fast path.

This allows us to provide a transparent user experience (whether a file is
stored in LFS or not does not affect its original `isbinary` property),
while still being able to skip loading the LFS blob if the file is binary.

Test Plan: Added a new test case

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5001117

Signature: t1:5001117:1493892406:2a8ebd42d0ae0dbae39b87b9ea16db22b99f3d12
2017-05-04 09:18:04 -07:00
Martijn Pieters
372c6c955f sparse: restore sparse profile on exception during import
Summary: Like _config, _import needs to restore the pre-existing profile if refreshing failed. Otherwise we have marked new rules as imported and applying without that actually being true.

Test Plan: rt test-sparse*

Reviewers: #sourcecontrol, rmcelroy, durham, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4985415

Tasks: 17793415

Tags: autosparse

Signature: t1:4985415:1493893462:ee4bcbf558706c3d2f58367dd7bf2533ccf1b824
2017-05-04 04:58:43 -07:00
Jun Wu
4131d4ebcd pushrebase: fix a typo in comment 2017-05-03 16:19:11 -07:00
Jun Wu
d82b8b1495 pushrebase: do not require exchange for getting markers
Summary:
D4865150 and D4934720 aren't effective in our current setup. The direct
cause in the code is because the server couldn't find common marker version:

```
  # old server-side code, returns empty in our current setup
  obsolete.commonversion(bundle2.obsmarkersversion(reply.capabilities))
```

Upon investigation, it's because there is no `exchange` enabled client-side.

But we do want one-way (server->client) markers for the rebased commits, as
long as obsstore is enabled (createmarkers is set, without exchange).

The upstream expects the server to have obsstore enabled, and exchange
enabled, to send markers. Since we are generating markers without an
obsstore (see D4865150), we are on our own way. This diff makes it one step
further.

This diff adds an explicit parameter to the `b2x:rebase` part to tell the
server what obsmarker format the client supports so the server could make a
right decision without relying on the "standard" `reply.capabilities`, which
is affected by the exchange option.

Test Plan: Change the existing test, make sure the old code fails.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4997972

Signature: t1:4997972:1493848751:14c29654b2e8246bd12a8de8820af5b3773e2fb7
2017-05-03 16:08:35 -07:00
Jun Wu
d3f8c4e9dc lfs: override filelog.renamed code path
Summary:
An `hg pull` test triggers the following code path server-side when using
remotefilelog:

  ...
  remote:   File "/usr/lib64/python2.7/site-packages/remotefilelog/remotefilelogserver.py", line 308, in streamer
  remote:     text = _loadfileblob(repo, cachepath, path, node)
  remote:   File "/usr/lib64/python2.7/site-packages/remotefilelog/remotefilelogserver.py", line 223, in _loadfileblob
  remote:     text = createfileblob(filectx)
  remote:   File "/usr/lib64/python2.7/site-packages/remotefilelog/remotefilelogserver.py", line 348, in createfileblob
  remote:     ancestors.extend([f for f in filectx.ancestors()])
  remote:   File "/usr/lib64/python2.7/site-packages/mercurial/context.py", line 1072, in ancestors
  remote:     for parent in c.parents()[:cut]:
  remote:   File "/usr/lib64/python2.7/site-packages/mercurial/context.py", line 923, in parents
  remote:     r = fl.renamed(self._filenode)
  remote:   File "/usr/lib64/python2.7/site-packages/mercurial/filelog.py", line 62, in renamed
  remote:     t = self.revision(node)
  ...

That triggers downloading a blob. We don't want to do that server-side. So
override the `renamed` method to use LFS fast path to test rename.

Practically, this reverts part of D4906074.

Test Plan: Run existing tests. This change was made on the server.

Reviewers: davidsp, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4992421

Signature: t1:4992421:1493802628:2bf2cf819bfed2aa61ea1c2323c03ab428732815
2017-05-03 11:10:48 -07:00
Augie Fackler
f198dbbc1e morestatus: add config knob to allow some states to be skipped
The main rationale for this change is that I've got years of use
patterns on bisect where I *start* bisect by running 'hg bisect
--reset', not *finish* with that command, so `hg status` with
morestatus enabled is spewing annoyances in nearly every repository
I've ever used. It wasn't any harder to allow people to ignore
anything they want, but (at least for now) bisect is the only state
that seems "special" in that it doesn't have a definite "end" that
Mercurial can detect and automatically clean up. I'd also be fine with
adding something like morestatus.ignorebisect if we want to avoid a
potential footgun where a user could ignore rebase state.
2017-05-03 13:34:36 -04:00
Jun Wu
4b467776ad pushrebase: accept arbitary keywords for _peerorrepo
Summary:
stateful chg will add a new parameter to repo initialization. This diff makes
sure pushrebase works with that change.

Test Plan: codereview

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4978687

Signature: t1:4978687:1493689190:7119205d76a8ac26dbf2bcf0be9c74ced9fc16b4
2017-05-01 19:11:08 -07:00
David Soria Parra
f8bb4e2122 lfs: add a 'null' store that doesn't require any setup
Summary:
We have to use the dummy store to ensure we don't try to open an HTTP
connection during push, which can fail and must not happen during p4fastimport.
However `dummy` requires some configuration. So just add an internal `null`
store that allows us to operate LFS in a mode that will ignore all large files
completely.

Test Plan: used it in p4fastimport

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: quark, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4963638

Signature: t1:4963638:1493316573:c012bd97794f9a57c3cf8c15d868a67ae3c03c31
2017-04-27 11:13:54 -07:00
Martijn Pieters
05d97a9461 sparse: provide a change summary on file and rule count deltas
Summary:
This allows a third-party tool like Buck report more detail on what a sparse
command actually achieved.

Test Plan: Run the test suite.

Reviewers: #sourcecontrol, durham, rmcelroy, ikostia

Reviewed By: ikostia

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4962550

Tasks: 17150508

Tags: autosparse

Signature: t1:4962550:1493307403:d14e16d079121688a4eb69f0d69cd02ab55c4936
2017-04-27 08:37:13 -07:00
Jun Wu
0d6151f530 remotefilelog: add lfs integration test
Summary:
The test covers common workflows like clone, commit, push, update, pull. It
exercises the remotefilelog plain store and Python datapack store to make sure
they won't lose the revlog flag. The test also tries to verify rename works
correctly.

Since the lfs extension may be eventually upstreamed, it seems a good idea to
make remotefilelog call `lfs.wrapfilelog` so lfs is free from remotefilelog
code.

Test Plan: Added a test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4904281

Signature: t1:4904281:1492560308:5fd9f214ada6de795735ea7d737d30c1bf39812a
2017-04-26 19:55:02 -07:00
Phil Cohen
cf88ecb166 progressfile: fix trailing space
Summary:
To my deep shame, I discovered today that `arc land` does not rerun `arc unit` if you introduce post-review changes.

Sorry!

Test Plan: Ran arc unit this time :)

Reviewers: quark, #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4957528

Signature: t1:4957528:1493241560:9208e745ac92c0e771b0a4b4bac91d6c1feed025
2017-04-26 14:19:39 -07:00
Phil Cohen
22969a6bf8 progress: add progress.statefile config
Summary:
allows users to have JSON progress bar information written to a path

Controlled by the `ui.progressfile` config. Mercurial will overwrite this file
each time the progress bar is updated.

The schema of this file is (JSON):

- topics: array of topics from oldest to newest. (last is always the active one)
- state: map of topic names to objects with keys:
    - topic (e.g. "changesets", "manifests")
    - pos: which item number out of <total> we're processing
    - total: total number of items
    - unit: name of the type of unit being processed (e.g., "changeset")
    - item: the active item being processed (e.g., "changeset #5")
    - active: whether this is the currently active progress bar
    - units_per_sec: if active, how many <unit>s per sec we're processing
    - speed_str: if active, a human-readable string of how many <unit>s per sec
        we're processing
    - estimate_sec: an estimate of how much time is left, in seconds
    - estimate_str: if active, a human-readable string estimate of how much time
        is left (e.g. "2m30s")


Test Plan: added a test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: rmcelroy, quark, stash, asriram, mjpieters, durham

Differential Revision: https://phabricator.intern.facebook.com/D4752788

Signature: t1:4752788:1493233878:b49095237d32233c78cd0e0aaaa7b94e0e9e7011
2017-04-26 14:05:44 -07:00
Stanislau Hlebik
64ecdf2691 fastpartialmatch: handle nullid correctly
Summary: Special case for nullid

Test Plan: arc unit

Reviewers: #mercurial, simpkins, ikostia

Reviewed By: ikostia

Subscribers: net-systems-diffs@fb.com, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4945927

Tasks: 17622253

Signature: t1:4945927:1493123209:712990c1e883241d99c0aeb4af8d48e18e1baa3d
2017-04-26 03:55:59 -07:00
Stanislau Hlebik
c48413d98b cleanobsstore: write cleanobsstore output to stderr
Summary: As it was noted in D4851138, writing to stdout may break extensions.

Test Plan: arc unit

Reviewers: #mercurial, simpkins

Reviewed By: simpkins

Subscribers: net-systems-diffs@fb.com, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4948924

Tasks: 17453793

Signature: t1:4948924:1493151885:4bcb971e65ac623aa5f91cf80fee5af6902c9226
2017-04-26 03:55:16 -07:00
Jun Wu
6c6ebce1f6 morecolors: new extension to add more colors to outputs
Summary:
The extension was a quick hack from me to make it easier to locate non-core
code when doing extension development. It seems a good idea to add colors in
general so it's named "morecolors" with the hope that we can colorize more
places in the future.

Test Plan: Added a test

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4884999

Signature: t1:4884999:1492473666:89a6756b231eac4274fa05d489480229146bdab8
2017-04-25 17:03:26 -07:00