Upstream no longer always uses bookmark.write to write. Sometimes it goes
through the transaction API and uses bookmark._write. So now we wrap that
instead.
Also adds a test that would have caught this, since the existing commit/bookmark
tests did not exercise this new write path.
Summary:
Add 'stop' verb to histedit. This is the version I submited to the ML
which got rejected because it doesn't preserve hashes. However as arc will
always modify the hash anyway that's save for us anyawy.
Test Plan: run tests, worked.
Reviewers: durham, sid0
Subscribers: akushner
Differential Revision: https://phabricator.fb.com/D1606075
Summary:
This adds an extension that tracks the locations of the working copy and
bookmarks over time. It's still a proof of concept, but I want to get it
deployed to start getting feedback.
Running `hg reflog` by default shows the previous locations of the working
copy (most recent first).
~/myrepo> hg reflog
Previous locations of '.':
35a5fcfee452 rebase -d master
32eee5e2d406 up .^
b5d6dab4f900 up foo -C
Specifying a bookmark name shows the locations of that bookmark over time.
~/myrepo> hg reflog foo
Previous locations of 'foo':
d1a696044ec0 rebase -d master
35a5fcfee452 rebase -d master
32eee5e2d406 book foo -f
--verbose will show more information about each entry.
~/myrepo> hg reflog foo -v
Previous locations of 'foo':
35a5fcfee452 -> d1a696044ec0 durham 2014-10-01 18:32:14 rebase -d master
32eee5e2d406 -> 35a5fcfee452 durham 2014-10-01 17:28:54 rebase -d master
000000000000 -> 32eee5e2d406 durham 2014-10-01 17:28:30 book foo -f
It's currently stored as a single .hg/reflog file that is append only. Each
entry can store an arbitrary number of hashes (like storing 2 hashes for a merge
state working copy), which means we could also potentially use this to track
heads in branches as well.
It also (sorta) works with '-T json' for machine readable output:
~/myrepo> hg reflog foo -T json
[
{
"command": "up .^",
"date": "2014-10-02 13:54:45",
"newhashes": "474ff61d1a36",
"oldhashes": "d1a696044ec0",
"user": "durham "
},
{
"command": "book foo",
...
]
Test Plan: Added tests. Ran them.
Reviewers: sid0, pyd, mpm, davidsp, akushner
Differential Revision: https://phabricator.fb.com/D1592875
Summary:
Pull-prefetch would not download file versions from the server if the file
version already existed in the local cache or the local store data.
Unfortunately, if someone landed their commit, then later stripped their local
version, the local store data file version might become invalid and no local
cache version would exist. Meaning things like 'commit' might fail when offline.
This changes prefetch to always fetch from the server when dealing with files it
knows are from revs on the server.
Test Plan:
Added a test that makes local commits that already exist on the
server, and verifies that a pull-prefetch fetches the server file version,
despite that same version existing locally.
Reviewers: sid0, pyd, davidsp
Subscribers: orip
Differential Revision: https://phabricator.fb.com/D1607260
Summary:
Add a bunch of features to make `hg grep` full-featured.
- Support for basic, extended and Perl regexps.
- Support for filter patterns, including filesets.
- Support for color in the output.
Test Plan: Ran the tests, and ran `hg grep` against the repo.
Reviewers: davidsp, akushner, pyd, daviser, durham
Reviewed By: durham
Subscribers: robarnold
Differential Revision: https://phabricator.fb.com/D1578743
Summary: I added a grep command that does the wgrep alias. I also moved the traditional functionality of grep to histgrep. One thing missing is the help strings.
Test Plan:
I used both wgrep and my new grep on a couple queries in www. They returned the same results. I did similar things with the traditional grep and my histgrep.
I wrote tests in fb-hgext/tests/test-tweakdefaults.t and they passed.
Reviewers: pyd, davidsp, akushner, durham, sid0
Reviewed By: durham, sid0
Subscribers: akushner, micha
Differential Revision: https://phabricator.fb.com/D1572855
Tasks: 5162839
Summary: Allow git hashes to work with a `g` suffix, sort of like Subversion's `r`.
Test Plan: Ran the tests, and tested it out in fbandroid-hg.
Reviewers: davidsp, akushner, pyd, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1571258
Summary: With tweakdefaults `hg rebase` broke when the destination contained a hyphen. This made me sad :(
Test Plan: Tested rebase with hyphen, and ran tests.
Reviewers: pyd, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1565265
Summary: The location of `bundle2caps` changed.
Test Plan: Ran the tests, saw that they no longer failed.
Reviewers: durham, davidsp, akushner, pyd
Reviewed By: pyd
Differential Revision: https://phabricator.fb.com/D1562466
Tasks: 5170539
Summary:
Upstream Mercurial changed the way merging works and added
revlog.commonancestorsheads. This changes remotefilelog to implement the same
API.
Previously we were able to use ancestors.genericancestors to do the graph
traversal. Upstream Mercurial has deleted that function though (since it is now
unused), so remotefilelog must now build a temporary rev graph in order to use
the ancestors.* apis.
Test Plan: Added a test. It failed without the fix, it passes with the fix.
Reviewers: sid0, davidsp, pyd
Differential Revision: https://phabricator.fb.com/D1566787
Summary: This makes the error easier to read.
Test Plan: Ran `hg update`, saw that the error was printed across two lines.
Reviewers: durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1542591
Summary:
With recent version of mercurial (>= 3.2, 4dfcf21a6aa7), revert uses status
information to determine the files that needs to be touched. It then offer a
simple handle for extensions that needs prefetch.
Test Plan:
Ran the tests. Certain tests depended on the old revert behavior (of
prefetching everything), so they required slight changes.
Reviewers: pyd, sid0, davidsp
Differential Revision: https://phabricator.fb.com/D1551059
Summary:
Changegroups have been refactored upstream and we need to update our
remotefilelog monkey patching accordingly.
Also fix an issue with the tests where 'function foo()' was not considered valid
on certain systems.
Test Plan: Ran the tests
Reviewers: pyd, sid0, davidsp
Differential Revision: https://phabricator.fb.com/D1551019
Summary:
The tweakdefaults extension broke 'hg update -r'. This fixes it and
adds a test.
Test Plan: Added a test.
Reviewers: sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D1506040
Summary:
Previously, if pullprefetch was set, we'd perform a prefetch of the
entire manifest of the specified revs (usually the public bookmarks). This
involved stat-ing all the relevant files in the cache to see if they already
existed, which added an extra 6 seconds or so to every pull.
Now we only prefetch the files that are different from our working copy. We
assume we already have all the files that are in our working copy. This reduces
the pullprefetch overhead significantly.
Test Plan:
Did a pull on my laptop. Verified it didn't hang for 6 seconds at the
prefetch stage. Also updated a test
Reviewers: davidsp, pyd, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D1505841
Tasks: 4608894
Summary:
Previously, pullprefetch was executed during the repo.pull stage. This happens
before the bookmarks have been moved, so revsets like 'bookmark()' would
prefetch the wrong commits.
This change moves the pullprefetch logic to after the pull command is completely
finished. Updated a test to make sure this is caught.
Also fixes a bug where we were using linkrevs to read a manifest rev entry. We
should be using the manifest rev instead.
Test Plan: Added a test. Ran it.
Reviewers: sid0, pyd, davidsp
Differential Revision: https://phabricator.fb.com/D1483345
Summary:
This makes tweaks to the Mercurial defaults, to improve the user experience:
- hg update without arguments now aborts
- hg log now defaults to -f
- hg rebase without -d now aborts
- hg rebase will fast forward a bookmark if possible
Test Plan: Added a test, ran it.
Reviewers: mpm, sid0, davidsp, dschleimer, akushner
Differential Revision: https://phabricator.fb.com/D1501398
Summary:
Due to a change in upstream mercurial, hg log with patterns was no longer
working. This fixes it by forcing hg log to take the slow path when using
patterns.
It also updates the warning messages to work when running hg log <file> from
within a subdirectory.
Test Plan: Ran the new tests
Reviewers: sid0
Differential Revision: https://phabricator.fb.com/D1450193
Summary:
Adds a remotefilelog.pullprefetch config options that accepts a revset. Whenever
a pull is run, the revs matched by that revset will be prefetched. The most
common value for this will be '(bookmark() + heads(all())) & public()', since it will download
almost everything necessary to work offline.
Test Plan: Added a test. Ran it.
Reviewers: davidsp, pyd, sid0
Reviewed By: sid0
Differential Revision: https://phabricator.fb.com/D1419420
test-local.t was flakey because the state of the dirstate is non-deterministic
if files are written out within the same second. This rebuilds the dirstate
entirely in a few cases, which removes the flakeyness.
Summary:
When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it.
This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be
- part of hg-git
- not send the entire git metadata over, just the bits that are needed based on a common/heads computation
- be dependent on bundle2
- (probably) be part of the pull operation, not a separate command
- be configurable with an option
This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack.
Test Plan:
Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592
(in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059)
hg gitgetmeta ../fbandroid-from-git
Saw that 3 files were written out.
hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git
Saw that 3 files were written out.
Reviewers: dschleimer, davidsp, akushner, durham, pyd
Reviewed By: pyd
Differential Revision: https://phabricator.fb.com/D1341166
Tasks: 3751836
Summary:
Recent changes to upstream Mercurial have moved localrepo.getbundle and
localrepo.addchangegroupfiles to changegroup.py. remotefilelog wraps these
functions, and thus needs to be updated.
Applyupdate also had a function signature change, which is fixed here.
Minor fix to a test as well, which had a hard coded time instead of a glob.
Test Plan: ./run-tests.py --with-hg=/data/users/durham/hg/hg
Reviewers: sid0, davidsp, pyd, dschleimer
Differential Revision: https://phabricator.fb.com/D1260737
Preivously shallow clones only work using the streaming clone protocol. With
this change they work for the standard getbundle protocol as well. This is what
the majority of Mercurial users use, so we need to support that.
Summary:
hg bundle was producing shallow bundles. This change makes it produce full
sized bundles so they can be used in other repos.
Test Plan: Added a test
Reviewers: sid0
Reviewed By: sid0
CC: keegancsmith
Differential Revision: https://phabricator.fb.com/D1167462
Summary:
Previously requesting remotefilelog file blobs from the server required write
access in order to write the blob to the cache. This changes it to not abort
entirely if the user doesn't have write access.
Test Plan:
cd tests
./run-tests.py --with-hg=/data/users/durham/hg/hg test-permissions.t
Also ran the test without the fix and verified it fails.
Reviewers: sid0, davidsp, pyd, dschleimer
Reviewed By: dschleimer
Differential Revision: https://phabricator.fb.com/D1145976
Task ID: 3601184
The remotecmd config is no longer necessary since we now use a dummy ssh. It
was also hardcoded for a specific filesystem structure, which didn't work on
other machines.
Summary:
Adds a 'hg prefetch' command to remotefilelog for prepopulating the
local cache. Supports specifying revsets and file patterns to limit what is
downloaded.
Test Plan: ./run-tests.py test-prefetch.t --with-hg=/data/users/durham/hg/hg
Reviewers: dschleimer, sid0, davidsp, pyd, mpm
CC: kunalb, minyoung
Differential Revision: https://phabricator.fb.com/D1129942
Enables specifying a name for a repo that is used in the cache key.
This allows multiple repos on a machine to share a cache without the
risk of keys overlapping.
The previous algorithm thought that if the system cache had the file rev, it was
guaranteed to be valid. This isn't true in the case of a machine in which
multiple people share the cache (one person may have pulled a rev but the other
hasn't).
The new algorithm is more explicit. It checks:
- system cache
- local cache
- local cache fallbacks
- remote cache
- master server
The remotefilelog extension currently doesn't work with tags. Adding include and
exclude patterns allows users to specify which files they want to treat as
shallow and which the want to download the entire history for. By excluding
.hgtags from being shallow, this enables tags to work in a mostly shallow repo.
This also enables largefile like scenarios where most files are full and only a
few large ones are kept remote.
A rare bug can occur where the local file blob might not exist, but a valid old
version of that blob does exist. This refactor the linknode logic in ancestormap
to check the old versions if the server fetch fails to find the blob.
It still prints an ugly warning message from the server, but this whole issue is
quite rare anyway.