Commit Graph

679 Commits

Author SHA1 Message Date
Mark Thomas
a44fc44f24 sparse: add --sparse option to hg diff
Add a --sparse option to `hg diff` which filters the diff to include only files
that are part of the sparse profile.

When files are moved or copied across the sparse profile boundary, they will
show as added or removed (for moves) in the diff.  This is the same behaviour
as `hg diff --root`.

Test Plan:
Expand `tests/test-sparse-diff.t`

Differential Revision: https://phab.mercurial-scm.org/D797
2017-09-26 03:24:56 -07:00
Mark Thomas
b0c997501c sparse: get data for excluded files from working copy parent
When commands like 'diff' request the contents of files from a workingfilectx,
normally this is satisfied by reading from disk.  For files outside the sparse
checkout this doesn't work, so instead we must return the content from the
working copy parent.

Test Plan:
`tests/test-sparse-diff.t`

Differential Revision: https://phab.mercurial-scm.org/D788
2017-09-26 03:24:56 -07:00
David Soria Parra
11a84b900f p4fastimport we must return the value from the function we are decorating
We must correctly return the value from the function we are decorating.

Test Plan:
run tests

Differential Revision: https://phab.mercurial-scm.org/D767
2017-09-25 15:34:17 -07:00
Saurabh Singh
92177b3187 tweakdefaults: add config to enable/disable developer warnings
Summary:
Adding a config to control (only enable/disable for now) developer
warnings. This allows disabling the warnings on platforms like servers.

Test Plan: Updated and ran test-tweakdefaults.t

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D802
2017-09-23 16:58:58 -07:00
Jun Wu
99a01a0dbd dirsync: respect rule order
With rules of nested paths, the order of rules matters.

Note: this does not make dirsync handle recursive changes. i.e. a mirror
from path1 to path2 won't trigger a rule matching path2.

Differential Revision: https://phab.mercurial-scm.org/D770
2017-09-21 15:57:11 -07:00
Jun Wu
415f5074b3 undo: do not run undolog for every command
Previously, undolog runs for every command, which sometimes adds unwanted
noticeable overhead like `hg status` with a large obsstore. This patch makes
undo smarter to only log commands that actually write things.

This is done by making undolog only run for transactions, updates (legacy
code that does not require a transaction). Tests are changed to reflect
`hg status` does not trigger undolog, and the new code seems to work better
with chg.

Differential Revision: https://phab.mercurial-scm.org/D739
2017-09-21 14:38:43 -07:00
Martijn Pieters
7225395555 Linting fixes, remove usused import and safehasattr
Differential Revision: https://phab.mercurial-scm.org/D765
2017-09-21 08:07:09 -07:00
Stanislau Hlebik
7e37af474c fbconduit: add timeout
Summary:
Just as in phabricator/conduit.py. It is necessary for D620

BTW, not sure why do we have very similar code in two places.

Test Plan: Will be tested in D620

Reviewers: #fbhgext, shivramk, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D742
2017-09-21 07:01:27 -07:00
Mateusz Kwapich
abb9347d10 metaedit: make it compatible with histedit
Summary:
auto-rebasing stuff during metaedit doesn't really work well for histedit.
Let's specialcase it

Test Plan: see test

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D747
2017-09-21 05:33:54 -07:00
David Soria Parra
d6a9a2bcaa lfs: implement remotefilelog prefetch
When calling prefetch in remotefilelog, also prefetch lfs
files.

We are using the same hook mechanism that remotefilelog is already using
for LFS by having remotefilelog call into LFS.

Test Plan:
run tests on test-lfs-remotefilelog-prefetch.t

Differential Revision: https://phab.mercurial-scm.org/D732
2017-09-20 14:02:58 -07:00
Mateusz Kwapich
5c80b1b5fe [prune] advertise "hg hide"
Summary: "hg hide" is the user friendly command for hiding commits

Test Plan: ran tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D725
2017-09-20 07:55:56 -07:00
Aaron Shotkin
0d2cd6bff2 p4fastimport: used retry decorator
Summary: added in references to replace the broken references to retries

Test Plan: run https://phabricator.intern.facebook.com/P58253036

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Tasks: T21960796

Tags: bootcamp

Signature: 5866393:1505861463:ec22714d52586d5c42df80fd291712d2d9dc2895
2017-09-19 15:57:33 -07:00
Aaron Shotkin
3c316aa224 p4fastimport: added retry decorator
Summary: added a new decorator that will replace the broken retries function

Test Plan: run https://phabricator.intern.facebook.com/P58253036

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Tasks: T21960796

Tags: bootcamp

Signature: 5866346:1505861561:c633d79b6485333b4b8a6ae9201ff3b59a3a6d05
2017-09-19 15:57:33 -07:00
Saurabh Singh
c2bf4500f9 gitlookup: reorganising the imports
Summary:
Reorganising the imports in the file gitlookup.py to comply with the
recommended way.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D702
2017-09-13 17:17:55 -07:00
Saurabh Singh
bf363c4fd9 gitlookup: using util.urlreq instead of importing urllib
Summary:
I was reorganising the imports of gitlookup.py. After reorganising, the test
test-check-code-hg.t was probably able to recognise the imports and suggested
that we should using util.urlreq instead of urllib. Therefore, I am making the
suggested change in this commit and removing the urllib dependency.

I will be reorganising the imports in a later commit.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D701
2017-09-13 17:17:55 -07:00
Saurabh Singh
5106edcb35 gitgetmeta: enable serving only missing hg-git map data
Summary:
The gitlookup extension allows for only requesting the complete file
from the server. This leads to download of large files (hg-git map file
specifically in this case) when only the missing chucks of the file would have
sufficed.

This commit makes changes to allow for downloading only the missing parts of
the map file. A config option 'onlymapdelta' has also been added to allow for
switching between the two different modes of operation: serving complete file
and serving only the missing chunks. The tests were subsequently updated to
cater to the new scenario and also, checking for interoperability of the two
modes.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D695
2017-09-13 17:17:55 -07:00
Saurabh Singh
6da8dca955 gitlookup: creating description for the extension
Summary:
There is no description of the 'gitlookup' extension when 'hg help
gitlookup' in invoked. I just changed the existing code comments to form a
description.

Test Plan: Checked output of 'hg help gitlookup'

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D693
2017-09-13 17:17:55 -07:00
Saurabh Singh
3c0deb116c gitgetmeta: refactor code in gitlookup.py
Summary:
This commit just refactors some code to setup nicely for handling a
new type of bundle part. The refactoring essentially moves out the parts that
can be reused later.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D692
2017-09-13 17:17:55 -07:00
Phil Cohen
c259f16e35 copytrace: update _filemerge signature, add wctx
I changed this in D449 to add wctx to _filemerge.

Differential Revision: https://phab.mercurial-scm.org/D700
2017-09-13 14:24:49 -07:00
Durham Goode
b5deda8de4 changegroup: update to match upstream makechangegroup change
Upstream has refactored the changegroup creation APIs so we need to update our
usages.
2017-09-12 10:10:06 -07:00
Ryan McElroy
ca9289cb2a fbconduit: properly pass through params on local hit
Summary:
Previously, we didn't pass through additional parameters, which resulted in
errors complaining about insufficient arguments.

Test Plan: Added a new test that previously crashed

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D689
2017-09-12 08:04:17 -07:00
Kostia Balytskyi
25d520fbe5 rage: remove unused variable
Summary: This makes test-check-pyflakes-hg.t  complain, so let's fix it.

Test Plan: - run this test, see it stop complaining.

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D675
2017-09-11 03:27:39 -07:00
Saurabh Singh
a55e107c0e copytrace: handle modification of config from disablecopytrace to copytrace
Summary: In mercurial core, the config for disabling copytrace was changed from
disablecopytrace (boolean) to copytrace which can be on or off. As a result of
this change, there were some breaks which need to be modified to work with the
new config. This commit acheives the same.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Subscribers: quark

Differential Revision: https://phab.mercurial-scm.org/D662
2017-09-08 18:46:24 -07:00
Andres Suarez
cac17da0e4 rage: use conduit instead of arc cli
Summary:
The arc cli often depends on some checked-in code. If the repo is in a bad
state (when `hg rage` is most often needed), then arc may fail to load. A
less flaky approach is to create the paste by calling conduit directly instead
of relying on the arc cli.

* The paste now has a title – it's "hg rage for path/to/repo".
* If the paste creation fails, then the rage content is saved to a temp file.

Test Plan:
Confirmed that the paste and the temp files had the `hg rage` content:

* Success:

```
$ hg rage
Please post your problem and the following link at xxx (xxx) for help:
xxx/P58168469
```

* Failures:

```
# Missing "hosts" in ~/.arcconfig:
$ hg rage
arcconfig configuration problem.
No paste was created.
Saved contents to /var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-fMVgGr

# Bad "user" in ~/.arcconfig:
$ hg rage
Error talking to phabricator.
No paste was created.
Saved contents to /var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-HeWjHA

# Off the corporate network:
$ hg rage
Bad response from phabricator.
No paste was created.
Saved contents to/var/folders/jr/_rg2cglx58z6_fnksmnlmc2w71b1w9/T/hg-rage-x4IBMT
```

Reviewers: #mercurial, medson, rmcelroy, mitrandir

Reviewed By: medson, rmcelroy, mitrandir

Subscribers: #mercurial, mitrandir, rmcelroy, medson, mjpieters

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

Tasks: T19966776

Signature: 5793911:1504883514:29dc2c388819ba0d570a69f97eacb77884a2f983
2017-09-08 23:11:06 +01:00
Saurabh Singh
a995eb2fd1 amend: removing redundant commitfunc parameter in amend wrappers
Summary: cmdutil.amend was recently changed and the commitfunc parameter was
removed. This commit fixes the wrappers on the amend function by removing the
redundant parameter.

Test Plan: Ran the existing test suite
2017-09-08 10:07:41 -07:00
Saurabh Singh
a6ec1d2188 dirsync: fixing mirroring following removal of redundant commit in amend
Summary: The dirsync extension was relying on the redundant commit in amend to
achieve the mirroring. Now with that commit removed, I decided to wrap the
cmdutil.amend itself so that we can still do the mirroring correctly during the
amend.

I added a new test file test-dirsync-amend.t to test the wrapper over amend.
The test-dirsync.t was an existing test that was broken after the amend
behavior change and has been added again with some changes. It would be best to
review it against its old version.

Test Plan: Ran the test suite.
2017-09-08 10:01:05 -07:00
Saurabh Singh
7daa1a0dda copytrace: fixing amend wrapper following removal of redundant commit in amend
Summary: I just had to ensure that the we were storing the amend information by
checking against the working copy instead of the intermediate commit.

The test-copytrace-amend.t wasn't added in this revision. It is actually an
existing test which was broken after the change in amend behavior. I have added
the test again with minor changes. I think it would be best to diff the test
against its old version for the review.

Test Plan: Ran the test suite.
2017-09-08 10:00:09 -07:00
David Soria Parra
9787efd179 p4fastimport: add --base option to define branchpoint
Summary:
We are adding an option --base to define a starting point for a
new branch. We define --bookmark as the head of the branch (we
might introduce a --dest option in addition). This allows us to create
new branches for release branches and others.

Note that for some reason, `arc unit` is generating different test
results than running the run-test.py manually, causing branch updates in
different situations. Therefore we have to glob a bunch of tests.

Test Plan:
    python ../../hg-crew/tests/run-tests.py test-p4fastimport-* test-check*

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, medson, mjpieters

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

Signature: 5769328:1504763221:78eb81f32ec46fc56619d77537c2b1944e938466
2017-09-07 19:44:16 -07:00
Phil Cohen
e3d9d9e6d3 drop: update -r description from 'revs' to 'rev'
Differential Revision: https://phab.mercurial-scm.org/D658
2017-09-07 12:47:43 -07:00
Andres Suarez
6a6c71a9f2 tweakdefaults: support -I and -X in grep
Summary:
Pass-through the common `-I`/`--include` and `-X`/`--exclude` flags to
`scmutil.match`. This gives `hg grep` similar semantics to other commands that
support filtering by pattern.

Test Plan:
```
$ hg grep backgroundprefetch
remotefilelog/__init__.py:    ``remotefilelog.backgroundprefetch`` runs prefetch in background when True
remotefilelog/__init__.py:            repo.backgroundprefetch(bgprefetchrevs, repack=bgrepack)
remotefilelog/__init__.py:                                        'backgroundprefetch', False)
remotefilelog/__init__.py:                repo.backgroundprefetch(prefetchrevset, repack=bgrepack)
remotefilelog/shallowrepo.py:        def backgroundprefetch(self, revs, base=None, repack=False, pats=None,
tests/test-remotefilelog-bgprefetch.t:  > backgroundprefetch=True

$ hg grep -X '**/*.py' backgroundprefetch
tests/test-remotefilelog-bgprefetch.t:  > backgroundprefetch=True
```

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: medson, mjpieters

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

Signature: 5764306:1504535581:ebc8d9f76bbd243d49b1b3306620b88a4f16e818
2017-09-04 15:45:37 +01:00
Durham Goode
11030d633e ui: update calls to edit() to match upstream
Upstream has added devel warnings around edit, so we need to update our usage.
In particular, the action parameter is now required, and the suffix extra will
soon be ignored.
2017-09-01 15:53:54 -07:00
Durham Goode
a1cda97877 perftweaks: fix rebase size tracking
Summary: Upstream change the rebase signature, so let's change our wrapper.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D585
2017-08-31 13:28:52 -07:00
Durham Goode
1893cf283c tweakdefaults: remove order from analyze function
Summary: This broke working with upstream hg.

Test Plan: Ran the tests

Reviewers: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D584
2017-08-31 11:29:02 -07:00
Durham Goode
0faa105a6d tree: adds test for pushing a treeonly manifest to a hybrid server
Summary:
This adds a test that pushes a treeonly commit from a treeonly client to a
hybrid server, and verifies the result is written to the server flat and tree
manifests. Also tests that hooks can access the tree data.

This also changes the server to read the treemanifest if a tree was provided in
the bundle. Previously the server would only read trees if the forcereceivetrees
flag was on, which meant we couldn't accept flat and trees at the same time,
which made migrating harder.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D571
2017-08-31 11:14:39 -07:00
Durham Goode
2d3cc1e08b rage: fix lint 2017-08-31 11:11:59 -07:00
Kostia Balytskyi
dce0c8c3ab gitrevset: add a missing import keyword
Summary: Add a missing import statement.

Test Plan: - meh.

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D580
2017-08-31 08:27:03 -07:00
Jun Wu
30dd85108c rage: replace print with ui.write
Content written by `print` may not get flushed (especially in chg's case).
Use `ui.write` so Mercurial is responsible for flushing `ui.fout`.

Differential Revision: https://phab.mercurial-scm.org/D572
2017-08-30 14:05:55 -07:00
Jun Wu
d22b57e262 revset: accept additional arguments for stringset
D451 is going to add an `order` parameter so let's update our code.

Also remove the wrapping of `revset.symbols['stringset']`, which is no
longer needed by the current Mercurial.

Differential Revision: https://phab.mercurial-scm.org/D543
2017-08-30 13:17:20 -07:00
Dylan Richardson
5b84495e9e copytrace: use full version of copytrace for draft branch rebases
Summary: on merge during rebase, check to see if source and destination are both draft commits. If so, use full copytrace to support more functionality.

Test Plan:
In tests/test-copytrace.t, added two tests:
- Change a file name and move containing directory in one branch. Modify contents of original file name in other branch. Rebase modded file into new file name in new directory.
- Move directory in one merge parent. Add new file to original directory in other merge parent. File moved to new directory on rebase.

Reviewers: stash, #fbhgext

Reviewed By: stash, #fbhgext

Subscribers: pulkit, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D481
2017-08-29 08:57:54 -07:00
Mark Thomas
6455de7566 tweakdefaults: make pull --rebase ffwd if nothing to rebase
Summary:
Pull --rebase when you have local draft commits moves your commits,
your working copy, and your active bookmark to the new branch head
(or whatever destination you specify with -d).  If you don't have
any local draft commits, it doesn't do any of that.

This change makes it so that it does everything except moving the
commits.

Test Plan: Added new unit tests.  Re-ran existing ones.

Reviewers: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D518
2017-08-25 09:01:41 -07:00
Michael Bolin
9578f20605 spelling: change commited -> committed
Summary:
We have an internal linter that keeps yelling at me about this spelling error.

I created this by running:

```
hg grep -l 'commited' | xargs sed -i -e 's#Changes commited as#Changes committed as#g'
```

Test Plan: CI

Reviewers: durham, quark

Reviewed By: quark

Subscribers: medson, mjpieters, stash, jeroenv

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

Signature: t1:5699238:1503596778:de5e4f26daeaf3649c6c09ded6bd2b459b0e5f97
2017-08-24 14:13:58 -07:00
Felix Merk
c2634fb76a undo: work better with chg
chg runs a mercurial command, we want to see which actual commands are run and
don't want to wrap at the chg level.

Differential Revision: https://phab.mercurial-scm.org/D504
2017-08-24 13:17:02 -07:00
Felix Merk
ec97c2cb17 interactiveui: disable line wrapping
Disables line wrapping for interactive ui. This makes sure the line count is
correct and the output is clear.

Differential Revision: https://phab.mercurial-scm.org/D503
2017-08-24 12:59:28 -07:00
Felix Merk
48ec146530 undo: better error messaging and hiding hg serve commands
In interactive mode, disables out of bounds <-,-> notifying the user with text
and a '\a' sound.  Friendlier ui messages for when the user selects the current
state with the arrow keys or when trying to undo to a state before we recorded
anything.  Hg serve commands generally aren't user executed and simply should be
skipped across when undoing (like unfinished states).  The user can always use
--absolute to see them in preview and to undo to them.

Differential Revision: https://phab.mercurial-scm.org/D502
2017-08-24 12:29:40 -07:00
Jun Wu
2a0ec5edb8 inhibitold: remove the extension
It was kept there to allow us to fallback to it in emergency cases. But the
new hiddenoverride code seems to work well. Therefore remove the old inhibit
extension.

Differential Revision: https://phab.mercurial-scm.org/D501
2017-08-24 10:41:52 -07:00
Mark Thomas
986a478c59 tweakdefaults: make histedit update dates of commits it edits
Summary:
tweakdefaults already overrides amend, rebase and graft to update the commit date
to the current time when it creates new commits.

This extends this to also give the same behavior to histedit.

Test Plan: New unit test added.

Reviewers: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D490
2017-08-24 07:45:02 -07:00
Jun Wu
0dcbdce81e undo: explicitly disable pager on viewframe
`cmdutil.graphlog` may start pager. Explicitly disable it during
`viewframe.__init__` so the output won't get messed up.
2017-08-24 01:17:41 -07:00
Jun Wu
a2c1b1b707 undo: abort earlier if -i is specified
Check unfinished state and dirty working copy first so people won't get an
abort after selecting a state in the interactive interface.
2017-08-24 01:17:41 -07:00
Jun Wu
6363c9a947 undo: import interactiveui directly
This allows `undo -i` to always work.
2017-08-24 01:17:41 -07:00
Felix Merk
f9fd057193 undo: include ancestor in preview 2017-08-23 18:50:25 -07:00
Jun Wu
d035699241 compat: add empty placeholder extensions
We still have config that enables bundle2hooks and commitextras extensions.
Keep them in the repo so users won't get warnings.
2017-08-23 14:33:56 -07:00
Jun Wu
26e7f4a998 split: only do checkunfinished if rebase is needed
It's a valid use-case to run split inside a histedit plan. The
checkunfinished was added by D161, which was caused by a user report that
the split changes got lost because of rebase failure. If there is no need to
rebase, then checkunfinished is not necessary.

In the future we might want a `splitstate` to make it harder to lose split
commits.

Differential Revision: https://phab.mercurial-scm.org/D488
2017-08-23 08:47:31 -07:00
Pulkit Goyal
9c86deebae pushvars: cleanup the extension to just set the server config option
The --pushvars option to push is moved to core with an extra config named
push.pushvars.server which defualts to False. This config controls whether the
server to unbundle the variables send by pushvars.

To make sure nothing breaks for those with pushvars extension enabled,
this should be added to the configuration file:

[push]
pushvars.server = True

Differential Revision: https://phab.mercurial-scm.org/D365
2017-08-23 09:28:07 +05:30
Pulkit Goyal
c288e6c436 bundle2hooks: remove the extension from hgext3rd as it is moved to core
The ability to add hookargs to a bundleoperation object has been added to the
core from this extension.

Related commits are:
https://www.mercurial-scm.org/repo/hg-committed/rev/bf6a06e6310e
https://www.mercurial-scm.org/repo/hg-committed/rev/aa97e972460f

Differential Revision: https://phab.mercurial-scm.org/D364
2017-08-23 09:28:07 +05:30
Pulkit Goyal
2930e709e9 commitextras: remove the extension from hgext3rd as it is moved to core
This extension is moved to core as an extension in
https://www.mercurial-scm.org/repo/hg/rev/bb5f26e8d735.

This patch also removes the test of the extension.

Differential Revision: https://phab.mercurial-scm.org/D363
2017-08-23 09:28:07 +05:30
Jun Wu
6f6c83a6af pyflakes: fix peermod unused error
When rewriting D425 to use `iterbatch()`, I forgot to remove the unused
import. This patch removes them.
2017-08-22 20:42:52 -07:00
Sonia Kim
7ef1e18d89 lfs: include filename in object lookup fail message
Summary: Object lookup fails in blobstore provided vague error message when a specific file was not present. Updating error message to reference the filename associated with the blob not found.

Test Plan:
In facebook-hg-rpms/fb-hgext/tests directory:  rt test-lfs-test-server.t
Shows no error and validates that correct error message is displayed

Reviewers: quark, rainee, davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Tasks: T18972111

Signature: t1:5617283:1503070630:56fdcab5295ce7d050a24f1a989806066ef7054f
2017-08-22 10:54:41 -07:00
Felix Merk
9df57fe0d2 undo: preview change - just show delta
Change preview to just show the delta and connected commits.  This means we need
to calculate oldworkingcopyparent and bookmarks diffs.  This output will be
cleaner especially for people with a lot of commits in their repo.

Differential Revision: https://phab.mercurial-scm.org/D467
2017-08-22 10:18:03 -07:00
Stanislau Hlebik
e3d7418df4 fastlog: use ui.log() instead of ui.warn()
Summary:
ui.warn() just prints to the stderr. It has two disadvantages:
1) Distracts a user
2) Doesn't notify us about the problem.

Let's use ui.log() that will send result to our logging system

Test Plan: Run unit-tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D443
2017-08-22 01:23:25 -07:00
Felix Merk
66fc95aa46 interactivui: get rid of flashing
Prevent flashing in 'hg undo -i' for smoother ux.  Tested by running hg undo -i
and not seeing flashes when hitting left or right.

Differential Revision: https://phab.mercurial-scm.org/D465
2017-08-21 15:55:16 -07:00
Jun Wu
805ddc8422 codemod: be compatible with upstream change
D319 renamed `peer.pipe[ioe]` to `peer._pipe[ioe]`.
D320 removed `peer.batch`.
D331 renamed `subprocess` to `_subprocess`.
D336 renamed `_capabilities` to `capabilities`.

Let's be compatible with those changes.

Differential Revision: https://phab.mercurial-scm.org/D425
2017-08-21 15:10:41 -07:00
Felix Merk
fcd302bf7b undo: draft obsolete commits
Visible obsolete commits are slightly tricky.  For example, an amend in the
middle of a stack will leave behind a visible obsoleted commit.  This diff
removes visible obsolete commits from 'olddraft()'.  This removes the need for
some special casing and allows for a more powerful preview.

Differential Revision: https://phab.mercurial-scm.org/D463
2017-08-21 13:28:50 -07:00
Felix Merk
cfbbbdf2c6 undo: preview perf improvements
Based on Adam Simpkin's ideas, faster code for the template functions.

Differential Revision: https://phab.mercurial-scm.org/D462
2017-08-21 13:28:50 -07:00
Felix Merk
e45f912211 undo: preview shows command and time output
Makes hg undo -i and hg undo -p output show an "undo to time, before command"
message and adds directions (left, right, return, q).  Also adds pager check as
pager break interactiveui.

Testing: run hg undo -p and hg undo -i and see output

Differential Revision: https://phab.mercurial-scm.org/D448
2017-08-21 11:25:36 -07:00
Felix Merk
721459469f undo: draft obsolete handling
Obsoleted commits may be visible.  To make sure that they are un-obsoleted after
undo when appropriate, we add "draft() & obsolete()" recording.  The most common
case where this matters is undoing a mid stack amend.

Differential Revision: https://phab.mercurial-scm.org/D438
2017-08-18 11:40:18 -07:00
Felix Merk
2d555e35dd undo: informative output
Instead of the _showstats output from hg.py, we now output the args and time of
the mercurial command we are undoing.

Differential Revision: https://phab.mercurial-scm.org/D412
2017-08-18 11:37:45 -07:00
Felix Merk
aa2547d949 undo: unfinished command handling
hg rebase, histedit, unshelve and other commands may stop in an unfinished state
because of merge conflicts or other reasons.  The user then has the ability to
continue or abort.  Undoing in this case is slightly tricky as for example
aborting a rebase will perform real strips and so undo will fail with an error.
This change still records these states, but flags them as unfinished and skips
over them when undoing and redoing.  Hg undo --absolute does not ignore these
states in the really unlikely situation you want to go to one of them.

Differential Revision: https://phab.mercurial-scm.org/D410
2017-08-18 11:37:45 -07:00
Ryan McElroy
674d828aad undo: allprecursors -> allpredecessors
Summary: Per upstream name changes. Eliminated develwarns.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D432
2017-08-18 03:11:29 -07:00
Ryan McElroy
28eed8e961 phabstatus: allprecursors -> allpredecessors
Summary: Renamed upstream. Eliminate more develwarns.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D431
2017-08-18 03:11:29 -07:00
Ryan McElroy
42c167e16e fbamend: allprecursors -> allpredecessors
Summary: Renamed upstream. Prevent develwarns.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D430
2017-08-18 03:11:29 -07:00
Ryan McElroy
6ce9175cd1 fbamend: precursor -> predecessor
Summary: Get in line with upstream name change and eliminate develwarns.

Reviewers: #fbhgext, simonfar, simpkins

Reviewed By: #fbhgext, simonfar, simpkins

Subscribers: quark, simpkins, simonfar

Differential Revision: https://phab.mercurial-scm.org/D429
2017-08-18 03:11:29 -07:00
Ryan McElroy
e2dfc69dc2 fbamend: precnode -> prednode
Summary:
Upstream is changing names to be more consistent. Follow suit to eliminate
devel-warnings.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D428
2017-08-18 03:11:29 -07:00
Ryan McElroy
7770cdf605 undo: precnode -> prednode
Summary: Names be a'changin.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D427
2017-08-18 03:11:29 -07:00
Felix Merk
3f41f783a1 undo: performance improvement attempt
Undo -p is really slow on certain large repos.  This caches 'olddraft()' by
using the revlog nodes.  Since revlogs are immutable this should be really safe
and could hopefully dramatically improve not only hg undo -p performance, but
performance of all undo commands.

Differential Revision: https://phab.mercurial-scm.org/D439
2017-08-17 16:45:37 -07:00
Jun Wu
832ec05e60 pager: migrate to modern pager API
The modern pager API is to use `ui.pager()` explicitly just before the time
a command needs a pager. It's now hard-coded in individual commands, and
opt-in by default. Users wanting to disable pagers for certain commands need
to disable them explicitly. Ideally we don't need the pager extensions or
the `pager.attend` setting.

This patch migrates `show`, `smartlog`, `fastannotate`, and `grep` to use
the modern API.

Differential Revision: https://phab.mercurial-scm.org/D437
2017-08-17 13:42:18 -07:00
Mateusz Kwapich
432714c0bf perftweaks: don't crash if the rebase dest is None
Summary: This happens in case of "pull --rebase" if the source is ancestor of destination

Test Plan: see the new test, it's making hg crash without this change

Reviewers: #fbhgext, ryanmce, simonfar

Reviewed By: #fbhgext, ryanmce, simonfar

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D436
2017-08-17 12:15:02 -07:00
Jun Wu
6e9f7aeb68 absorb: preserve phase
When rewriting changesets, preserve their phases.

Fixes https://bitbucket.org/facebook/hg-experimental/issues/10/hg-absorb-doesnt-preserve-commits-phase

Differential Revision: https://phab.mercurial-scm.org/D418
2017-08-16 13:40:00 -07:00
Felix Merk
00870d6060 undo: don't break when undo isn't first argument
Undo commands where undo wasn't first, for example `hg --pager=off undo` break
multiple things, including hg redo.  This change fixes this.

Differential Revision: https://phab.mercurial-scm.org/D396
2017-08-15 16:56:25 -07:00
Felix Merk
8a98220afc undo: invalidate false cache
Mercurial sometimes leaves bad caches.  Easiest example is when updating to a
hidden commit, where hg undo will fail, but can be reproduced with many commands
(such as fold which is used for testing here).

Test Plan:
unit tests

Differential Revision: https://phab.mercurial-scm.org/D395
2017-08-15 16:56:25 -07:00
Felix Merk
1ab935a4dc undo: add Scuba logging
Adds scuba logging to dev command timers so we can see how often some seemingly
unlikely edge (error) cases happen.  Once we are confident that hg undo is
stable we can get rid of these logs.  This is specifically for things that
don't loudly fail (since the user shouldn't care about them) but we still would
like to know about.  Note that
[sampling]
key.undo=perfpipe_dev_command_timers
is needed in an hgrc file for this to work.

Test: deleted gap file, ran undo and confirmed error was noted in dev command
timers

Differential Revision: https://phab.mercurial-scm.org/D357
2017-08-15 16:50:40 -07:00
Simon Farnsworth
0d8b65f603 tweakdefaults: do not change the date when using amend --to
Summary:
amend --to is a thin wrapper around histedit, and fails if you ask it
to update the date. tweakdefaults can be configured to ask amend to change the
date. When this is the case, don't change the date when using --to, so that it
can work.

Test Plan:
Test case added here fails before the change complaining about other
flags with --to, and fails in the histedit afterwards (I'm not clear on why - I
suspect phases are significant here).

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D349
2017-08-15 07:21:37 -07:00
Adam Simpkins
6f1efddaa4 traceprof: report profile data even on error
Summary:
Update the traceprof contextmanager to always print the profile information,
even when exiting due to an exception.

In particular, this fixes the behavior so that we report profiling information
even if a slow command is interrupted with Ctrl-C.  This also matches the
behavior of the upstream statprof profiler.

Test Plan:
Confirmed that a profile was printed when interrupting a long-running
`hg log -f` command in a large repository.

Reviewers: quark, #fbhgext

Reviewed By: quark, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D386
2017-08-14 18:12:29 -07:00
Felix Merk
db3ca9f593 undo: improved --branch handling
Adds --branch handling to the no argument redo.  Also adds better branch testing
and takes a more sensible approach to an undo after an undo --branch.

Redo now restores undoredo.i's --branch field.  Undo after a undo --branch is
now an absolute undo.  See test cases.

Test Plan:
unit

Differential Revision: https://phab.mercurial-scm.org/D324
2017-08-11 18:05:03 -07:00
Felix Merk
5cd0a8ae43 undo: better docs
Strips docs of unnescerary info and sticks complex things behind --verbose flag.
In most cases hg undo and redo or hg undo --preview should be enough for the
user.  Also changes --index to --step, which seems clearer.

Differential Revision: https://phab.mercurial-scm.org/D287
2017-08-11 18:05:03 -07:00
Felix Merk
1041cbca21 undo: no argument redo
Changes redo to straight up undo the previous undo.  This is a bit trickier than
it may seem.  The previous redo capabilities are still covered in hg undo as
--index accepts negative numbers allowing you to step both forward and
backwards one step at a time.  The new redo reads the linear undo log to find
out where to undo to while updating the undo/redo index allowing you to continue
from where you left off.

Differential Revision: https://phab.mercurial-scm.org/D286
2017-08-11 18:05:03 -07:00
Felix Merk
a0591aa926 undo: preview interactive ui
Provide interactive preview.  undo -p now provides support of using arrow keys
and return to select state.  The interactive ui is set up to be generic so
potentially could be used for other commands.

Test Plan:
1. Running a bash script that sets up an interesting repo
2. hitting hg undo -p and trying every key combination
    Specifically: control-C still works, q quits, left goes forward,
    right goes backwards, return brings you to a state
3. running redo after preview and return
4. running undo a few times and then using undo -p to go back forward
5. going out of bounds both up and down
6. hitting other random keys during hg undo -p
7. running hg undo -p with other flags

Differential Revision: https://phab.mercurial-scm.org/D263
2017-08-11 18:05:03 -07:00
Felix Merk
223355effd undo: add --index and redo support to preview
Adds --index handling for --preview.  With the added handling, preview also
works for redo.  In order to bypass template logic, we simply change the
"undoredo.i" file and reset it afterwards.

Differential Revision: https://phab.mercurial-scm.org/D207
2017-08-11 18:05:03 -07:00
Felix Merk
070ee13318 undo: basic --preview
Allows for hg undo --preview to see smartlog like preview of what undo will do.
This will be neccesery before a general roll-out so users can see what undo will
do.  This first iteration only shows what "hg undo" will do, not redo and not
--index.

Differential Revision: https://phab.mercurial-scm.org/D206
2017-08-11 18:05:03 -07:00
Zhihui Huang
587971de01 p4fastimporter: handle blob commits
Summary: Since a blob commit does not associate with a p4 changelist, while a regular commit mirrored a p4 change has a p4 changelist number, p4fastimporter needs to know how to handle a blob commit. The solution here is to get p4basecl number (which tells it which changelist number it's based on when creating this blob commit) from the blob commit node, and import from there.

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

All tests should pass

Reviewers: #idi, davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

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

Tasks: 20141624

Signature: t1:5544046:1502405269:9f449550d60b9d29d8be464ab1cc98500bc60cad
2017-08-10 17:54:18 -07:00
Zhihui Huang
bf31927f4c p4fastimporter: blob commits - support lfs
Differential Revision: https://phabricator.intern.facebook.com/D5560829
2017-08-10 17:54:18 -07:00
Zhihui Huang
06ebaed0bb p4fastimporter: blob commits - support bookmark
Differential Revision: https://phabricator.intern.facebook.com/D5550722
2017-08-10 17:54:18 -07:00
Zhihui Huang
49930828ea p4fastimporter: blob commits
Differential Revision: https://phabricator.intern.facebook.com/D5542123
2017-08-10 17:54:18 -07:00
David Soria Parra
dde1b0d2d2 p4fastimport: decode special perforce characters in filenames
Summary:
Perforce encodes certain characters in filenames (see
https://www.perforce.com/perforce/doc.current/manuals/cmdref/filespecs.html)
We must decode this before we add it to Mercurial.

Test Plan:
  python ../../hg-crew/test/run-tests.py test-check* test-p4fastimport*

Reviewers: #idi, #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, steaphan, medson, mjpieters

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

Tasks: 20133877

Signature: t1:5570533:1502010300:0ef3ce0c228c61e23396b5a8ac887ac8c65812ff
2017-08-10 15:49:15 -07:00
David Soria Parra
2917133886 p4fastimport: remove stale comment
Summary: remove stale comment

Test Plan: none

Reviewers: #mercurial, #idi, steaphan

Reviewed By: steaphan

Subscribers: steaphan, medson, mjpieters

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

Signature: t1:5570523:1501916483:e16b5dcd0445759d753fd47656e2bad2389b5825
2017-08-10 15:49:15 -07:00
Phil Cohen
0e49348be5 progressfile: write regardless of HGPLAIN setting
It makes no sense to disable the progressfile if plain mode is on since the
whole point is to use it from other programs, like IDEs, that likely use plain
mode.

The existing progress bar will continue to render depending on plain mode.
2017-08-09 13:59:58 -07:00
Durham Goode
45cf36952f treemanifest: move stores to manifestlog
Summary:
This adds the data and history stores to the manifestlog, instead of storing
them on the opener. It also moves construction of the stores to manifestlog
creation time, instead of repo creation time. This is important for bundlerepo
support, since the bundlerepo needs to access the manifestlog as part of the
initial repo setup, and previously the stores weren't added to the opener until
after repo setup.

This patch does not remove the stores from the opener yet. Future patches will
migrate other extensions that depend on the datastores, and then we'll delete
them from the opener.

Test Plan: Ran the tests

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D234
2017-08-07 19:27:17 -07:00
Jun Wu
ba4766820a configwarn: new extension to warn about unsupported configs
We have seen issues caused by user config file (`~/.hgrc`) having
unsupported extensions enabled. This new extension would allow us to warn
users about those problematic configs.

Differential Revision: https://phab.mercurial-scm.org/D154
2017-08-07 13:16:09 -07:00
Zhihui Huang
84229312d5 p4fastimport: handle race condition with config users and time delta
Summary: This is a followup diff of this diff: [[ https://phabricator.intern.facebook.com/D5509536 | D5509536 ]]. It makes the ignored user and the constraint on time difference between a user commit and a p4fastimporter import configurable.

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

All tests should pass

Reviewers: #idi, davidsp

Reviewed By: davidsp

Subscribers: wlis, medson, mjpieters

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

Tasks: 20141882

Signature: t1:5531404:1501866435:25686443d99a2b96f8e8a7fa9e3f660ba8c8393e
2017-08-04 10:58:07 -07:00
Mateusz Kwapich
43219b38d6 tweakdefaults: enable absolute_import
Summary:
"import stat" was importing stat extension instead of
stat module from standard library.

Test Plan: ran tests

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D228
2017-08-04 07:17:59 -07:00
Kostia Balytskyi
099d4692bb sparse: use correct cwd-prepending with patterns
Summary:
Change fb-hgext's sparse to treat patterns correctly (this was brought to
my attention by @martinvonz on the mailing list).

This patch makes sure that:

```
  reporoot/subdir$ hg --include **/file
```

results in `subdir/**/file` being included rather than `subdir/`.

Test Plan: rt

Reviewers: mjpieters, durham, #fbhgext

Subscribers: martinvonz

Differential Revision: https://phab.mercurial-scm.org/D225
2017-08-04 06:16:45 -07:00