Commit Graph

2082 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
4731550d0f infinitepush: output bookmark hash in tests
Summary:
Simple test improvement: output scratch bookmark name
together with scratch bookmark hash

Test Plan: Run test-infinitepush-bundlestore.t

Reviewers: durham, rmcelroy, mitrandir

Reviewed By: mitrandir

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3994805:1476112139:a02c78dd8a117f99251e71827224bb368532052b
2016-10-10 08:37:04 -07:00
Jun Wu
de2e6fd858 fastannotate: add diffopts
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
2016-10-08 15:58:21 +01:00
Durham Goode
2cd9003096 setup: add component options to setup.py
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
2016-10-08 09:08:29 -07:00
Jun Wu
4d1e57d182 fastannotate: fix getalllines
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.
2016-10-08 01:39:17 +01:00
Mateusz Kwapich
4f6ebb24a5 sqldirstate: add a config option for "downgrade on pull"
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
2016-10-06 12:36:01 +01:00
Zachary Amsden
30c28a2667 Fix bogus update
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
2016-10-05 21:34:50 -07:00
Zachary Amsden
57128e9ab7 Fix Darwin ctreemanifest build
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
2016-10-05 16:39:49 -07:00
Wez Furlong
cf7b371cf2 hg-new-workdir: suppress watchman warning during initial update
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
2016-10-05 03:25:53 -07:00
Arun Kulshreshtha
19db7fa2a6 Remove unused imports.
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
2016-10-04 10:29:55 -07:00
Jun Wu
417bff83a4 fastmanifest: add the missing readfast method
Summary:
Upstream 4718718ed358 requires a `readfast` method for manifestctx.
`hybridmanifestctx` does not have such method so let's add it.

Test Plan: Added a test.

Reviewers: durham, ttung, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3955478:1475582074:f80c9eb97bcd42846625727ef1da4bce3256c88c
2016-10-01 01:34:50 +01:00
Kostia Balytskyi
8bf34fd038 tests_: fix tests in accordance with the core changes
Differential Revision: https://phabricator.intern.facebook.com/D3967244
2016-10-04 05:25:28 -07:00
Stanislau Hlebik
d63ba71acf infinitepush: remove defaults
Summary: I think it's better throw if misconfigured then silently proceed

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

Reviewers: durham, mitrandir, quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3967202:1475581664:9d7b3e21fce48a49eda35bde473915cb64dfdfa0
2016-10-04 04:52:31 -07:00
Stanislau Hlebik
e42fe1fdc5 infinitepush: do not require mysql.connector to be present on client
Summary:
Previously error was thrown if mysql.connector wasn't present on client hosts.
But there is no need for mysql.connector to be installed on clients.
Remove global imports to fix it and create bundlestore() only for server repo.

P. S.
Changes in test is required because bundlestore() is not created if
infinitepush.server=True is not present in config.

Test Plan:
Uninstall mysql.connector: `sudo yum remove mysql-connector-python`
Enable infinitepush extension in any repo and run any hg command (hg st,
for example). Make sure it doesn't throw exceptions.

Install mysql.connector: `sudo yum install mysql-connector-python`.
Run `test-infinitepush-bundlestore.t`

Reviewers: durham, mitrandir, quark, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3967189:1475581802:fbaafceac298242d0a449267ec0d68e290c3f262
2016-10-04 04:52:03 -07:00
Jun Wu
8cf88a152b test-sparse: fix the test
Summary: Seems the output has changed somehow and needs an update.

Test Plan: Run the test

Reviewers: #sourcecontrol, rmcelroy, mjpieters

Reviewed By: rmcelroy

Subscribers: mitrandir, rmcelroy, mjpieters

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

Signature: t1:3955443:1475332010:d2a0e33b509d198312d71458aaf0dfd7f5ce73d7
2016-09-29 18:36:16 -07:00
Stanislau Hlebik
59dd886097 infinitepush: include infinitepush in setup.py
Test Plan: make clean && make local

Reviewers: durham, rmcelroy, mitrandir, quark

Reviewed By: quark

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3961015:1475506563:2253799d83426385ea1f1a9cae86dc3cf7083d83
2016-10-03 08:00:42 -07:00
Ryan McElroy
78f0c73d4b extension to print commit message that would be supplied to editor
Summary:
the nuclide team would like to be able to get the commit template
message without actually invoking a commit. This small extensions allows them
to do this.

Caveats: ignores subrepositories.

Test Plan: new test

Reviewers: #mercurial, most

Subscribers: mjpieters

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

Tasks: 12771006
2016-10-03 04:39:51 -07:00
Kostia Balytskyi
db64f55505 tests_: fixing tests in accoring to cmd option negation added by upstream
Differential Revision: https://phabricator.intern.facebook.com/D3950940
2016-10-03 02:01:18 -07:00
Stanislau Hlebik
ddd4873227 infinitepush: temp remotenames fix
Summary:
Hack to fix interaction with remotenames. Remotenames push '--to' bookmark to the server but we don't want to push scratch bookmark to the server. Let's delete '--to' and '--create' and also set allow_anon to True (because if --to is not set remotenames will think that we are pushing anonymoush head).


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

Reviewers: durham, mitrandir, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3937202:1475170335:fa4d39e1e17bea67b62b99dfc4cd2ffa4e5d6bea
2016-10-02 05:13:06 -07:00
Stanislau Hlebik
387f18b269 infinitepush: fix push of scratch bookmark on existing commit
Summary:
It's possible to push new scratch bookmark which points to existing scratch
commit. Previously it has failed with a stack trace.

Unfortunately it still doesn't allow to push scratch bookmark that points
to non-scratch commit. It requires more complex changes so
it will be fixed later if necessary.

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

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3936728:1475078059:ac4588e086b0344070a90f806b6f518c6e187c3b
2016-10-02 03:05:50 -07:00
Stanislau Hlebik
7f75c82f54 infinitepush: fix mysql indexapi
Summary:
Bookmark can be moved to another node and node can be moved to another bundle.
In this case INSERT will fail because of the PRIMARY KEY violation.
Let's add ON DUPLICATE KEY UPDATE which will update existing row instead of
creating a new one.

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

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3936281:1475078339:d2ff0a01e1d753570c60172c5ef34ceeb7af1b96
2016-10-02 02:55:36 -07:00
Stanislau Hlebik
ba3ebe099e infinitepush: fix interaction with pushrebase
Summary:
infinitepush bundle2 part should be run before pushrebase bundle2 part. This is a bit tricky since both pushrebase and infinitepush change the `extensions._order` and both of them try to load before bundle2 `changeset` part.

I suggest to load before 'changeset' or pushrebase part whichever is earlier. Then we have two situations:
1) pushrebase comes first. It sets it's part before 'changeset' part, then infinitepush sets it's part before pushrebase part.
2) infinitepush comes first. It sets part before 'changeset' and pushrebase part, then pushrebase sets it's part before 'changeset' part. Since infinitepush part comes before 'changeset' part it still be before pushrebase part.

This solution is not robust but it should be fine for now. The proper solution requires changes upstream that will introduce dependencies between bundle2 parts.

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

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3930697:1475079064:1b5851df4d2067ec21ec01e7510ddf83ff1684ad
2016-10-02 02:54:03 -07:00
Jun Wu
ca6d644eab ctreemanifest: fix compilation error
Summary:
This fixes the following error when being compiled by clang:

  In file included from ctreemanifest/treemanifest.cpp:10:
  ctreemanifest/treemanifest.h:247:15: error: private field 'mainRoot' is not used [-Werror,-Wunused-private-field]
      Manifest *mainRoot;
                ^

Test Plan: `make local` on OS X.

Reviewers: durham, ttung, #sourcecontrol

Subscribers: simpkins, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3949603
2016-09-30 04:51:44 +01:00
Zach Amsden
2f33513a19 Log interactive time, internal command timing to scuba
Summary:
Use wrappers around ui functions to exclude interactive
and log the results to scuba.

Test Plan:
   USE_DIST_HG= FB_HG_DIAGS= CHGDISABLE= hg --config 'extensions.profiling=~/facebook-hg-rpms/fb-hgext/hgext3rd/profiling.py'  --pager=off --config profiling.enabled=False amend --edit
  chg: disabled by CHGDISABLE
  internal stats file: /tmp/scm-internal-statsx9EXSw
  hg profiling mode: SKIPPED
  stats: {
      "int": {
          "builddate": 1471281577,
          "cachehitratio": 75,
          "consumed": 425,
          "diffcachehitratio": -1,
          "elapsed": 1921,
          "errorcode": 0,
          "filesnotincachehitratio": -1,
          "interactive_time": 1534,
          "internal_time": 1701,
          "time": 1473459054
      },



Tested both with and without chg to make sure both modes work, otherwise
there are some subtle bugs that can come up under hg (timer becomes persistent
if invoked too early in uisetup).

Check out scuba table, new columns are showing up.  I still need to clean up the table as I accidentally added data as string first.

Reviewers: #sourcecontrol, ttung, quark, durham

Reviewed By: durham

Subscribers: giorgioc, mjpieters, akushner

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

Tasks: 12879683

Signature: t1:3844697:1475250469:a46aff22781e0e07596e2880d6477a62754f1397
2016-09-30 12:32:21 -07:00
Arun Kulshreshtha
bc3b0cd1c7 Make hg next --rebase intelligently obsolete/inhibit changesets
Summary:
This change updates the behavior hg next --rebase. Specifically:

  - Only one changeset can be rebased at a time. If there are multiple candidate changesets, the command aborts.
  - Each time a changeset is rebased, its precursor is marked as obsolete, inhibition markers are stripped from it and its ancestors, and its preamend bookmark is deleted, if one exists.
  - The result of this is that if no non-obsolete changesets depend on the existence of the pre-rebased changeset, that changeset and its ancestors will be stripped, resulting in a cleaner user experience.
  - This change also adds back the --evolve flag, but makes it show in error instead of working. It turns out that removing the flag outright breaks the evolve extension.

Test Plan:
See updated unit tests for the exact commands to run to test this, as well as an overview of all of the new situations where behavior was changed.

A basic test plan would be:
1. Initialize a new repository, and create a stack of 4 commits.
2. Amend the second commit in the stack.
3. Do `hg next --rebase`. It should work as before.
4. Do `hg next --rebase` again. This time, the entire old stack should "disappear" from hg sl.

Additionally, attempting to run `hg next --rebase` when there are multiple possible child changesets should fail.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: quark, mjpieters

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

Tasks: 13570554

Signature: t1:3941922:1475205056:58a8d1726cfcccbf14a38727be0220a09532ec97
2016-09-30 10:40:58 -07:00
Jun Wu
1093ee0826 fastmanifest: implement readdelta for hybridmanifestctx
Summary:
This fixes a crash that `hybridmanifestctx` does not have `readdelta`
after upstream's b404425704fa. `readdelta` should be fast for vanilla
manifest so just forward the call there.

Test Plan: Modify a file that `.` touched, run `hg amend` and it won't crash.

Reviewers: ttung, #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:3948989:1475198696:d8ae194500fc093c03cc115f4613a9b8c8bfbff2
2016-09-30 02:09:43 +01:00
Jun Wu
043fa9a267 setup: build fastannotate 2016-09-30 00:11:02 +01:00
Jun Wu
9e2525ff74 remotefilelog: cache linkrev
Summary:
Calculating linkrev can be expensive for remotefilelog, while
non-remotefilelog code would usually expect `fctx.linkrev()` to be very cheap.
So let's cache it.

Test Plan: `arc diff`

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: mjpieters

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

Signature: t1:3936757:1475078470:7630d3246a5ca9407456384ae0a9aff1035d5201
2016-09-28 14:28:20 +01:00
Jun Wu
a3335c81b5 fastannotate: add a test for perfhack
Summary:
The test is just a copy of the existing one but with perfhack enabled. It's
expected to generate the same test result.

Test Plan: Run the newly added tests

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3937109:1475166970:4c39d9b15878458cd8b4a26323749224a4c3c746
2016-09-28 13:15:41 +01:00
Jun Wu
38100f3be4 fastannotate: handle empty file correctly
Summary:
`_decorate` backported from upstream does not handle empty file correctly.
It would raise an assertion error when annotating an empty file:

  File "fastannotate/commands.py", line 138, in fastannotate
    not showdeleted))
  File "fastannotate/context.py", line 331, in annotate
    return self._refineannotateresult(result, revfctx, showpath, showlines)
  File "fastannotate/context.py", line 503, in _refineannotateresult
    if len(lines) != len(result):
  AssertionError

This patch fixes it.

Test Plan: Run the modified test.

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3944132:1475166894:e2610c6364806b77c8533315a1a0a08b6c158fe5
2016-09-29 16:48:40 +01:00
Jun Wu
56075d02ef fastannotate: encode directory names
Summary:
We need to reserve ".l", ".m" and ".lock". So encode directory names to
avoid collision.

Test Plan: Run the modified test

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3944069:1475166648:055811239514cb699a0ebe1cfab809b661c6cfd2
2016-09-29 16:33:46 +01:00
Jun Wu
fa32e904bb fastannotate: try to avoid using matcher if perfhack is enabled
Summary:
The mercurial matcher will read the manifest - unacceptably slow for our
usecase. Instead, if perfhack is enabled and matched linelog files exist,
treat patterns as valid file names directly.

Test Plan: perfhack tests will be added in the next patch

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3937103:1475167055:dc27b65fe10f7a3a561afdb31292531f38e90dfb
2016-09-28 13:12:46 +01:00
Jun Wu
76bc8110f2 fastannotate: add a perfhack to use linkrev as introrev
Summary:
`introrev` can be slow because `_adjustlinkrev` can be very expensive.
Usually `introrev` is just `linkrev`. So let's use the latter as an
approximate, if `perfhack` is enabled.

Note that we only use `linkrev` when *checking* if the hg hash is in linelog
revmap or not - for the read-only operation. If we need to update linelog,
we fallback to the slow `introrev` implementation.

Test Plan: perfhack related tests will be added later

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3937044:1475139823:450c6bb68b33db671f6b95cde4abfd24b7f2af4c
2016-09-28 15:56:47 +01:00
Jun Wu
bd3b5783c6 fastannotate: use a more efficient way to get filectx
Summary:
Usually we simply use `repo[node][path]` to get a `filectx` object.
But that can be painfully slow - it's reading the whole manifest by default.

The flat manifest and tree manifest both provide a method called `find` to
get a `filenode` without reading the entire manifest - which is our use-case
here since we don't need to resolve all files but just need to peek several
individual files.

As we are touching this area, also deal with revset string resolution so
we can simplify the logic in more places - now master can be a revset string
and is no lonnger needed to be lazily resolved. Besides, the `_getbase` logic
is also moved here and to be more efficient - the old `_getbase` still need
to read manifest.

This patch replaces all code using the `repo[node][path]` pattern to use the
more efficient implementation one.

Test Plan: Run existing tests

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3936992:1475138449:2ec6c71a592a256fa9487a5f7b41241bf7440f89
2016-09-28 15:56:31 +01:00
Jun Wu
89c9da2b06 fastannotate: add a --deleted option
Summary:
This feature uses the linelog to show all lines ever existed (even deleted) in
a file. Helpful to see the history all the way back to the beginning.

Sadly it has to be inefficient currently as we have chosen to not store line
content (but only numbers) in linelog. Calculating the revisions and line
numbers is very fast because of linelog but resolving the line contents is
painfully slow. We may want a key-value database in the future, answering the
query:

  (path, node, linenum) -> content

How slow is it? With the linelog pre-built, generating the output for
`mercurial/commands.py` needs resolving 400+ revisions and is about 10+
seconds.

Test Plan: Run the changed `test-fastannotate.t`

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

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

Signature: t1:3849503:1475086235:83077c571746a7515b5ba75c4df37a1a400d9232
2016-09-11 22:52:29 +01:00
Jun Wu
58826b52c2 fastannotate: add a config option to replace the default command
Summary:
This diff adds a config option to replace the default annotate command using
fastannotate.

Test Plan: Run the modified test

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3837499:1475076620:65dc656c74e9c8a969f68cc4a2480f5dcbeb6361
2016-09-08 21:52:01 +01:00
Jun Wu
cfb2b51726 fastannotate: add a simple test
Summary: This diff adds a simple test for the `fastannotate` command.

Test Plan: Run the newly added test.

Reviewers: #sourcecontrol, stash

Reviewed By: stash

Subscribers: mjpieters

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

Signature: t1:3836677:1475076179:fa8b8ff3711a8dad9410a15f77e23adaeb676d5e
2016-09-08 20:16:19 +01:00
Jun Wu
efb6a83a3e smartlog: remove unused edge when indentnonpublic is set
Summary:
This patch removes the unused line and space so it looks a bit better:

```
 .
 .
 .
 | o          o
 | |          |
 | |          |
 | o          o
 |/          /
 |          |
 o          o
 .          .
 .          .
(before)   (after)
```

Due to the current implementation of graphlog, it's a bit hacky to achieve the
above effect.

Test Plan: Run `test-smartlog*.t`

Reviewers: #mercurial, ttung, mjpieters, durham

Reviewed By: durham

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

Signature: t1:3881516:1475170264:477c66b2372d04c4e5d7c8fbb69de30599706e5d
2016-09-17 02:22:36 +01:00
Ryan McElroy
7e63ec0dce rage: use hg sl instead of smartlog to get better template
Summary:
The default template is more compact and more useful with thigns like remote
bookmarks included.

Also drop '--all' and add '--hidden' since recent commits are much more
interesting than old commits and recent hidden commits will be useful when
people have recently lost something.

Test Plan: run `hg rage`, look at paste produced

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: mjpieters

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

Signature: t1:3904646:1475171650:fc1bab0062be39c590b61492bce42236f3bb6123
2016-09-29 11:19:52 -07:00
Jun Wu
4cc05e5d24 absorb: improve rename handling
Summary:
Previously `absorb` does not care too much about copies or renames and
assumesa file path only exists in every changeset of `stack[k:len(stack)]`,
but does not exist in any of `stack[0:k]`. If this assumption is not true,
absorb will likely crash.

This patch implements copy or rename handling correctly. After this patch,
renames happens to a single file is tracked correctly. Copies are ignored
by default. For the "double move" case, like:

  hg cp a a1
  hg cp a a2
  hg rm a

We only follow the first path (sorted alphabetically). In this case, changes
to "a1" could affect the content of "a" in a previous changeset, while changes
to "a2" couldn't.

Test Plan: Added a new test

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

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

Signature: t1:3941438:1475166850:97461174619d469750146e25f6bff16dae19bd3d
2016-09-28 23:56:43 +01:00
Adam Simpkins
6e12b757a9 [setup.py] support parsing INCLUDE_DIRS and LIBRARY_DIRS environment variables
Summary:
Update the code to read additional include and library directories from the
INCLUDE_DIRS and LIBRARY_DIRS environment variables, if they are set.

This allows us to build the extensions using custom include/library paths.
While these could have been set through the CFLAGS and LDFLAGS variables,
distutils already includes many default settings in CFLAGS and LDFLAGS by
default (taken from the settings used to build python), and setting CFLAGS and
LDFLAGS ourself would override these defaults.  We do still want all of the
flags in CFLAGS and LDFLAGS by default, so it is easier to add support for
separate INCLUDE_DIRS and LIBRARY_DIRS variables.

Test Plan: Tested building fb-mercurial-omnibus on CentOS.

Reviewers: ikostia, simonfar, ttung, durham, mbolin, wez, quark

Reviewed By: quark

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

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

Signature: t1:3916198:1475091590:97904ef87a8a2b78e178c87d9d49bdadcce94e44
2016-09-28 16:08:21 -07:00
Stanislau Hlebik
24be1a2da5 infinitepush: add bundle-store option to push
Summary:
--bundle-store option makes push go to bundle store
even if bookmark is not specified or bookmark doesn't match scratch branch pattern.
The main reason for the `--bundle-store` is to be able to push not a scratch bookmark, but a scratch commit, for example, `hg push -r . --bundle-store`.
It will be useful when we will save all the local commits in the bundlestore.

To do this:
1) Wrap `discovery.checkheads()` to allow push to scratch branch even if new head is created.
2) Make scratchbranchpat params advisory because now bookmark may not be specified.

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

Reviewers: mitrandir, rmcelroy, durham

Reviewed By: durham

Subscribers: mjpieters

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

Tasks: 12479677

Signature: t1:3862665:1475077612:7e02a5bdc1da28161e45029b1e3a38fe8223a305
2016-09-28 13:17:25 -07:00
Adam Simpkins
731fa392e6 unbreak the remotefilelog tests
Summary:
bc720745268b added a ui argument to the mutabledatapack() and
mutablehistorypack() constructors, but did not update the tests to pass in a ui
object, causing the tests to fail.

Test Plan: Ran the tests.

Reviewers: #fastmanifest, durham

Reviewed By: durham

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

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

Signature: t1:3934065:1475077643:4c0c32f5efdb25d482128cc58f4ba903611cc959
2016-09-28 11:53:29 -07:00
Adam Simpkins
8d1252d8d3 [unit] minor refactoring of interestingtests()
Summary:
This is just a minor performance clean-up of interestingtests(), even though
performance probably isn't a big deal here (unless we eventually get a very
large number of tests).

The old code was calling words(path) once per test file (for each path), rather
than just once.  I cleaned up the code so that we only call it once per path.

I also updated the code to build testwords as a dictionary so we can do an easy
lookup to find relevant tests for a given word, rather than having to do a
linear scan of all tests.  We now also don't bother computing the words for
test-check* tests.

Test Plan:
Manually confirmed that interestingtests() returns the expected test lists for
a variety of input paths.

Reviewers: simonfar, quark

Reviewed By: quark

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

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

Signature: t1:3935730:1475052012:08b9a495c7c3e7fc2d0b9eaa097d5286874edf46
2016-09-28 12:08:10 -07:00
Adam Simpkins
68222e17e9 [unit] fix computation of changed files
Summary:
Make sure a nul byte is printed between the list of files changed in the
working directory and the files changed in the parent commit.

Previously these two lists were printed back-to-back, causing the last path
from the working directory to be joined with the first path from the parent
commit.

Also return the results as a set so we exclude duplicates if a file was changed
both in the working directory and in the current commit.

Test Plan:
Manually printed the changedfiles computed, and confirmed that the lists were
correct.

Reviewers: simonfar, durham, quark

Reviewed By: quark

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

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

Signature: t1:3935654:1475053555:66da9102e312d8d345d00c4d41f76d41ce673069
2016-09-28 11:59:55 -07:00
Adam Simpkins
4f37b53188 Various improvements to scripts/unit.py
Summary:
- Set PYTHONPATH so we actually test the extensions from the local repository
  rather than the versions installed in the system's normal python library
  directories.
- Invoke the test runner directly with subprocess, rather than via a subshell,
  and always wait for it to exit, even if we receive an interrupt during the
  test run.
- Various other minor refactoring of argument parsing and handling of the json
  results file.

Test Plan:
Ran scripts/unit.py and confirmed it tested the local version of remotefilelog,
rather than the system version.

Reviewers: durham, simonfar, quark

Reviewed By: quark

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

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

Tasks: 13595089

Signature: t1:3935628:1475052856:61480fddbf97c830496257b89be3999364ab7c31
2016-09-28 12:10:17 -07:00
Adam Simpkins
af9bf07716 Use -std=c++0x when building ctreemanifest
Summary:
Explicitly specify the C++ dialect as c++1y when invoking gcc to compile
ctreemanifest's C++ code.

This is needed to build with Facebook's C++ code that uses folly's fbstring for
the std::string implementation.

(Ideally I would actually prefer to use -std=c++1y, but for the moment we still
build with gcc-4.4 on some platforms, and this old compiler does not support
either c++1x or c++1y.)

Test Plan: Tested building ctreemanifest with gcc-4.9.

Reviewers: ikostia, simonfar, quark

Reviewed By: quark

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

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

Signature: t1:3916577:1474667597:3a915a7bc6d7f070d647ccd0d6b40b3eb051b59d
2016-09-26 15:51:25 -07:00