Commit Graph

3420 Commits

Author SHA1 Message Date
Durham Goode
0f55351745 tests: update test-infinitepush-pullbackups.t due to upstream
These lines were added in D485 but the diff indicates they weren't sure why
these lines were needed. D608 fixes the upstream bug that caused this, so now
the lines aren't necessary.
2017-09-06 21:57:19 -07:00
Durham Goode
69c8748ee2 test: fix pushvars check code failures 2017-09-06 21:46:16 -07:00
Durham Goode
b91fc3d106 remotefilelog: make pack cleanup more robust
Summary:
We're seeing exceptions from the unlink cleanup logic hide the actual exception
from the code. In order to debug the actual exception, we need to eat the
cleanup exceptions and in any place where we eat an exception inside of a catch
block, we need to manually rethrow the original exception, otherwise we end up
throwing the second caught exception (from the cleanup logic).

Test Plan:
Ran the tests. This is a particular odd edge case, so I need to run
these bits in the production environment where it was occuring before I can
understand why it was happening.

Reviewers: #fbhgext, ms2316

Reviewed By: ms2316

Subscribers: ms2316

Differential Revision: https://phab.mercurial-scm.org/D586
2017-09-05 13:07:23 -07:00
Mihails Smolins
d65b5a13b9 cstore: pythonkeyiterator refactor
Summary:
PythonKeyIterator has been moved to a separate file, because we will need to
include it in several places in future commits.

Test Plan: * Ensure unit tests pass

Reviewers: ryanmce, durham, simonfar, #fbhgext

Reviewed By: ryanmce, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D629
2017-09-05 08:04:55 -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
Simon Farnsworth
9e23886f80 tests: use python instead of echo -e
Summary:
BSD echo doesn't support -e. The lint rule says to use Python instead,
so follow its advice

Test Plan: Ran tests locally on Mac and Linux.

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Differential Revision: https://phab.mercurial-scm.org/D619
2017-09-04 05:26:23 -07:00
Durham Goode
a60b37e9e5 cdatapack: move ntoh_data_offset out of linux ifdef
08f1c7171e8a broke osx builds because it moved the declaration of
ntoh_data_offset into a linux specific ifdef. I think this was a mistake, so
let's move it back out to the not-ifdef portion.
2017-09-01 16:03:20 -07: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
a2cd5ebd96 tests: update test with upstream change 2017-08-31 13:08:41 -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
364ef7af41 tree: don't download flat manifests when cloning in tree only mode
Summary: Prevents downloading any manifest revlogs when the client is in treeonly mode.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D575
2017-08-31 11:14:39 -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
fba182aeee tests: remove orig file from a commit
Summary:
An orig file was getting added to a commit in a test accidentally, which makes
it harder to test the contents of that commit in a future diff. Let's purge that
file before we make the commit. This affects some of the later output because
the hash changes.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D570
2017-08-31 11:14:39 -07:00
Durham Goode
57571a68f0 treemanifest: fix non-tree repos when treemanifest is loaded
Summary:
If the treemanifest is loaded, but not enabled for a repo, it was still
executing tree code for that repo, which would break. This adds checks to
prevent tree code from running in non-tree repositories.

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Subscribers: simonfar

Differential Revision: https://phab.mercurial-scm.org/D568
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
Wez Furlong
9bfe39b9c7 scm-prompt: fixup extraction of the commit when in eden
Summary:
We changed the format a little while back, but neglected to
adjust this script.

Test Plan: run it locally and saw the correct hash.  Revised test case.

Reviewers: simpkins, akushner, mbolin

Reviewed By: mbolin

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

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

Tasks: T21489553

Signature: 5738750:1504122070:43595555652c35e721ff4248a83d615fdc330e6e
2017-08-30 14:25:18 -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
Jun Wu
114719fb15 cdatapack: move feature macros before including cdatapack.h
On Arch Linux, glibc 2.25-7, `cdatapack.h` includes `stdint.h`, which
includes `bits/libc-header-start.h`, which includes `features.h`. Therefore
`_DEFAULT_SOURCE` and `_BSD_SOURCE` must be defined before including
`cdatapack.h`.

`ntoh_data_offset` was moved to `.c` to make sure `.c` is the only direct
and indirect user of `be64toh`.

Test Plan:
Make sure `make local` works on Arch Linux.

Differential Revision: https://phab.mercurial-scm.org/D559
2017-08-30 13:17:07 -07:00
Mihails Smolins
4cadb2504b cstore: generic uniondatapackstore
Summary:
Implementation of uniondatapackstore that can hold generic stores.
This diff doesn't support python data stores yet, but provides an abstraction
to the stores that can be used by uniondatapackstore.
DeltaChain and DeltaChainLink wrappers will allow to use C and python chains
and chain links.

Test Plan:
* Ensure that unit tests pass
* Test on fbsource to ensure new code is executed by printfing to stdout
* Ensure the code is built successfully on macOS

Reviewers: durham, ryanmce, simonfar, #fbhgext

Reviewed By: durham, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D560
2017-08-30 11:37:25 -07:00
Durham Goode
23a8a4a744 tree: fix broken tests
I made a last minute change to the treemanifest code to match a change that went
into @, but I forgot to run the tests and I broke it pretty badly. This fixes
the code.
2017-08-29 17:03:50 -07:00
Durham Goode
e187dcbbd6 treemanifest: add test for hg bundle support
A simple test for hg bundle/unbundle
2017-08-29 13:02:22 -07:00
Durham Goode
1ad5d48f77 treemanifest: add test for peer-to-peer push/pull 2017-08-29 13:02:22 -07:00
Durham Goode
bb3289435b treemanifest: add test for histedit in treeonly mode
Test covering a simple histedit in treeonly mode.
2017-08-29 13:02:22 -07:00
Durham Goode
c16a1ef8df treemanifest: fix rebasing in treeonly mode
Adds a test for rebasing in tree only mode and fixes a bug in readdelta where it
was returning the parent's file nodes instead of the current file nodes. The
test covers this case.
2017-08-29 13:02:22 -07:00
Durham Goode
be98ac261a treemanifest: support pull in a treeonly repository
In order to support pulling from the main server, we need to:

- ignore the flat manifest part of the changegroup
- change our treeonlymanifestlog to do store.get() instead of
  store.getmissing(), since only get() fetches from the remote server.
2017-08-29 13:02:22 -07:00
Durham Goode
75e615d919 tests: add a test for client side treeonly support 2017-08-29 13:02:22 -07:00
Durham Goode
3507554579 treemanifest: read repo name from config during setup
Previously we set repo.name during reposetup. Soon we're going to support
bundlerepositories though, which will need access to the tree store (and
therefore the repo.name) during repo contruction (before reposetup). So let's
have the tree store setup logic manually read the repo name from the config
instead of waiting for the reposetup to do it.
2017-08-29 13:02:22 -07:00
Durham Goode
52380c78ce treemanifest: replace repair strip functions
Since our treemanifest doesn't have the concept of strip, let's patch the repair
module to not strip trees.
2017-08-29 13:02:22 -07:00
Durham Goode
99aa0a5195 treemanifest: support tree packs in bundles
This makes it possible to put a tree manifest pack in a bundle2 bundle and have
it get loaded into a bundlerepo.
2017-08-29 13:02:22 -07:00
Durham Goode
1e6eda2b5d treemanifest: add trees to bundle files
When performing a strip or other bundle operation, the bundle2 generator doesn't
use the normal part generator functions. Instead it has a custom function that
adds each part individually. We need to hook into that code to add our tree
packs to bundle files.
2017-08-29 13:02:22 -07:00
Durham Goode
4632ad37ea treemanifest: implement changegroup file discovery when tree-only
When building a changegroup, the logic relies on processing each manifest to
discover what files to send. In the new tree-only world we don't include the
trees as part of the changegroup, so we don't process the manifests anymore. So
we need to iterate over the tree manually to figure out what files to send.
2017-08-29 13:02:22 -07:00
Durham Goode
d159a0012e treemanifest: make pending tree writes accessible from manifestlog
When writing a series of treemanifests, future trees may need to reference trees
that have already been written. It can't look in the pack file like normal
because the pack file hasn't been finalized yet. To make those written trees
accessible, let's put them in a temporary memory set that the treemanifestlog
knows to look in.
2017-08-29 13:02:22 -07:00
Durham Goode
f63a1904f3 treemanifest: add memtreemanifestctx
Adds a memtreemanifestctx for representing a tree ctx in memory. This includes a
write() function which will be the primary way of creating new trees.
2017-08-29 13:02:22 -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
Wez Furlong
0d75bb27b2 fastmanifest: flush data when writepending is called
Summary:
This is required so that eden is able to see the pending trees using the
HG_PENDING mechanism when eg: `hg amend` is used.  The eden dirstate
`setparents` implementation invokes `writepending` so this is part is
pretty straightforward.

What was a bit more difficult to trace through and understand was that
`hg amend` invokes setparents more than once in my simple
manual test scenario (a commit off master, plus a change to a file not
in that existing commit).

Since the pending callback is removed after the first `writepending` call
the subsequent call(s) to `setparents` had a NOP `writepending` and then
eden failed to resolve the data.

Re-establishing the callback after writing the data seems to do the job.

Test Plan: manual testing with `hg amend --debug` in an eden repo

Reviewers: simpkins, mbolin, durham

Reviewed By: durham

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

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

Signature: t1:5711177:1503789059:04c06ffb6e7006a5188d5426ae706dd73cd4b150
2017-08-28 10:43:07 -07:00
Adam Simpkins
b2e3060a8b clib: apply clang-tidy fixes to C/C++ code
Summary:
Apply some auto-generated clang-tidy fixes to the C/C++ code.

This corresponds to Facebook diff D5588668.

Test Plan: Confirmed the code still builds and passes tests.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D509
2017-08-25 16:46:07 -07:00
Adam Simpkins
5afbd505ef clib: clean up include guards in the C/C++ header files
Summary:
Clean up the include guards to be more consistent and unique.

Some files used include guards like "KEY_H" and "STORE_H" which were not very
unique, and are more likely to collide with definitions provided by header
files from other projects.  Some of the py-*.h files were missing include
guards altogether.

This corresponds to Facebook diff D5588670.

Test Plan: Confirmed the code still builds and passes tests.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D508
2017-08-25 16:46:07 -07:00
Adam Simpkins
ecb0fd2dd7 clib: update C/C++ copyright statements to pass lint checks
Summary:
Update the copyright headers in most of the C/C++ code consistently use the
GPLv2 copyright message.  This allows these files to pass Facebook's internal
C/C++ linters.

Some of the files in fbcode/scm/hgext/cstore/ appear to have actually been
copied from the hg-crew repository, and were not originally authored by
Facebook.  I have not modified the copyright statements in these files:

- cstore/bitmanipulation.h
- cstore/compat.h
- cstore/mpatch.h
- cstore/mpatch.c

I also have not modified any of the cfastmanifest code.

This corresponds to Facebook diff D5588677.

Test Plan:
Confirmed that Facebook's C++ linters no longer complain about the copyright
messages.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D507
2017-08-25 16:46:07 -07:00
Adam Simpkins
702f276ede ctreemanifest: move ManifestPtr to its own header file
Summary:
Define the ManifestPtr class in its own header file, to eliminate some of the
nasty circular dependencies between manifest.h, manifest_entry.h, and
manifest_fetcher.h

This makes the include process for these files much simpler, and prevents
manifest.h and manifest_entry.h from both trying to include each other at
different locations in their files.

This corresponds to Facebook diff D5588672.

Test Plan: Confirmed "make local" succeeds and the unit tests pass.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D506
2017-08-25 16:46:07 -07:00
Adam Simpkins
b67af2812c clib: simplify include paths in C extensions
Summary:
Convert the C and C++ files in cdatapack, clib, cstore, and ctreemanifest
to always include files from the root of fb-hgext.  This simplifies the build
process by no long requiring a variety of separate include directories to be
specified on the compiler command line.

This will also make it easier to re-use these extensions in other projects
with different build systems.

This corresponds to the Facebook diff D5588676.

Test Plan: Confirmed that "make local" succeeds from a clean build.

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D505
2017-08-25 16:46:07 -07:00
Mihails Smolins
de2fbf4ada remotefilelog: keepset tuple bug fix
Summary:
Keepset computation algorithm added tuples to the keepset that are the results
of diffs between two manifests. Now it has been fixed and only new node from
the tuple is added to the keepset.

Test Plan:
* Run hg gc on www, fbsource
* Ensure the unit tests pass

Reviewers: simonfar, durham, #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D519
2017-08-25 10:06:43 -07:00
Durham Goode
8c688d88da tests: actually fix flakey test
Which packs get cleaned up is non-deterministic in some cases, so grepping for
the 'x' in this test did not catch when a non-x pack was left behind, which
caused flakey output. Let's instead check that 3 packs were left behind and one
of them was from the small generation.
2017-08-25 09:23:34 -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
Durham Goode
e5dd4fdd58 tests: fix flakey repack test
If a bunch of packs are the same size, the ones repack chooses to pack is
non-deterministic. This was causing flakiness in the test as different packs
were being left behind. Let's remove that dependency.
2017-08-24 16:31:05 -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