Commit Graph

61 Commits

Author SHA1 Message Date
Mohammad Ayoub
075801c976 sync checkout locations on update
Summary:
Whenever a checkout is done, the new commit is sent to commitcloud.
This currently works with the hook on update, but the hooks on commit are not working

Reviewed By: mitrandir77

Differential Revision: D16687423

fbshipit-source-id: a0b861d301c84764f31787454cdec594b0519fa3
2019-08-15 08:37:14 -07:00
Saurabh Singh
459d04df3f hgsubversion: allow disabling the svnrev template keyword
Reviewed By: quark-zju

Differential Revision: D16546466

fbshipit-source-id: d3d3005b250856d2e93fbd52f178e9cd8bdf6ef2
2019-07-29 13:29:39 -07:00
Shu-Ting Tseng
10125c8e19 make the svn call lazy
Summary:
Previously I tried to not call to SVN if we have the 2 configs set. However I made a
mistake that the args will always be evulated anyway (computer science 101).

Let make it really lazy and add a test for that.

Reviewed By: ikostia

Differential Revision: D16163470

fbshipit-source-id: 6ec0f855b10164ae9a210bc70789b2f59fd19858
2019-07-10 05:27:59 -07:00
Xavier Deguillard
9d18031708 remotefilelog: hardcode using Rust {data,hist}pack implementation
Summary:
We've had these 2 options turned on for a while now. Let's stop pretending
we'll switch them off, and just hardcode them over the codebase.

Some places are still using either the C code, or the Python one explicitely,
future changes will switch them to the Rust code.

Reviewed By: kulshrax

Differential Revision: D15981631

fbshipit-source-id: c23e474a84e887a2b92c9a304d63ef8d680cdf2d
2019-06-26 11:10:54 -07:00
Jun Wu
4d6591aee7 help: move help docs to Python code
Summary:
It's a headache about how to deal with static files (help/, template/, default
config), since we have 3 different ways of packing the Python code: normal
(linux), embedded (Windows), and fbcode xar (linux). The latter two need
workarounds to make `help/` work, and for the "embedded" case, It is currently
broken.

This diff moves user-facing `help/` files to a Python module to remove the need
of special casing it in different ways.

`helptext.py` was created via:

  import glob, os
  for path in glob.glob('help/*.txt'):
      if path.count('.') == 1:
          name = path.split('.')[0]
          name = os.path.basename(name)
          if '-' in name:
              name = 'globals()[%r]' % name
          print("%s = r'''%s'''\n\n" % (name, open(path, "rb").read()))
          os.unlink(path)

The help text about named branches are removed to make `test-check-help.t`
happy.

Reviewed By: mitrandir77

Differential Revision: D15291676

fbshipit-source-id: 2320bd59369ef092d8c06b8539e401799a0467ef
2019-05-13 16:23:40 -07:00
Saurabh Singh
29e1278187 hgsubversion: allow inferring the svn layout from the commit
Reviewed By: mitrandir77

Differential Revision: D15206676

fbshipit-source-id: fc7604bfa2df9cd1d47e4a5d582f0efe80339531
2019-05-13 11:57:37 -07:00
Mark Thomas
23f7bbf387 infinitepush: refactor client-specific functions into client module
Reviewed By: DurhamG

Differential Revision: D15170163

fbshipit-source-id: 21ae784c5867bcf198aaa8c079c21b00ae5334fb
2019-05-02 07:06:45 -07:00
Aida Getoeva
331b10b445 remotenames: track pulled bookmarks
Summary:
Tracking remote bookmarks that was pulled with
```
hg pull -B <remote name>
```
All these remotenames, if they exist, will be stored in `.hg/selectivepullusedbookmarks` file.

It will allow us to estimate how much memory do we need to keep remote names in sync state in Commit Cloud and automatically mark collected remote bookmarks as "interesting" when the selective pull will be enabled.

Reviewed By: markbt

Differential Revision: D14912903

fbshipit-source-id: 3001869175553327c0840e2cfb829724dfd82893
2019-04-30 09:26:11 -07:00
Xavier Deguillard
ef4844624e remotefilelog: remove fetchwarning
Summary:
The warning isn't that useful, and can actually cause more harm than good, as running `hg prefetch -r .`
can download gigabytes of unnecessary data to the hgcache.

Reviewed By: quark-zju

Differential Revision: D14999458

fbshipit-source-id: b0ff2c2ad0e441622066fac10a5efafe8de588db
2019-04-18 14:09:09 -07:00
Jun Wu
177b4ef156 fastlog: patch follow revset instead
Summary:
Change the fastlog approach to patch the "follow" revset function instead of
"getlogrevs". This makes it more general purposed so it can speed up commands
like `hg log -r 'reverse(follow("dir"))'`.

Note: This will regress `log dir` performance, which will be fixed in the next
diff.

Reviewed By: sfilipco

Differential Revision: D14764074

fbshipit-source-id: c2a4c8e91359d971e6ea668e5ff1f0ab6eb0534c
2019-04-16 22:19:19 -07:00
Jun Wu
66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00
Jun Wu
82b4be9a7f config: hard-code ui.allowbranches=False
Summary: Since it's always False, remove the config option.

Reviewed By: ikostia

Differential Revision: D14076304

fbshipit-source-id: 2cc6409355a0c4514a62bc764e1deec0af1bd3a1
2019-02-14 17:44:40 -08:00
Jun Wu
04f6795519 remotenames: remove logic about named branches
Summary: Named branches are going away. Remove the logic around it.

Reviewed By: phillco

Differential Revision: D13978575

fbshipit-source-id: d6e28d7cadffa612f74a2afc12800829d6113dfa
2019-02-12 19:54:30 -08:00
Aida Getoeva
996ac6da37 prefetch: add requestpacks
Summary: Implemented logic for fetching data from the scmmemcache and the server in pack files format. By default `prefetch` will still use loose files, unless the `remotefilelog.fetchpacks` config flag will be set to true.

Differential Revision: D13905733

fbshipit-source-id: cc559f5bc600067199a91efe6cf44b1bde6bf69b
2019-02-06 10:43:15 -08:00
Jun Wu
eaebf8d02d commands: drop unnecessary "config(..., default=...)"
Summary:
The default value is specified in configitems.py. Remove the `default`
argument.

Reviewed By: phillco

Differential Revision: D13909730

fbshipit-source-id: ca45c63be7d48e04e71a6f5b3b682f625a3030f6
2019-02-05 20:36:03 -08:00
Mark Thomas
b44e2103d7 simplecache: don't use memcache in tests
Summary:
The simplecache test attempts to connect to a memcache instance on localhost.
This means the test fails if a memcache instance is not available.

Remove the use of memcache in the test.  We still test local files, and assume
that memcache itself works.

Also corrupt the correct key when testing corruption handling, and document the
config options.

Reviewed By: quark-zju

Differential Revision: D13818471

fbshipit-source-id: 6ca7f575aa813f95773144be5337796f029ffd90
2019-02-01 19:19:36 -08:00
Jun Wu
c12e300bb8 codemod: move Python packages to edenscm
Summary:
Move top-level Python packages `mercurial`, `hgext` and `hgdemandimport` to
a new top-level package `edenscm`. This allows the Python packages provided by
the upstream Mercurial to be installed side-by-side.

To maintain compatibility, `edenscm/` gets added to `sys.path` in
`mercurial/__init__.py`.

Reviewed By: phillco, ikostia

Differential Revision: D13853115

fbshipit-source-id: b296b0673dc54c61ef6a591ebc687057ff53b22e
2019-01-28 18:35:41 -08:00
Durham Goode
ab1f7b6eef hggit: support indexedlog git map file
Summary:
Add a config option to use indexedlog as the node map storage instead
of a flat text file.

Reviewed By: quark-zju

Differential Revision: D13062573

fbshipit-source-id: ae14df24a4e36c59fbd9ec82d785aac52a2f8b5f
2018-12-06 16:21:37 -08:00
Wez Furlong
67f16a7484 hg: fixup biggrep implementation
Summary:
a couple of problems:

* The recent move from tweakdefaults also broke `bin` symbol, rendering
  this feature completely broken for non svn backed repos
* The `bgr` tool knows about fewer corpuses than we do, so go directly
  to the underlying C++ client binary
* Add configuration options for that binary

Reviewed By: phillco, farnz

Differential Revision: D12849852

fbshipit-source-id: 154d4822d097602505349d3f67b45f19c17a7bf8
2018-10-30 19:13:56 -07:00
Mark Thomas
5a6793ba4e infinitepush: add debugging for when bg pushbackup takes the lock
Summary:
Normally pushbackup should not take the repo lock.  To debug when this does
occur in the background, add a debugstacktrace for lock aquisition when
infinitepushbackup.bgdebuglocks is set.

Reviewed By: quark-zju

Differential Revision: D10508808

fbshipit-source-id: 3cb2c155bac88751122111d91bdc1f51b381f7ff
2018-10-25 13:27:00 -07:00
Wez Furlong
5e817f6cc7 make biggrep the default for hg grep in eden
Summary:
Adds the `grep.biggrepcorpus` option that links the repo to the appropriate
biggrep corpus to each of the repo specific configs that we maintain.

This allows us to know when a repo can be used with biggrep.

Use this option to automatically enable the use of biggrep when in an eden repo.

Reviewed By: quark-zju

Differential Revision: D10434568

fbshipit-source-id: a2c77d8c58b611f818d08725a6298dec1263bb8a
2018-10-24 20:36:25 -07:00
Phil Cohen
b04befe290 perftweaks: remove cachenoderevs code
Summary:
Per D8985248, this code isn't necessary anymore under clindex. clindex is out everywhere now, so let's nuke it.

Shortens this file by 30%!

Reviewed By: quark-zju

Differential Revision: D10414815

fbshipit-source-id: 795c625afd128d94f09d0f7c1b294a7f7d8eea14
2018-10-18 03:17:37 -07:00
Kostia Balytskyi
86f07601f7 sparse: rename fbsparse into sparse in tests
Reviewed By: phillco

Differential Revision: D10335084

fbshipit-source-id: 91e0a17957561410e397a006f99ebf549d34e1e4
2018-10-16 14:27:29 -07:00
Phil Cohen
7bf2e9105a tweakdefaults: port allowbranches to core
Summary:
Note that this is more aggressive than the tweakdefaults version; it doesn't allow named branches to be created or listed at all with the config set. As we want to delete named branches entirely, this seems reasonable.

I ported the `--new` flag, but made it optional, to make it easier to support both the core and tweakdefaults callers.

Saurabh Singh and I chatted with the releng team (Craig).

**tldr:** we can remove named branches from the UI but should keep the innards for now

Today the releng team doesn't make any branches (#continuous), but in the near-term future, they might either:

- create remote bookmarks in hg (similar to fbsource)
- create branches in SVN (which are then synced as hg branches by hgsubversion)
  - We'll leave all the hgsubversion code to do this alone, just remove user-facing entry points
  - They'll also need to be able to query for a commit's branch (`hg log -T '{branch}'` will still work)
  - Once www is on hg, this possibility goes away and we can kill named branches for good

Reviewed By: ikostia

Differential Revision: D10401485

fbshipit-source-id: 6f2f3ae28af249bae1fdf782eb14fe7bfc472bb7
2018-10-16 09:25:04 -07:00
Jun Wu
3ee1c205cd hgsql: sync repos before acquiring the SQL write lock
Summary:
When entering the critical section (creating a transaction), hgsql might wait
for SQL lock for a long time (minutes). And it currently does nothing during
that wait time. If the lock was acquired after a long time, the work of
catching up with what the database already has might be too much. That is a
waste within the precious hgsql lock held critical section.

Instead of waiting for the lock for N seconds and doing nothing, wait for k
(k < N) seconds and also try to sync with SQL periodically. This makes the
repo closer to what the database has and can reduce work needed to pull from
the database in the critical section.

This adds CPU pressure to the MySQL tier. I added a config option to control
it.  Worse case, we can change `hgsql.syncinterval` to make the sync less
frequent.

As we're here, try document the configs.

Reviewed By: phillco

Differential Revision: D10002578

fbshipit-source-id: bd72d8225c919aa2bc62743de1e1d3f27cba606a
2018-09-25 16:06:20 -07:00
Jun Wu
99245c48eb hgsql: add hgsql.verbose for printing what the server is doing
Summary:
With hgsql.verbose turned on, print useful messages like how many commits the
server is syncing, how long the lock was held or waited, to stderr so they are
visible to the client.  This is useful for the client to understand why the
server "hangs" for a couple of seconds, and is useful in tests.

As we're here, drop no-flake8 comment.

Enable the flag for the hgsql-sync test to verify it.

Reviewed By: phillco

Differential Revision: D10019937

fbshipit-source-id: 8d304ce5208dbc5b92ed20f69daba02e9040c73f
2018-09-24 20:53:08 -07:00
Bennett Magy
e31dcc3efe Updated parsing logic for .arcrc
Summary:
For some arcrc formats, hg commands prefer a deprecated blob in the .arcrc file which does not contain an oauth token, and only contains a phabricator cert (which is deprecated in favor of oauth)

This updates the logic to look for the phabricator.intern.facebook.com blob in the .arcrc to get an oauth token.

Reviewed By: mitrandir77

Differential Revision: D9351851

fbshipit-source-id: 11efe30b077480caa7b147c45a8d0eb78189277e
2018-08-16 13:50:53 -07:00
Phil Cohen
ee68575f82 tests: make test-check-config 9x faster
Summary: This cuts the speed on my laptop from 1.3 min (78s) to 8.9s.

Reviewed By: quark-zju

Differential Revision: D8738675

fbshipit-source-id: f6bd0857c949ad96b0eea54d8ddbd9a0427e8895
2018-07-06 17:27:24 -07:00
Mark Thomas
e28d4a84e0 fix tests after reformat
Summary: The recent reformat caused a few test failures, this should fix them.

Differential Revision: D8207359

fbshipit-source-id: ced37aff3038715e5876fe27b58a60ebe45e4097
2018-05-30 13:47:50 -07:00
Jun Wu
584656dff3 codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).

Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.

Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.

An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.

As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.

Reviewed By: wez, phillco, simpkins, pkaush, singhsrb

Differential Revision: D8173629

fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-25 22:17:29 -07:00
Durham Goode
e3f8f7fc38 clone: add stream_clone_options wireprotocol endpoint
Summary:
We want to allow blocking full repo streaming clones in certain
repositories (since they can take the lock and take a very long time) unless the
client has explicitly asked for it. The existing stream_out wire protocol has no
way of passing an option, so let's create a new endpoint.

Reviewed By: quark-zju

Differential Revision: D7763717

fbshipit-source-id: eace47143f8fdcc4c6e302b5c26678ccf56ca5d4
2018-04-25 13:54:54 -07:00
Durham Goode
241ab4bdad hg: add hggit.disallowinitbare config option
Summary:
The hg servers were having trouble bootstrapping the .hg/git directory
because hggit was creating a bare repo and then later git fetches were super
slow. Those .hg/git directories should be managed by infra outside of hg, so
let's add a config knob to prevent hggit from creating a .hg/git repo.

Reviewed By: quark-zju

Differential Revision: D7586441

fbshipit-source-id: 7c2578123428aadaa6a94484e45dda6bd6b5a42d
2018-04-13 21:51:54 -07:00
Durham Goode
0ae182a740 hg: default to using bundle2 for pushrebase parts
Summary:
Pushrebase previously defaulted to bundlev1. Now that the server can
support v2, let's default to v2.

Reviewed By: quark-zju

Differential Revision: D7591174

fbshipit-source-id: bc5448490ff319543baedf3f5a1aab160a73ed27
2018-04-13 21:51:53 -07:00
Jun Wu
238cda6c14 amend: use hint framework for restack
Summary: This allows people to silence the hint.

Reviewed By: markbt

Differential Revision: D7392127

fbshipit-source-id: ac16f952a178d567ce13e22946127456972ebe85
2018-04-13 21:51:49 -07:00
Aida Getoeva
93252b7fd2 Enable batch mode for SSH during background pushbackup
Summary:
Added passing BatchMode option to SSH call only when puchbackup runs in background.
Also fixed dummyssh in skipping options before hostname, added unittest.

Reviewed By: quark-zju

Differential Revision: D7119123

fbshipit-source-id: 2c8e66fee44cca5b23389cba8e21e3a0b237268e
2018-04-13 21:51:21 -07:00
Durham Goode
8038c6ea27 hg: support cg2 in pushrebase
Summary:
Previously pushrebase would only send changegroups using the cg1
format. remotefilelog will soon require cg2 (and it results in better deltas
anyway), so let's change pushrebase to allow using cg2.

Initially it is off by default. We will change it to be on by default once the
server has been upgrade to to handle the received part.

Reviewed By: mjpieters

Differential Revision: D7108732

fbshipit-source-id: ff4ad3a3fc2801aec4876db30c8130ce743b2e6a
2018-04-13 21:51:19 -07:00
Thomas Jacob
0e6b93a0e0 Add support for RocksDB
Summary:
- Add support for RocksDB engine (developed as a drop in replacement for innodb) to hgsql to allow new xdb.hgsql.1-10 shards to host hg repos
- Prefer MySQL test DBs in same region
- Run all hgsql unit tests also for RocksDB engine
- Allow for nested ifs to make that possible (downside if you switch off rockdb tests, innodb tests are run twice)

Reviewed By: quark-zju

Differential Revision: D7014064

fbshipit-source-id: 073c36176aa7eaf74252ef33c3f47da594920b28
2018-04-13 21:51:13 -07:00
Mainak Sen
20bcf91c66 fbamend: a config flag for skipping autorebase for hg amend
Reviewed By: quark-zju

Differential Revision: D6947242

fbshipit-source-id: cf22cf5f514825d7e09aade90f1c9efdc7f73fa1
2018-04-13 21:51:11 -07:00
Phil Cohen
7bcdda8bfc simplecache: allow debug output to be switched off
Summary:
This extension can be a bit noisy when defaulted-on. Let's disable its debug output in
tests (except fot its own tests).

Differential Revision: D6777765

fbshipit-source-id: e2a6c6b7527336a1fac24078d2b49eb1e75ecabf
2018-04-13 21:50:55 -07:00
Durham Goode
a99b9eb0c2 sparse: add back sparse.py
Summary:
Some consumers still rely on enabling 'sparse=' so let's add a module
that just redirects to the real fbsparse.py.

Also updates configerator to use the newer name.

Reviewed By: markbt, quark-zju

Differential Revision: D6755971

fbshipit-source-id: 3a67f029045dacf927742a616a714fe632b97fea
2018-04-13 21:50:53 -07:00
Jun Wu
97dfe79221 perftweaks: fold isgooddelta tweak into core
Summary:
The isgooddelta tweak was introduced in D2693043 (perftweaks: change revlog
delta heuristic, 2015-11-24).  Comparing with the existing version, the only
change is that we removed `dist > maxdist` check.

Note that the upstream commit 895ecec31 (revlog: add an experimental option
to mitigated delta issues (issue5480), 2017-06-23) also introduces a config
option to override `maxdist` to make the condition fail, which basically does
a same thing.

Instead of introducing new config options or adding more "if"s to the
codebase to make it more obscure, let's just simplify it by disabling the
check entirely, and removing the `dist` concept, removing two config
options: `experimental.maxdeltachainspan` and `perftweaks.preferdeltas`.

The `chainlen > self._maxchainlen` check should be enough for keeping
delta chain length bounded.

Reviewed By: DurhamG

Differential Revision: D6752529

fbshipit-source-id: e8fd8ec39240191db5fb274190fc661e97087a78
2018-04-13 21:50:53 -07:00
Kostia Balytskyi
262eba6775 tests_: accept some more recently-introduced test-check failures
Summary: To be fixed later, now I need to test the hgbuild.

Differential Revision: D6748921

fbshipit-source-id: 519555286a43ef7852e37b699e30197c1ad85424
2018-04-13 21:50:52 -07:00
Kostia Balytskyi
4ba9c92043 fb-hgext: remove the directory
Summary: We've moved everything over!

Test Plan: - I like to live dangerously

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6693267
2018-01-10 08:48:02 -08:00
Ryan McElroy
7ccc849e01 hgsubversion: allow undocumented configs for now 2018-01-03 11:51:20 -08:00
Richard Langston
9803957e8a hg-git: accept config test failures 2018-01-03 10:06:35 -08:00
Kostia Balytskyi
3f6704f1ce fb-hgext: accept test-check-config failures 2018-01-03 09:46:16 -08:00
Mark Thomas
355f57bd1a hgsql: accept new test failures 2018-01-03 07:03:21 -08:00
Stanislau Hlebik
23dd2cf1eb remotenames: accept test failures 2018-01-03 06:28:53 -08:00
Matt Harbison
7d8bebd9c1 tests: remove (glob) annotations that were only for '\' matches
# skip-blame because this was mechanically rewritten the following script.  I
ran it on both *.t and *.py, but none of the *.py changes were proper.  All *.t
ones appear to be, and they run without addition failures on both Windows and
Linux.

  import argparse
  import os
  import re

  ap = argparse.ArgumentParser()
  ap.add_argument('path', nargs='+')
  opts = ap.parse_args()

  globre = re.compile(r'^(.*) \(glob\)(.*)$')

  for p in opts.path:
      tmp = p + '.tmp'
      with open(p, 'rb') as src, open(tmp, 'wb') as dst:
          for line in src:
              m = globre.match(line)
              if not m or '$LOCALIP' in line or '*' in line:
                  dst.write(line)
                  continue
              if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
                  dst.write(line)
                  continue
              dst.write(m.group(1) + m.group(2) + '\n')
      os.unlink(p)
      os.rename(tmp, p)
2017-12-10 22:50:57 -05:00
Ryan McElroy
5a6e1ad8d5 check-config: mention the file and line of the error
I used this to more quickly track down a failing test-check-config.t issue
in another repo. I thought it might be useful more generally, so I'm sending
it out in case others think it's a worthwhile change.
2017-07-18 06:27:36 -07:00