Commit Graph

2028 Commits

Author SHA1 Message Date
Stanislau Hlebik
c15797e1dd infinitepush: ignore scranch branch if not set
Summary:
If `branchpattern` is not set then it matches empty bookmark.
It causes regressions like this t13808497. Let's ignore empty `branchpattern`

Test Plan: Run `test-infinitepush-*`

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4031365:1476755541:3d3781ef92f1701500d74ce7b98b4d82b5a1228e
2016-10-18 01:21:18 -07:00
Stanislau Hlebik
b9fab6bc04 infinitepush: fix remotefilelog interaction
Summary:
Remotefilelog can't find file revisions outside of the repo.
Because of it user can't update to the revisions that was pulled from
bundlestore. This diff downloads all filelogs for revisions
from bundlestore.

There were two options to pass info about changed files to remotefilelog:
through config or through bundlecaps. I decided to use config because
it's not really a bundle capability.

Test Plan: Run `test-infinitepush-*`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4030065:1476755932:4aa02e540f13d3221163d906524fb9ce97f9c7e8
2016-10-18 01:20:12 -07:00
Arun Kulshreshtha
6dddf0f340 Added additional flags to statprof.py
Summary:
Added the following flags to statprof.py:

  - `-f --file` Location of the .data file from the profiler.
  - `-s --script-path` Location of the flamegraph.pl script.
  - `-o --output-file` Path to write the flamegraph SVG output.



Test Plan: Ran the statprof.py command with various permutations of the aforementioned flags. Running without these flags produces the same behavior as before.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 13961909

Signature: t1:4034242:1476755279:23d2f3ea2850626ea9afbf60e712bc2b93c2fec0
2016-10-17 18:49:22 -07:00
Durham Goode
c0aee83142 treemanifest: fix build breaks on OSX 2016-10-17 11:47:47 -07:00
Simon Farnsworth
195bbe3fcb Fix compile-breaking format string issue
Summary: "%d" is the wrong format specifier for size_t, and thus this does not build.

Test Plan: make local and see build succeed

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters

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

Signature: t1:4030507:1476726943:44c480a1e231fe98354d386116b112d508436093
2016-10-17 11:31:18 -07:00
Jun Wu
14e90b7003 test-absorb: fix compatibility with POSIX sed
Summary:
POSIX requires that the `sed` "insert" command to be followed by a backslash
and a new line character. Let's make the test more POSIX compliant.

Test Plan: Run the test on both OS X and Linux.

Reviewers: simonfar, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4029954:1476720499:0a56da77fa89229ed9606eb9ac3748264fdf12fd
2016-10-17 17:01:02 +01:00
stash
b421695c98 infinitepush: do not require mysql for tests
Summary:
Tests doesn't require mysql since it uses fileindexapi.
Let's move sqlindexapi and fileindexapi to different files and include
only necessary file.

Test Plan: Run test-infinitepush-*

Reviewers: durham, simonfar, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4029460:1476709161:556f80605db9bd3c18dce1e16e996b13bbe96229
2016-10-17 14:23:56 +01:00
Jun Wu
dc07b62633 fastannotate: handle "draft" paths, and renames correctly
Summary:
Previously we can only answer the "path" information when the revision is in
the linelog revmap, and the code would crash if a revision is in a side
branch, and the user requests path information. This diff fixes it.

Besides, this diff improves rename handling. For example, given the following
chart:

```
  o---o  -o   file name: a
        /
  o---o-      file name: b
  ^   ^   ^
  1   2   3   revisions
```

Depending on the position of the `main branch` reference, fastannotate may
or may not use linelog:

- main branch is at rev 2, annotate a -r 3 will not take advantage of linelog
  (fallback to slow annotate)
- main branch is at rev 3, annotate a -r 2 will not take advantage of linelog

This is not ideal, but seems to be the best we can do for now.

Test Plan:
Added a new test, updated existing relevant tests. Some debug messages are
changed to reflect internals more precisely.

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4010964:1476458201:79875d96399d023d0000d0c4bb8b8d40ea43eef0
2016-10-09 19:47:01 +01:00
Stanislau Hlebik
4b61f94df6 infinitepush: create separate remotenames test
Summary:
Fix infinitepush tests for Mac. Let's split test in two.
Now if remotenames extension is unavailable most of the tests will still run.

Test Plan: Run `python run-tests.py test-infinitepush-*`

Reviewers: simonfar, durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4029394:1476706777:95473f493e10d3f7f21f4679976b33d75d8821f2
2016-10-17 05:36:26 -07:00
Durham Goode
8557048507 treemanifest: implement iteritems()
This implements the iteritems api. As part of this change we needed to expand
our existing iterator options to allow separating nodes from flags.
2016-10-14 16:01:12 -07:00
Durham Goode
8eea28cd2e treemanifest: implement treemanifest.keys() 2016-10-14 16:01:12 -07:00
Durham Goode
c3bc594c82 treemanifest: fix and test treemanifest.matches()
It had a bug where it thought the node was hex but it was already binary.
2016-10-14 16:01:12 -07:00
Durham Goode
2b41307ebe treemanifest: fix treemanifest.flags() when the file doesn't exist
manifest.flags() actually returns the default value if the filename doesn't
exist. So we need to replicate that behavior.

As part of this fix, I changed treemanifest.get() to return a boolean indicating
whether the file was found or not.
2016-10-14 16:01:12 -07:00
Durham Goode
f7249fd2e2 treemanifest: implement treemanifest.__nonzero__
This implements the __nonzero__ function, which is necessary for things like
`if mymanifest:`
2016-10-14 16:01:12 -07:00
Durham Goode
ae6de9bbdb treemanifest: implement treemanifest.dirs()
This implements the dirs function, which returns a collection set that can
answer the question of if a directory is in the manifest. Currently we do a
naive solution of using util.dirs(), which iterates over all the files. Given
that we have a tree already, we should be able to return something smarter in
the future.
2016-10-14 16:01:12 -07:00
Durham Goode
c171077ebd treemanifest: add None check for treemanifest.contains()
Mercurial sometimes checks if "None in mf", so we need to make sure we return
False in that situation.
2016-10-14 16:01:12 -07:00
Durham Goode
a68bd8bc73 treemanifest: add error checking for all argument strings
We weren't checking if the passed in string arg was successfuly parsed. This
patch adds checks for all of those instances.
2016-10-14 16:01:12 -07:00
Durham Goode
75c7cb42a1 treemanifest: implement hasdir()
Implements the py-treemanifest.hasdir() function
2016-10-14 16:01:12 -07:00
Durham Goode
89ad596f78 treemanifest: allow find() to get files and directories
Previously find would only return files. For treemanifest.hasdir() we needed it
to find directories as well. This patch adds a new enum for indicating if the
find should return files, directories, or both.
2016-10-14 16:01:12 -07:00
Durham Goode
445c6b0d4e treemanifest: fix diff on transient trees
The diff algorithm assumed every tree already had a node. If we are iterating
over an uncommitted tree, it may have tree entries with NULL as their node. We
need to always recurse in these cases.
2016-10-14 16:01:12 -07:00
Durham Goode
cd423fd42a treemanifest: implement 'clean' on diff
hg has an optional 'clean' arg on diff, which causes it to also return files
that aren't different between the two diffs. This implements it on our
treemanifest diff algorithm.
2016-10-14 16:01:12 -07:00
Durham Goode
7f2988ce25 treemanifest: implements text()
Implements the py-treemanifest.text() function
2016-10-14 16:01:12 -07:00
Durham Goode
f108eebde4 treemanifest: implements __setitem__
Implements the py-treemanifest.__setitem__ function. This also handles the
__delitem__ case.
2016-10-14 16:01:12 -07:00
Durham Goode
d96c188d00 treemanifest: implement setflag()
Implements the py-treemanifest.setflag() function
2016-10-14 16:01:12 -07:00
Durham Goode
ea9c99a376 treemanifest: implement get()
Implements the py-treemanifest.get() function
2016-10-14 16:01:12 -07:00
Durham Goode
4f326d2c38 treemanifest: don't call set for files that didn't actually change
We compute which files have changed by looking at the manifest deltas. It's
possible that a manifest delta may contain an entry that deletes a file, then
replaces that file with the exact same content. This results in an unnecessary
set operation. Let's catch that earlier and avoid the set.
2016-10-14 16:01:12 -07:00
Durham Goode
9819c37220 treemanifest: update entry nodes even if they haven't changed
During serialization, if we encountered a tree entry that had a NULL node, but
the contents matched the prior version, we considered it unchanged and did not
replace the null pointer with a pointer to the actual hash. This meant when it's
parent tried to serialize it, it would encounter a null pointer exception and
crash. Now we always fill in the node during popResult, since by definition it
will be null there (since the only way for something to be pushed is for it to
be null).
2016-10-14 16:01:12 -07:00
Durham Goode
8600c8a313 treemanifest: fix test python path
__file__ is not always an absolute path, so we need to perform a join in some
situations.
2016-10-14 16:01:12 -07:00
Durham Goode
24071807b7 treemanifest: change find() to do copy-on-write
The find() function is used to perform set and delete operations on a tree. Now
that we track Manifests via mutability and ref counting, we can change find() to
do copy-on-write.
2016-10-14 16:01:12 -07:00
Durham Goode
e8554fc3d9 treemanifest: add concept of mutability to manifest, and use it during edits
This adds the concept of mutable and immutable Manifests. During a treemanifest
copy, any sub-manifests that are immutable (such as ones that had been loaded
from a store, or those that are in memory but have been mark immutable), do not
need to be copied. This dramatically reduces the amount of memory allocation
happening when copying trees during automatic tree creation during hg pull.
2016-10-14 16:01:12 -07:00
Durham Goode
1faefff046 treemanifest: convert all ownership Manifest references to ManifestPtr
Now that we have a ManifestPtr object, let's use it in all the places we
currently have Manifest ownership and cleanup happening. We don't need to fix up
any places that are just using Manifests from a readonly, non-lifetime related
perspective.

This gets rid of all the 'delete' calls on Manifest, except the one inside
~ManiestPtr;
2016-10-14 16:01:12 -07:00
Durham Goode
b84ba7af52 treemanifest: introduce ManifestPtr and refcount
Copying our tree manifests is currently the most expensive part of converting
manifests to trees on the fly. Let's introduce refcounting to the Manifest
lifetime, so we can share Manifests across treemanifest instances. Future diffs
will convert all uses of Manifest* to ManifestPtr, then even more future diffs
will change copy and edit operations to be copy-on-write.
2016-10-14 16:01:12 -07:00
Arun Kulshreshtha
37cf7bd354 Make hg rebase --restack smarter
Differential Revision: https://phabricator.intern.facebook.com/D4000348
2016-10-14 11:05:53 -07:00
Adam Simpkins
7f1c4eb449 [sparse] make sure "hg update --clean" correctly forgets about excluded files
Summary:
A user ran into a bug where a failed rebase left their repository in a state
where "hg status" reported many excluded files had been removed.

They weren't able to recover from this state, even using "hg update --clean ."
This was because the sparse extension was ignoring the actions to forget these
files from the dirstate.  The sparse extension should allow excluded files to
be forgotten.

Test Plan:
I tried writing a test case for this but wasn't able to figure out how to
trigger exactly the situation that the user's repository was in.  (It looks
like there were other bugs in "hg rebase --abort" that led to their repository
state.)

I was able to cause some other problems with files in the "g" type
("remote created") that "hg update --clean" wouldn't fix.  I haven't added
those test cases for now though, since that problem isnt' fixed by this diff.
It does seem like there are potentially other problems here that still need to
be addressed.

Reviewers: quark, rmcelroy, mjpieters, durham

Reviewed By: durham

Subscribers: net-systems-diffs@, yogeshwer, mjpieters

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

Tasks: 13694820

Signature: t1:3966580:1475676328:48433e203ae702a50b40176e52f1ed90a5c45504
2016-10-13 11:49:58 -07:00
Adam Simpkins
27acd63250 [arc] honor paths specified by "arc unit"
Summary:
Update MercurialTestEngine.php and the unit.py script to honor the list of
changed files computed by arcanist.

Previously the unit.py script always used the files that were changed since the
".^" commit.  At best this was doing redundant work since arc had already
computed the list of files to test.  At worst this was testing the wrong files
if arc had been invoked with a list of explicit files to check.

Test Plan:
Ran "arc unit tests/test-mergedriver.t" and confirmed it ran the
test-mergedriver.t test, regardless of the changes in my current commit and
working directory.  Confirmed that "arc unit" with no path arguments still
ran the tests relevant to my local changes.

Reviewers: quark, rmcelroy, mjpieters

Reviewed By: mjpieters

Subscribers: net-systems-diffs@, yogeshwer, mjpieters

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

Signature: t1:4004727:1476258607:d6adb5ec3d677f6d93016a994cadaa7a48df353a
2016-10-13 11:48:02 -07:00
Rodrigo Damazio Bovendorp
06f51febad Fixing integer size conversions.
On 32-bit OSX, size_t and off_t have different sizes.
2016-10-13 09:15:15 -07:00
Rodrigo Damazio Bovendorp
bfb9b1b184 Making deb file construction only include remotefilelog 2016-10-13 09:15:15 -07:00
Jun Wu
d79ce74ce1 fastannotate: document defaultformat
Summary: This config option exists but is not documented.

Test Plan: Run existing tests

Reviewers: #sourcecontrol, eql, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4011108:1476307414:96191408f56b42a7949c2804114c7449ec8b5b27
2016-10-12 22:05:03 +01:00
Stanislau Hlebik
8bdaa46014 infinitepush: set scratch bookmark locally during push
Summary:
Previously `--to` bookmark was not set locally.
This diff fixes it by setting this bookmark to the head after push happened.
This is correct because it's guaranteed that we'll push only one head.

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: durham, rmcelroy, mitrandir

Subscribers: mjpieters

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

Tasks: 12479677
2016-10-13 00:11:56 -07:00
Stanislau Hlebik
1b98921c48 infinitepush: add function _savebookmarks()
Summary: It will be used in a few places (see next diff in stack)

Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:4001105:1476330730:0ba513a3bab131b8eadadd4e90576880663f0d49
2016-10-13 00:12:24 -07:00
Jun Wu
82b158ed59 githelp: fix crash in mergebase
Summary: `_` does not take two arguments while `ui.status` does.

Test Plan: Added a test case

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4010079:1476298648:81e678fbe433aa8cca8b03c9eba50d9b78bbc9bb

Blame Revision: D2811887
2016-10-12 19:47:42 +01:00
Durham Goode
68f61c682a fastmanifest: fix cache race condition
Summary:
The fastmanifest code had a race condition where committing quickly in
a loop could cause a stack trace. It was caused by the code check m.incache()
and then using m._cachedmanifest(), and between those two lines a background
process could have cleared the entry fromm the cache. So now we just check if
_cachedmanifest() actually returns a value.

Test Plan:
With and without the fix:
```
cd ~/local && rm -rf temprepo ; hg init temprepo && cd temprepo && for j in `seq -f "%03g" 1 100`; do for i in `seq -f "%03g" 1 10`; do echo "line$j" >> file$i.txt; done; echo "Commit $j done"; hg ci -Am "Commit $j" ; done
```

It would stack trace reliably without the fix, and never with the fix.

Reviewers: ikostia, #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Tasks: 13828535

Signature: t1:4004376:1476266037:0ff33a43fd35b5c7309fbfbf546799d75cc03ebc
2016-10-12 08:50:47 -07:00
Jun Wu
fc1e2d9c80 fastannotate: add hgweb support
Summary:
This adds fastannotate support for hgweb. There are some issues with "path"
handling, which will be addressed in follow up patches.

A minor change has been made in this patch to support revision numbers
(previously only global changeset hashes are supported).

Test Plan:
Run `hg serve --config fastannotate.hgweb=1` on the `hg-committed` repo, open
the following URL and confirm it's using fastannotate:
http://localhost:8000/annotate/9af6f8434430/mercurial/commands.py

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

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

Signature: t1:3993636:1476026586:cb0628aa7107bdbfde852a6a1471f70dcb21a5ef
2016-10-09 15:19:18 +01:00
Stanislau Hlebik
edf67f905d infinitepush: use addbookmarkandbundle
Summary:
Let's use a function that saves bookmarks, nodes and bundle
in the same time. For fileindexapi this call is equivalent
to addbundle() and addbookmarks() call. For sqlindexapi this
call makes two calls in one transaction.

Test Plan:
1) Run `test-infinitepush-bundlestore.t`
2) Test sql index locally

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:4001243:1476227921:9d449b743686762edce4c07d95266ef7ae69c2b5
2016-10-12 02:59:23 -07:00
Stanislau Hlebik
87084f5d59 infinitepush: add check for db connectness
Summary: This check was missing before

Test Plan: It's difficult to test and the change should be safe

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:4001229:1476227703:9e40d6efa9892e1e0d7fbcb24fdce3d607a3a7fe
2016-10-12 02:59:07 -07:00
Stanislau Hlebik
a4b6a2a1bb infinitepush: better error message
Test Plan: Run `test-infinitepush-bundlestore.t`

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:4001218:1476227692:c60b3def4e82911a40fe577bc44cf7d24cba9438
2016-10-12 02:57:53 -07:00
Arun Kulshreshtha
a154bbaeb0 Add hg rebase --restack
Summary:
This change adds a `--restack` option to `hg rebase`. When invoked, the command will rebase all descendants of precursors of the current changeset onto the current changeset. This is similar to the behavior of `hg evolve --all`, except it only handles unstable changesets, and not other issues that can arise from shared mutable history such as divergence or bumping.

I've been playing around with some of the more advanced features (such as allowing the command to be run from anywhere in the old stack or new stack, as well as allowing the user to specify the number of changesets to rebase), but I wanted to upload the most simple iteration of this command for feedback.

Test Plan:
See unit tests for complete commands.

1. Create a stack of commits.
2. Somewhere in the middle of the stack, amend a commit, potentially several times.
3. Run `hg rebase --restack`.
4. The top half of the stack should be rebased onto the amended commit, and the preamend bookmark should be gone.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: rmcelroy, quark, mjpieters

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

Tasks: 13651947

Signature: t1:3972103:1476230834:8f77eac4e8d8681dd9f8125747c1ff75c8da1ad8
2016-10-11 17:41:07 -07:00
Adam Simpkins
89f30244e5 [phrevset] fix "invalid literal for int()" error
Summary:
Fix the revsetdiff() function to always return a revision number.

Previously if the revision information was retreived from phabricator rather
than being found locally we return a changeset string rather than a revision
number.  This fixes the code to convert the changeset string back to a revision
number.  If the specified commit does not exist in the local repository, we
throw an error indicating that the user should run "hg pull"

Test Plan:
Tested running "hg graft -r DXXXXXXX" with a diff that was not present in the
local repository yet.  Confirmed it now prints an error indicating that the
user needs to run "hg pull" to fetch this revision, whereas previously it
crashed with an "invalid literal for int()" error.

Reviewers: #sourcecontrol, durham, simonfar, quark

Reviewed By: quark

Subscribers: net-systems-diffs@, yogeshwer, mjpieters

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

Tasks: 11355408

Signature: t1:3997925:1476201895:9b5832dc28abdddaa281a848246476b78f5a9fe7
2016-10-11 11:13:58 -07:00
Kostia Balytskyi
6cd744ec1a tests_: adjust test-mergedriver.t tests according to the core changes
Differential Revision: https://phabricator.intern.facebook.com/D4001645
2016-10-11 07:42:20 -07:00
Stanislau Hlebik
f1e2014203 infinitepush: add option to force non-fast-forward push
Summary:
Non-fast-forward pushes were disallowed. But having a
mutable shared history for scratch branches is a very
nice feature. Let's use --force option to force
non-fast forward push.

Test Plan: Run test-infinitepush-bundlestore.t

Reviewers: durham, rmcelroy, mitrandir

Subscribers: mjpieters

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

Tasks: 12479677
2016-10-10 03:48:21 -07:00