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.
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.
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.
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.
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.
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.
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).
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.
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.
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;
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
Summary:
The vanilla annotate command takes diffopts, let's add it to fastannotate.
This is also useful to support hgweb correctly.
Test Plan: Added a new test
Reviewers: #sourcecontrol, simonfar
Reviewed By: simonfar
Subscribers: simonfar, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3992672
Signature: t1:3992672:1475944204:2fbdf6a90d8c965775e3b7d5bc55fdb37c8909e7
Summary:
Some users only want to build certain extensions from this repository, so let's
add some options to setup.py to let them pick exactly what parts they want.
This also has the affect of removing the build dependency on Cython unless the
user wants to build linelog.
Test Plan:
hg purge --all
python setup.py build
hg purge --all
python setup.py build --component remotefilelog
hg purge --all
python setup.py build --component remotefilelog --component linelog
Reviewers: #sourcecontrol, simonfar, quark
Reviewed By: simonfar
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3992662
Signature: t1:3992662:1475940088:28ed13ddee5215f7ac0fcb68c0f49294b6ad79e2
Summary:
`getalllines` needs to call annotate before continuing to build the "forked"
linelog in memory.
Test Plan:
Set mainbranch to @, run `hg fa --deleted` on a file that has been changed
in the draft branch and it does not crash.
Pinged: rmcelroy.
Summary:
After first sqldirstate tests on real www users we found out that the "hg update" has significant regression.
We need a knob to disable it for users.
Test Plan: ran `hg pull`
Reviewers: #mercurial, jeroenv
Reviewed By: jeroenv
Subscribers: mjpieters, akushner
Differential Revision: https://phabricator.intern.facebook.com/D3980897
Signature: t1:3980897:1475753604:14712c2786d1245ab2cab5297ebcba83efe8f6ae
Summary:
Forgot to commit, so test build just succeeded as it built with
uncommitted change
Test Plan: ./fb_build_rpm.py --release AAAAAA
Reviewers: simpkins
Reviewed By: simpkins
Subscribers: net-systems-diffs@, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3978726
Signature: t1:3978726:1475713413:3dcb5389c562ccc1b5675d2b78bcdb2dcba38780
Summary:
Apparently, clang infers that pointer variables in private
structs are unreferenced if they are aliased by parameter names in the
constructor. This doesn't appear to happen with variable passed by
reference. Unalias the field to work-around the problem.
Test Plan: ./fb_build_rpm.py on OS/X
Reviewers: ttung, durham, simpkins
Reviewed By: simpkins
Subscribers: quark, net-systems-diffs@, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3978090
Tasks: 13740577
Signature: t1:3978090:1475709499:e50c751341d172f055ed02376521bd880644b01f
Summary: Updating another copy of the script from D3973940
Test Plan: Same as D3973940
Reviewers: #sourcecontrol, rmcelroy
Reviewed By: rmcelroy
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3973951
Signature: t1:3973951:1475659840:3bcf1c48a2332a1572bc6d450627b4fa9e8b338f
Summary:
fbamend.py has several unused imports. This is annoying since I'm actively working on this file.
This change removes and consolidates the imports.
Test Plan: All unit tests for this file (namely test-fbamend.py and test-fbamend-nextrebase.py) still pass.
Reviewers: #sourcecontrol, durham, quark, stash
Reviewed By: stash
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3965839
Signature: t1:3965839:1475573964:e7937ce7e7bc35655d629345156c4d177f185605