Commit Graph

3443 Commits

Author SHA1 Message Date
Durham Goode
4d88e89c3e Backout fb666f865e02 so we can deploy
fb666f865e02 fixed gitlookup to work with upstream Mercurial, but we aren't
ready to deploy upstream Mercurial yet.  So I'm backing it out so we can deploy
the fb-hgext rpms in the mean time.
2014-10-10 11:06:19 -07:00
Durham Goode
bd577925d9 reflog: adds a reflog extension to fb-hgext
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
2014-10-02 14:04:54 -07:00
Siddharth Agarwal
f39cd51723 merge with default 2014-10-09 23:09:24 -07:00
Siddharth Agarwal
058326f2c9 [gitgetmeta] fixes for upstream API changes
Summary: per @pyd

Test Plan: Ran the tests.

Reviewers: pyd, davidsp, durham

Reviewed By: durham

Subscribers: pyd, sourcecontrol-dev@

Differential Revision: https://phabricator.fb.com/D1602043
2014-10-07 18:19:17 -07:00
Siddharth Agarwal
51e00c416b [githelp] add ls-files
Summary:
A couple of people requested this.

Also add `git` as an alias and fix the function name.

Test Plan:
Kicked the tires a bit.

```
hg git -- git ls-files
hg git -- git ls-files '**/*.py'
hg git -- git ls-files -m '**/.py'
hg git -- git ls-files -z '**/.py'
```

Reviewers: daviser, davidsp, akushner, pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1608002

Tasks: 4515847
2014-10-09 19:26:29 -07:00
Durham Goode
9962f55805 gitrevset: hide ssh warnings
Summary:
sshing to the hg server could result in stdout containing 'remote: ...' (like if
the user had an extension enabled that wasn't on the server). This interefered
with fbmake being able to parse the git hash and broke fbmake for people with
such configs.

The fix is to redirect it to stderr instead.  I tried using ui.push/popbuffer
but it doesn't actually work because the ui that is being used is newly
constructed as part of the peer being created, and therefore doesn't respect the
buffer stack. I also tried ui.quiet=True, but that also failed, as newly created
ui's don't inherit the original quiet value, but instead look at the main
config['quiet'].

Test Plan:
Added a bogus extension to my ~/.hgrc

    hh log -r 1095d3a297300405f679826fc78d52c8a6c1da85 -T '{gitnode}\n' 2>/dev/null
    hh log -r g988fa44ff4bebf4093b09ef27b5e24702ebda6ab 2>/dev/null

Verified there was no 'remote:' output.

Reviewers: sid0, mpm, pyd

Differential Revision: https://phabricator.fb.com/D1604547
2014-10-08 16:48:59 -07:00
Siddharth Agarwal
3352fc0344 [grep] ignore symlinks
Summary:
Previously, `hg grep` would follow symlinks because that's what `grep` does. This is a problem in fbcode because of all the tp2 and dewey symlinks. Handroll our iteration and ignore all files recorded as symlinks in the dirstate. This isn't perfect, but it's good enough and it's a lot faster than stating all the files.

Presumably we can integrate this with hgwatchman at some point.

Now, `hg grep <random string>` in fbcode takes just 2.6 seconds. (`git grep` takes 4.)

Test Plan: Ran tests.

Reviewers: daviser, akushner, davidsp, pyd, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1587863
2014-09-30 16:37:32 -07:00
Durham Goode
3ecee80a81 Allow ancestormap to contain hidden commits (sometimes)
Summary:
When doing 'hg unshelve foo.txt' with Changeset Evolution enabled, uncommit will
first prune the commit, then try to read the filelog history to determine if any
renames need to be undone. Since the commit is now pruned, remotefilelog fails
to find any valid histories.

This fixes it two allow hidden histories if the filectx commit is hidden. It
also tweaks remotefilectx to produce commit-relative histories when possible,
which will result in more accurate histories.

Test Plan:
Ran hg uncommit in the evolve repo that had problems before. Verified
it now worked.

Reviewers: pyd, sid0

Differential Revision: https://phabricator.fb.com/D1587306
2014-09-30 14:40:09 -07:00
Durham Goode
8a5a5330c1 Fix pullprefetch for recently landed commits
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
2014-10-09 15:20:54 -07:00
Durham Goode
10667d93fd Move command wrapping to be inside extsetup
Summary:
Previously we wrapped commands at global initialization time, which is just
plain wrong (since other commands may not have even be initialized yet). Now we
do it inside extsetup.  It's mildly important that we do it in extsetup (vs
uisetup) because other extensions, like remotefilelog, wrap commands in the
uisetup and we want to make sure that our tweaks (like passing -f to log) come
first.  And by wrapping last, we get invoked first.

Test Plan: Ran the tests

Reviewers: sid0, davidsp, pyd

Differential Revision: https://phabricator.fb.com/D1578154
2014-09-25 11:34:07 -07:00
Siddharth Agarwal
883a155fdd [tweakdefaults] superpower grep
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
2014-09-25 13:50:36 -07:00
Erin Davis
266fba185b Updated the githelp command to reflect wgrep and grep swap
Summary: The hg equivalent of git grep is hg grep now.

Test Plan: I used the extension and called hg githelp -- git grep and it said hg grep

Reviewers: sid0, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1576499

Tasks: 5162839
2014-09-24 16:29:04 -07:00
Erin Davis
51411dc368 Swapped the functionality of grep with wgrep and added histgrep
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
2014-09-24 15:11:10 -07:00
Siddharth Agarwal
db408787ea [gitrevset] also support stringsets
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
2014-09-22 18:58:36 -07:00
Siddharth Agarwal
d992bf1282 [tweakdefaults] fix rebase when destination contains a hyphen
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
2014-09-18 17:22:14 -07:00
Siddharth Agarwal
2610f6b5fe [gitlookup] fix compatibility with Mercurial 3.2
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
2014-09-17 16:40:37 -07:00
Siddharth Agarwal
5c8fd3cbd8 merge with default 2014-09-17 16:38:57 -07:00
Siddharth Agarwal
18687164fa fix test-fbamend.t for Mercurial 3.2 2014-09-17 16:37:11 -07:00
Pierre-Yves David
548b8af8b5 client: add a second argument to ResponseError
Summary:
The ResponseError exception expect a second argument. Otherwise the code
handling it crashes.

Test Plan: The handling of the response error stop crashing.

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1581574
2014-09-11 20:30:16 +02:00
Pierre-Yves David
c72eed0894 clone: have a more robust finally clause
Summary:
If the orig function crash before the fileservice is installed, the finally
clause explode, shadowing the original error. We fixes thats.

Test Plan:
  crash stopped being shadowed but crash in the finally clause.

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1581562
2014-09-11 20:08:42 +02:00
Siddharth Agarwal
5faaeedd84 [remotefilelog] fix packmeta call
Summary: API change

Test Plan: @durham ran an amend.

Reviewers: durham

Reviewed By: durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D1569510
2014-09-22 11:38:04 -07:00
Durham Goode
c7f1c0b383 Fix committing merges
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
2014-09-19 12:21:30 -07:00
Siddharth Agarwal
8d48e1e5ee fix for parsemeta API change
Summary: This was broken by recent changes.

Test Plan: Ran test suite.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1558890

Tasks: 5170539
2014-09-16 13:28:03 -07:00
Siddharth Agarwal
70693db843 add some convenience features 2014-09-08 12:49:25 -07:00
Mark Berger
e256bbd83e Adds a wip extension to share bookmarks at FB
Summary:
Adds a wip extension which will allow clients to checkout
bookmarks from their peers instead of using arc patch.
This is accomplished by writing metadata about every
commit to a mysql database. When the user attempts to
checkout another user's bookmark, eg `hg checkout mjberger/test`,
the extension queries the mysql server to see if the bookmark
'test' exists on mjberger's dev server. If so, the extension
will use 'hg pull' to download the bookmark.

This is a wip and should not be used in production. Besides being
a hacky implementation, it currently relies on fbcode and does
not remove bookmarks from the mysql server when the client deletes
them.

Test Plan: doitlive

Reviewers: durham

Reviewed By: durham

Subscribers: njormrod, agallagher

Differential Revision: https://phabricator.fb.com/D1542144
2014-09-08 10:28:33 -07:00
Jez Ng
047c4ecd44 Add gitrevset support.
Test Plan: Extended unit tests.

Reviewers: sid0, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1543259

Tasks: 5049742
2014-09-08 15:36:12 -07:00
Siddharth Agarwal
6213002265 merge heads 2014-09-08 15:45:57 -07:00
Siddharth Agarwal
554be401b3 update run-tests.py 2014-09-08 12:49:25 -07:00
Siddharth Agarwal
bb96467321 [tweakdefaults] use hint for no-arg update message
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
2014-09-08 12:43:38 -07:00
Pierre-Yves David
2c956d95e2 revert: only pre-fetch files that needs to be touched
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
2014-09-08 15:20:59 +02:00
Durham Goode
580f3eaeb3 Update to match Mercurial version b8c8cacd4482
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
2014-09-11 14:39:14 -07:00
Durham Goode
d1e9ad4603 Fix hg update -r 2014-09-03 08:46:45 -07:00
Durham Goode
0df0625354 Fix 'update -r' to work with the new defaults
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
2014-08-19 11:21:45 -07:00
Durham Goode
17c16cf610 Optimize pullprefetch to limit number of stats
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
2014-08-19 09:33:31 -07:00
Durham Goode
8ee4b83502 Fix rebase default tweak to allow --abort and --continue. 2014-08-18 14:27:37 -07:00
Durham Goode
e46cd0e8e0 Merge heads 2014-08-07 10:23:18 -07:00
Durham Goode
e5228d9989 Fix pullprefetch that uses bookmarks
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
2014-08-06 18:50:57 -07:00
Siddharth Agarwal
07a515c430 don't show remotefilelog commands in the shortlist
Summary: These commands (well, not the debug one) were visible in the shortlist that showed up when you type `hg`. They're not basic commands.

Test Plan: Ran `hg` with the extension enabled, didn't see those commands.

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1454931
2014-07-23 20:37:48 -07:00
Durham Goode
f8b8c6a763 Tweak default update, log, and rebase behaviors
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
2014-07-23 09:47:35 -07:00
Pierre-Yves David
94c677f0ef Merge the external hg-experimental repository into the internal one.
This will allow simple synchronisation between the public facing and the
external repository. Change to the Facebook only extension should be done on in
the fbonly branch. Fix the public facing extension should happens in the default
branch.

Merge should always happen from default to fbonly. Never the other way around.

Beware that facebook only changesets exist on the default branch before this
merge.
2014-07-28 18:38:44 -07:00
Delyan Kratunov
eea8a70884 [phrevset] Add ability to parse git revisions from Phabricator
Summary:
We couldn't handle the git case (fbandroid-hg) at all. This fixes that.

I changed my .hg/hgrc to have
```[phrevset]
callsign = FA```
but I've no idea how to do that globally.

Test Plan:
```
[diffrev] Starting Conduit call
[diffrev] echo '{"revision_id": "1153911"}' | arc call-conduit differential.getdiff
[diffrev] Starting log walk
[diffrev] Traversing log for 1153911
[diffrev] Conduit call returned 0
[diffrev] VCS is git
[diffrev] GIT rev is 34838a7f1d68531f385e471bf76f89c6620ea563
Path: ssh://hg.vip.facebook.com//data/scm/fbandroid opts: {}
running ssh hg.vip.facebook.com 'hg -R /data/scm/fbandroid serve --stdio'
sending hello command
sending between command
remote: 199
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream-preferred streamreqs=lz4revlog,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 remotefilelog
remote: 1
sending lookup command
[diffrev] HG rev is e67eac10eef35a21a3b61f8aa8caa330884d48d4
...
```

Reviewers: sid0, davidsp

Reviewed By: davidsp

Differential Revision: https://phabricator.fb.com/D1458491
2014-07-24 20:27:05 -07:00
Delyan Kratunov
c0418e22e8 [phrevset] Fix failing lookup
Summary: phrevset was completely broken, even for the case where it does a linear search.

Test Plan:
Tested before and after in fbandroid-hg. It was finding the revision but
`hg log -r 'DXX'` wasn't printing anything.

Reviewers: sid0, davidsp

Reviewed By: davidsp

Differential Revision: https://phabricator.fb.com/D1458472
2014-07-24 19:36:09 -07:00
Andy Pincombe
8b485aaed4 Fix time import in backups
Summary: Fix the import of the time package for calls to strftime() and localtime().

Test Plan:
* Edited /usr/lib/python2.6/site-packages/backups.py, cleared .pyo & .pyc, and verified
that `python -c "import backups"` didn't error out on import

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1456741
2014-07-24 15:03:53 -07:00
Durham Goode
99d6595d48 Fix phases during hg backups --recover
We weren't locking the repo when running unbundle during hg backups --recover.
This caused the phase roots to not actually be written to disk.
2014-07-22 13:11:09 -07:00
Durham Goode
c44433c62c Fix hg log on patterns
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
2014-07-22 12:55:29 -07:00
Durham Goode
124d6bd76b Update crecord extension 2014-07-14 18:52:11 -07:00
Durham Goode
549fee35f4 Merge divergent heads 2014-07-14 17:34:10 -07:00
Durham Goode
13058fb30c Allow auto-prefetching during pulls
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
2014-07-03 13:05:11 -07:00
Igor Pozgaj
0b3afb8ca4 Add entry for git blame
Summary: hg githelp blame didn't work

Test Plan: not sure how to test this

Reviewers: pyd, davidsp, durham

Reviewed By: durham

Subscribers: sameen

Differential Revision: https://phabricator.fb.com/D1411080
2014-06-30 11:17:41 -07:00
Siddharth Agarwal
f662120645 merge 2014-06-21 16:06:06 -07:00