Commit Graph

2249 Commits

Author SHA1 Message Date
Durham Goode
26e1154b71 repack: make repack more generic
Summary:
Previously the repack logic was hardcoded to only work on the shared cache
stores. This patch refactors that knowledge to a higher level so a future patch
can also repack the local stores as well.

Test Plan: Ran the tests

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4260569:1480694802:30ab24dd031661227b4da1febc3d3daf9ad598fb
2016-12-02 14:37:42 -08:00
Durham Goode
569e3f4d38 treemanifest: support fastdelta fast path
Summary:
When making a commit to the flat manifest revlog, we need to produce a full text
delta. Previously we would have to convert our treemanifest into a text string
so we could produce the delta, which takes many seconds. With this patch, we now
take advantage of the fastdelta code path which can generate a delta given the
parent fulltext and the list of changes.

Test Plan:
Ran rebase with treemanifests and verified it was much faster because
it didn't try to produce a full text from the in memory treemanifest.

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: ikostia, rmcelroy, mjpieters

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

Signature: t1:4249375:1480509343:3a130e8730522e31bd7a08440121a1451046a32c
2016-12-02 14:37:40 -08:00
Durham Goode
52a399a6a9 fastmanifest: refactor add()'s fastdelta usage
Summary:
A future patch will make treemanifests also use the fastdelta fast path. To
support that, let's refactor the fast path to separate the fastmanifest specific
part.

Test Plan: Ran the tests

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: rmcelroy, ikostia, mjpieters

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

Signature: t1:4249369:1480509029:b6d08a4f9ef6581a4a2c1bed7f7db8ff084fc35d
2016-12-02 14:37:37 -08:00
Durham Goode
d4cfb31a2b fastmanifest: move fastdelta to a top level function
Summary:
A future patch will make treemanifests able to use fastdelta as well, so let's
move the function to be global so we can reuse it.

Test Plan: Ran the tests

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4249364:1480507778:a00bb7b6301ca2f716c542f37f7150f2f6231640
2016-12-02 14:37:35 -08:00
Durham Goode
3de4f9ec15 treemanifest: always use flat manifest to get full text
Summary:
Treemanifests are naturally slower to produce full texts than just reading the
text directly from the manifest. So let's change our hybrid manifest
implementation to prefer flat manifests over tree manifests for text(). Fast
manifests are still faster to produce full texts, so we leave those as the
highest preference. This speeds up commit time when using treemanifest since
we don't need to construct the text from the tree for producing the delta that
goes into the revlog.

Test Plan:
Ran rebase with tree manifests enabled and verified it was
significantly faster. Also manually timed the fast vs flat text logic to ensure
fast was actually faster for text() than flat.

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters

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

Signature: t1:4249354:1480505430:f9e712a2db49c56680ce34cd3f68c85841393b39
2016-12-02 14:37:33 -08:00
Durham Goode
7a71d2e604 ctreemanifest: implement fast path for matches
Summary:
The original python code for manifest matches has a fast path for when the
matcher contains a specific list of files, this let it check those specific
files instead of iterating over the entire manifest. Let's add this same
optimization to our ctreemanifest implementation.

This greatly speeds up copies._computeforwardmissing() during rebases.

Test Plan: Ran rebase and verified it was much faster

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4248075:1480505248:964cbdd701fe29c38a7a0d9bf0752fb5d4bb0ed0
2016-12-02 14:37:31 -08:00
Durham Goode
6492dbbf03 hybridmanifest: don't reuse node in match results
Summary:
Previously, _converttohybridmanifest would always create a new hybrid manifest
with the same node as the original. This meant that some code paths would
attempt to use the treemanifest from the node, instead of the already prepared
matches result. This meant the output could contain all the values from the
original tree, instead of just the matches output.

This is actually a regression from 98ba34a5194c09. Prior to that, matches did
not reuse the node.

Test Plan: Manually inspected the results in the debugger during a rebase.

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4247821:1480499268:27f4a1b92ecf5d10009996b5b8f22bac02f3f38e
2016-12-02 14:37:28 -08:00
Jun Wu
1a05e790ca linkrevcache: update documentation
Summary:
This patch changes docstring to make it clearer about how to use the
extensions. It provides some possibly useful details.

Besides, update `testedwith` to be consistent with other extensions.

Test Plan: My vim spellchecker seems happy.

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4263123:1480668147:d042e9b52d0a2759ac360c87a2c87d2d3b0aa0f9
2016-12-02 00:59:48 +00:00
Pascal Hartig
a7cffaf493 hgext: githelp support for commit -C
Summary:
Add support for `git commit -C <commit>`/`git commit --reuse-message <commit>`.

E.g.

```
hg githelp -- git commit -C deadbeef
hg commit -M deadbeef
```

Test Plan: Added test case for the new feature

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4258167:1480674937:4f21fd43272462c8c5eee40a02d0db7014c834d4
2016-12-02 10:41:54 +00:00
Jun Wu
5d5fedd10c tweakdefaults: fix check config test
Summary:
This fixes test-check-config-hg.t for tweakdefaults. And did some clean-up
for other minor issues.

I was trying to implement another feature (along with the clean-up) in
tweakdefaults and finally realized it's infeasible and drop the feature. But
the clean-up seems useful thus sent here.

Also change `cp -r` to `cp -R` to pass the usptream check-code test.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Signature: t1:4253852:1480613350:398e9b234fcc2360dcb8a3e3ad4e5bc5c4377857
2016-11-30 20:58:08 +00:00
Jun Wu
22742a1054 fastannotate: conditionally disable remotefilelog annotate prefetching
Summary:
If the annotate cache is up-to-date on the main branch, there is likely no need
to prefetch file contents, unless the user is annotating a side branch, which
requires a deeper integration between fastannotate and remotefilelog to just
prefetch the missing part correctly - I'll think about it later while this diff seems
good enough for common cases.

Test Plan: Added a new test

Reviewers: durham, #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4256370:1480612767:c2e2a9225fb63ff36ffb579f9641851eb8cd8b39
2016-12-01 02:12:53 +00:00
Jun Wu
5a5a7662cd tests.t: clean up the shell code a bit
Summary:
Simplifies some shell code, namely `$extpath` is duplicated with `$TESTDIR/..`
so remove one of them.

Change `library.sh` (used by remotefilelog tests) to reuse `$HGRCPATH` instead
of overriding the environment variable, because it never gets restored and the
current code would assume `$HGRCPATH` to have `.hgrc` as its basename, which is
not always true.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4256506:1480612191:73832c427b6562b9000a6df006226653157a7156
2016-12-01 02:06:57 +00:00
Jun Wu
bf8615b740 fastannotate: some clean-ups before the remotefilelog change
Summary:
The upcoming remotefilelog change would require some cleanups to avoid code
duplication. Namely:

- Add a `fctxannotatecontext` so we can easily get a `annotatecontext` from
  within `filectx.annotate` or `remotefilectx.annotate`.
- Print something instead of ignoring errors silently in `_fctxannotate`.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: stash, mjpieters

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

Signature: t1:4256469:1480612106:63756d64014a5b9e798bce52eda0d3e7368d6cba
2016-12-01 02:03:44 +00:00
Jun Wu
786439a1c0 fastannotate: skip downloading linelog if the file history is short
Summary:
If the history of a file is short, it would be easier to just build the
linelog locally, instead of downloading it from the server.

This diff adds a "threshold" config option to make it possible for the client
to skip downloading linelogs.

A special case is, the file only has a single revision, where we can just avoid
all SSH connections - no fileservice peer, and no annotate peer.

Test Plan:
Add a test case for testing filelog repo.
Note: remotefilelog repo is not tested for this feature yet because there is
other planned changes related to remotefilelog.

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4255483:1480611801:4eb79c66eaf1fb5436d550f13c7a78d09b9a1ee2
2016-12-01 00:23:24 +00:00
Jun Wu
bdf8638228 fastannotate: allow the client to build up annotate cache on its own
Summary:
Previously fastannotate client will always fetch linelog from the server,
regardless of how long the history of a file is.

It actually makes sense for fastannotate client to build up the annotate
cache on its own, if, for example, the file only has one single revision,
where we don't even need any kind of SSH connection.

Test Plan: Run existing tests

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4254602:1480611745:a44e70495771cb4f5c508ebb05fcfe8b0bb4d53f
2016-12-01 00:15:51 +00:00
Stanislau Hlebik
7dc24c7c82 infinitepush: backup local heads and bookmarks
Summary:
Backuping changesets is not enougn for restore. We also want to backup heads
and bookmarks to completely capture the state of the repo.

This diff is the first step in implementing this functionality. It adds new
bundle2 part which contains encoded dict (simple json encoding is used).
If value in the dict is empty then key is the bookmark pattern to delete.
If value is not empty then key is the bookmark name to save and value is a
node hash. The reason to put them in the same part is to make it possible to
delete and insert into indexapi in one transaction. It's also possible to pass
patterns to delete in part parameters but there is a bug in upstream hg that
limits parameters' size to 256 and we can potentially have longer bookmarks.

Local bookmarks are saved in infinitepush in the following form:
  infinitepush/backups/USERNAME/HOSTNAME/REPOROOT/bookmarks/LOCAL_BOOKMARK_NAME

Local heads are saved in infintiepush in the following form:
  infinitepush/backups/USERNAME/HOSTNAME/REPOROOTheads/HEAD_HASH

Hostname, username and repo root is necessary to distinguish different backups.

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4245080:1480518959:aa199d67fac4e2cd2f543651ff56fdd649dac729
2016-12-01 08:44:57 -08:00
Stanislau Hlebik
f6d771aeda infinitepush: addmanybookmarks indexapi method
Summary:
Right now `hg debugbackup` backups only changesets.  We also want to backup
bookmarks.  Since user may have many bookmarks let's add a separate method
that will save many bookmarks at once.

Test Plan: Will be tested in next diffs

Reviewers: durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4244823:1480596116:7114128dafe2b8a10f599d05d68c1a6dce522f4a
2016-12-01 08:41:23 -08:00
Stanislau Hlebik
c2e54d52a7 infinitepush: make indexapi a context manager
Summary:
As @quark suggested let's make `indexapi` a contextmanager.
It greatly simplifies code

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: quark, mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4258082:1480596008:32c39150dbb1966e76064ad8d93a808c89d78b71
2016-12-01 08:40:09 -08:00
Jun Wu
fdfba9b17d fastannotate: fix perfhack with the new annotate wrapper
The new wrapper may pass aopts=None, which could be troublesome if perfhack
is enabled. Fix it by using the default aopts instead.
2016-11-30 21:22:52 +00:00
Stanislau Hlebik
d93c9f9d97 infinitepush: add deletebookmarks method to indexapi
Summary:
This methods accepts list of bookmark patterns to delete (patterns are not
supported yet, but they will be supported).

Test Plan: Will be tested in subsquent diffs

Reviewers: andrasbelo, rmcelroy, durham

Reviewed By: rmcelroy, durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4176016:1479144865:8c9121970878d4d462cc2c679a414999dfdce1f4
2016-11-30 06:49:21 -08:00
Stanislau Hlebik
35b49c7546 infinitepush: set push defaults in debugbackup
Summary:
Not setting all default options may result in KeyValue errors.
For example pushvars extensions does
  repo._shellvars = opts['pushvars']

It results in failure if 'pushvars' is not set.
Let's fix it by explicitly setting default values.

Also we need to set `allow_anon` to remotenames because otherwise
debugbackup will fail.

Test Plan:
Run `test-infinitepush-*`

Run `hg debugbackup` inside fbsource make sure there were no failures

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4237230:1480446802:36e0630ce3e60c947be47d83bbc6deff8624048e
2016-11-30 02:11:28 -08:00
Michael Bolin
9b730c722c Perform stricter check to test whether a repo is sparse.
Test Plan:
Without this change, running `hg commit` in Eden was failing with the following:

```
AttributeError: 'shallowrepository' object has no attribute 'getsparsepatterns'
```

This is because our Eden mount is *shallow*, but not *sparse*, and
`shallowrepository` has a `sparsematch` method, so it yielded a false positive
for this check in `sparse.py`:

```
        if util.safehasattr(repo, 'sparsematch'):
```

Because the first thing that is called after this check is:

```
            _, _, profiles = repo.getsparsepatterns(ctx.rev())
```

it seems more appropriate to test for the `getsparsepatterns` attribute, anyway.

Reviewers: simpkins, durham

Differential Revision: https://phabricator.intern.facebook.com/D4248940
2016-11-29 18:28:48 -08:00
Durham Goode
6f15ced334 remotefilelog: repack tree manifests
Summary:
Previously hg repack would only repack file content pack files. This patch makes
it also repack tree manifest pack files.

Test Plan:
Ran pull repack in a repo and verified the manifest packs were
repacked. I'll add some tests around this at some point.

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4240723
2016-11-29 16:00:39 -08:00
Durham Goode
fe6f541ed8 remotefilelog: reuse deltabase when history is not available
Summary:
Previously, if there was no history available for a given revision, we would
just store the full text in the pack file. This patch makes it attempt to reuse
the existing delta base instead. This will be useful for repacking
treemanifests, since we currently don't have histpacks for them (we just delta
them efficiently when they are first added to the repo).

Test Plan: Ran tests

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4240705
2016-11-29 15:37:58 -08:00
Durham Goode
61a86bdc94 treemanifest: catch pyexception for __nonzero__
Summary:
The recently added __nonzero__ function was not handling the possibility of
pyexceptions. This adds the appropriate catch.

A pyexception is where somewhere up the stack something has set the python error
string, and we just need to return the appropriate error value from the top
level c api to indicate an error happened.

Test Plan: none. I just caught this while debugging

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4202090
2016-11-29 15:37:58 -08:00
Durham Goode
a0dc16174d treemanifest: write deltas for trees
Summary:
Previously, when we wrote each tree entry into a pack file, it wasn't delta'd in
any way. This patch makes it store the delta against p1 in the pack file.

Testing in a large repo shows this reduces tree pack size by about 22x.

Test Plan:
Ran the tests. Did a pull in a large repo and saw the pack file was
22x smaller than before (and still usable).

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4202088
2016-11-29 15:37:58 -08:00
Durham Goode
ceb783595f treemanifest: add ManifestNode type and use it in NewTreeIter
Summary:
As part of enabling deltas in our tree pack files, we need NewTreeIter to return
the p1 and p2 Manifests as well. To do this we need to return a Manifest/Node
tuple. Since this is becoming a common structure, let's define a type for it and
change NewTreeIter to use it for it's return values.

Test Plan:
Ran the tests. With a future diff I built a pack file and verified it
was small because of deltas.

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4202080
2016-11-29 15:37:58 -08:00
Durham Goode
b179a3593c treemanifest: sort parent nodes for hash computation
Summary:
Core mercurial sorts p1 and p2 before computing the hash, so it's deterministic.
We need to do the same.

Test Plan: Ran the tests, saw a hash changed

Reviewers: #mercurial

Differential Revision: https://phabricator.intern.facebook.com/D4202063
2016-11-29 15:37:58 -08:00
Jun Wu
1c63f171b5 fastannotate: prefetch cache from server in fctx mode
Summary:
Previously, all prefetching work is done by the "fastannotate" command and
we may replace the "annotate" command with "fastannotate" and we run into
issues dealing with command line option differences.

Now that we have the "fctx" mode, do not redirect "annotate" to
"fastannotate" but wrap "annotate" in a lightweight way so it's responsible
for downloading the annotate cache.

Test Plan: Added a new test case

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4239607:1480447754:a84268a9e64c678c1f275bc04c44a6f4138eafe6
2016-11-29 11:51:08 +00:00
Jun Wu
a3dc8b960d fastannotate: support replacing fctx.annotate directly
Summary:
Previously, I have performance concern about the signature of
`fctx.annotate`: it returns fctxs, not ideal for performance since my
initial goal is to get rid of reading revlogs in the best case. And letting
the low-level `fctx.annotate` have some side effects writing to the disk is
not that pretty.

Because of that, fastannotate had re-invent part of the formatter (also
optimized for performance somehow), and still cannot support all the
features the original annotate supports, namely, templates.

Now it makes sense to just replace `fctx.annotate` with a sub-optimal
implementation, just for the flexibility of the template support of the
original annotate command. We can use a "fake" or "lazy" fctx object to
minimal the performance impact when people only need to print changeset
nodes and line numbers - in which case we don't read revlog.

Actually, the hgweb support already did a similar thing - converting
fastannotate output to annotate output. So we can reuse some code.

The next planned steps are:

  - Make the original "annotate" command aware of fastannotate protocol, do
    the pre-download stuff (downloading cache files at `fctx.annotate` is
    possible but inefficient because of not being batched).
  - "fastannotate" command remains a separated command optimized for perf
    and provides extra features like "--deleted".

Because of the plan, the "commands" option does not make much sense -
"fastannotate" command will not replace "annotate" directly thus dropped
from the config interface. A new "modes" config option is added to control
how fastannotate works.

Test Plan: Modified existing tests

Reviewers: #sourcecontrol, simonfar

Reviewed By: simonfar

Subscribers: mjpieters

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

Signature: t1:4238998:1480447679:c48e0e565663c086293265e104d9cf414d913aa7
2016-11-29 11:51:08 +00:00
Adam Simpkins
d3a77bd1f3 [infinitepush tests] don't hang forever if getdb.sh does not exist
Summary:
Fix the test to abort if getdb.sh does not exist (or otherwise fails), rather
than ignoring the failure and continuing to try and run the remainder of the
test anyway.  Otherwise mysql will hang forever.

The run-tests.py code unfortunately can't even kill the test properly in this
situation, so even with a --timeout argument it still hangs forever.

Test Plan:
Ran the tests without getdb.sh, and confirmed it failed quickly instead of
hanging.

Reviewers: durham, rmcelroy, stash

Reviewed By: stash

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

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

Signature: t1:4242014:1480408476:8e8765ca4567a0436fba0778938f935f87287747
2016-11-29 10:26:27 -08:00
Arun Kulshreshtha
374b37caf5 allowunstable: update comment
Summary: In my rush to get the allowunstable extension landed before the holidays, I made several embarrassing typos in the doc comment at the top of the extension. This diff fixes the typos and makes the comment more clear.

Test Plan: The only change was in a comment, so this is a no-op. Unit tests still pass for good measure.

Reviewers: durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:4242510:1480399263:a9822b5e762f1a94c322b15c2ddec9c1acb7df78
2016-11-29 10:18:59 -08:00
Jun Wu
f08e17d3ed testedwith: change testedwith to "ships-with-fb-hgext"
Summary:
Using `testedwith = 'internal'` is not a good habit [1]. Having it
auto-updated in batch would also introduce a lot of churn. This diff makes
them "ships-with-fb-hgext". If we do want to fill the ideal "testedwith"
information, we could put it in a centric place, like a "fbtestedwith"
extension rewriting those "ships-with-fb-hgext" on the fly.

Maybe having in-repo tags for tested Mercurial releases is also a good idea.

[1]: www.mercurial-scm.org/repo/hg/rev/2af1014c2534

Test Plan: `arc lint`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4244689:1480440027:3dc18d017b48beba1176fbfd120351889259eb4b
2016-11-29 13:24:07 +00:00
Martijn Pieters
69898cdd44 testing: insert missing space
Summary: Attack of the trivial missing space.

Test Plan: Run run-tests.py -l test-sqldirstate-shelve.t to see it pass

Reviewers: rmcelroy, simonfar, quark, jeroenv

Reviewed By: quark, jeroenv

Subscribers: mjpieters, #mercurial

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

Signature: t1:4244663:1480439601:3ab7e306e618f7e6e2372046f00e85cf1eb3826d
2016-11-29 09:15:29 -08:00
Jun Wu
c030cc61cb tweakdefaults: do not use template for annotate if unnecessary (BC)
Summary:
Template lacks of the "padding" feature. There is a hard-coded 13-char wide
username, 5-char wide line number, which does not look well if the usernames
are too long or too short.

This patch restores the original annotate format which is different from
the current behavior. For example, given "-uc", it shows "user node" instead
of "node:user". It also tries to make the template version as close as the
non-template one, by adjusting the order, changing separators, and making
"-c" optional (could be hidden from the output).

Test Plan: Modified existing tests

Reviewers: #sourcecontrol, ikostia

Reviewed By: ikostia

Subscribers: mjpieters

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

Signature: t1:4243830:1480437984:1c679c9db516bab905d027061326a7a1524922c6
2016-11-29 11:18:00 +00:00
Martijn Pieters
14dc38a7ba testing: adjust for new home for cmdutil.service
Summary: See rd9d8d78e in the hg repository; cmdutil.service moved to server.runservice

Test Plan: Run test-fbconduit.t and observe it passing once more.

Reviewers: simonfar, rmcelroy, quark

Reviewed By: quark

Subscribers: mjpieters, #mercurial

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

Signature: t1:4244268:1480432981:8e06beadba912294e6d1a01d93b13848cb16a096
2016-11-29 07:51:16 -08:00
Martijn Pieters
b302fcecbc testing: fix spacing for merge conflict markers
Summary: Yay for arbitrary single space changes.

Test Plan: Run the two affected tests to show they now pass again.

Reviewers: simonfar, rmcelroy, quark, stash

Reviewed By: stash

Subscribers: mjpieters, #mercurial

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

Signature: t1:4244213:1480431919:ba4837619652023005faeb00a93a351c7ca0411a
2016-11-29 07:23:32 -08:00
Jun Wu
38e3389cbb build: fix build errors caused by chgserver moved to core
Test Plan: `arc diff`

Reviewers: #sourcecontrol, mjpieters

Reviewed By: mjpieters

Subscribers: mjpieters

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

Signature: t1:4244233:1480432440:104d3b082b9affddf1d44bb3cfc5f997eb7e9afa
2016-11-29 15:14:51 +00:00
Jun Wu
240a2db67b fastannotate: fix D4237855
I committed the wrong version of D4237855 which misses the "finally" block.
This diff fixed it.
2016-11-29 13:57:44 +00:00
Martijn Pieters
d574fb13ed import mercurial.debugcommands if present
Summary:
The debugindex and debugindexdot commands have moved and are not registered
unless you import the new mercurial.debugcommands module.

Test Plan:
Run

   hg --config=extensions.remotefilelog=fb-hgext/remotefilelog help

and observe that you get help info, rather that the error

   hg: unknown command 'debugindex'

then run the fb-hgext test suite.

Reviewers: rmcelroy, quark, simonfar

Reviewed By: simonfar

Subscribers: mjpieters, #mercurial

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

Signature: t1:4244047:1480427216:dcaa1ca441ea189bdf68f1f619b4078d8c1d09dc
2016-11-29 13:48:59 +00:00
Jun Wu
c7946d4233 fastannotate: auto rebuild broken cache server-side via wireprotocol
Summary:
D4233433 changed commands to rebuild the broken cache but missed
wireprotocol. Let's do it for wireprotocol as well.

Test Plan: Added a new test

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:4237855:1480421375:d5715d61a3c66ec8be5a6a80041ee6204e5e4378
2016-11-29 12:14:30 +00:00
Augie Fackler
22653c7629 cdatapack: include sys/types.h for off_t
This isn't required on all systems, but I ran into one where it
was. Sigh. I've struggled a bit to find proper documentation of this,
and this is the best I could do:
http://pubs.opengroup.org/onlinepubs/009696799/basedefs/sys/types.h.html
2016-11-28 17:24:45 -05:00
Arun Kulshreshtha
73155a224e allowunstable: add allowunstable extension
Summary: Currently, the reason we can't perform operations such as histedit, split, and fold in the middle of a stack is that we do not have the experimental.evolution=allowunstable option enabled. It turns out all of these commands will do the "right thing" if this option is enabled. However, since we are uncertain of the ramifications of enabling this option globally, this new extension turns the option on for the duration of split, fold, and histedit, allowing those commands to be used in the middle of a stack without config changes.

Test Plan: See unit tests. Basically, create a stack and then attempt to use split, fold, or histedit somewhere in the middle.

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 14598405

Signature: t1:4209315:1479744780:811e8bef02149a055376c0f105ac2d389dd60970
2016-11-28 10:43:34 -08:00
Arun Kulshreshtha
8408c71376 smartlog: add template keywords for split, fold, and histedit
Summary: Add template keywords for split, folded, and histedited successors. This will enable us to show "(Histedited as XXX)" annotations in smartlog.

Test Plan: By itself this should be a no-op. All unit tests still pass. The effects of this aren't visible unless a user uses a version of our facebook.rc config file that contains updated smartlog templates. See D4209113.

Reviewers: durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

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

Signature: t1:4209314:1479744837:8eeeeb7a031abfabeb302abde9e4b1f3d789a479
2016-11-28 10:43:32 -08:00
Jun Wu
db7dd53ae9 fastannotate: skip downloading cache if client's master is behind
Summary:
It's common that the client's "master" ("main branch") falls behind the
server's, in which case the "is-up-to-date" check will fail and trigger a
re-download while it's unnecessary. Add some checks to avoid downloading
the cache for the client in this case.

Test Plan: Added a test

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4233534:1480330716:db995d0fa5c6a2371894fc2a7871277da23608a9
2016-11-25 22:06:18 +00:00
Jun Wu
b4efcc56cf fastannotate: deal with corrupted files gracefully
Summary:
Previously, fastannotate's annotatecontext would delete individual cache
files (linelog and revmap) if it meets Exception. While the "fastannotate"
command has some retry logic, "debugbuildannotatecache" doesn't, which means
users have to run "debugbuildannotatecache" O(number-of-corrupted-files)
times to unblock. And "fastannotate" does not handle AssertionError which
could be seen as "linelog is corrupted" nicely - it crashes without retry.

Addressing all the above issues by replacing the "assert" to
"CorruptedFileError", catching them and retry properly.

Test Plan: Added a new test.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:4233433:1480330548:618e80762af2209784ad72ad0658f649b050a080
2016-11-25 19:49:13 +00:00
Jun Wu
d203784d68 pyflakes: fix all pyflakes issues
Summary: As the title.

Test Plan: `arc unit`

Reviewers: #sourcecontrol, stash, rmcelroy

Reviewed By: stash, rmcelroy

Subscribers: rmcelroy, stash, mjpieters

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

Signature: t1:4232321:1480067588:54e91ece8fa6b5ff13b3ebc9279217c76bf96a24
2016-11-25 00:23:21 +00:00
Jun Wu
311a3fc653 test-fastannotate-hg: fix compatibility with upstream
Summary:
The recent bdiff behavior change affects us. Document why and update the test
so it works with both the old and new (less optimal imo) bdiff behavior.

Test Plan: Updated the test

Reviewers: #sourcecontrol, simonfar, rmcelroy

Reviewed By: simonfar, rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:4231966:1480011763:d116799ded3514d644e4b80296ffc71a8d712a43
2016-11-24 18:07:32 +00:00
Stanislau Hlebik
6257caad35 infinitepush: address comments from D4175280
Summary:
I forgot to fix inline comments in D4175280.
Fix'em now

Test Plan: Run `test-infinitepush-*`

Reviewers: durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters, #sourcecontrol

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

Tasks: 12479677

Signature: t1:4213794:1479750999:a90f265413881450220f3cf4769f73baf6b393de
2016-11-22 04:10:08 -08:00
Stanislau Hlebik
024d254256 infinitepush: increase test timeout and add logging
Summary:
Tests failed on mac. My guess is that timeout is too low.
Let's increase it to 10 seconds (it's fine because we want wait for 10 sec
if debugbackup finishes faster).

Also let's add logging

Test Plan: Run `test-infinitepush-*`

Reviewers: #sourcecontrol

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

Tasks: 12479677
2016-11-21 08:25:10 -08:00