Commit Graph

545 Commits

Author SHA1 Message Date
Aleksei Kulikov
59bb951024 amend: make next prefer draft commits
Summary: Add an option `update.nextpreferdraft` that makes `hg next` prefer single draft child commits.

Reviewed By: markbt

Differential Revision: D16500162

fbshipit-source-id: 3a20bb487d35b7acf92792e9a7b7424c9b163b64
2019-07-26 10:00:07 -07:00
Shu-Ting Tseng
86bdaeb464 make pushes faster in our reverse sync case
Summary:
Our reverse sync job is too slow when pushing to svn. It seems like the slowness comes
keep doing push-pull-rebase which doesn't seem necessary in our case.

From my understanding, we need to do push-pull-rebase because we have multiple writers.
In our sync job, we only have one writer and therefore can we skip the pulls and rebases?

Reviewed By: DurhamG

Differential Revision: D16442559

fbshipit-source-id: 926d1c516e8e6d59298d310fc67927ace37f72c9
2019-07-26 07:21:37 -07:00
George-Catalin Tintareanu
f91262be22 Enum creator
Summary:
Util method to generate Enum, since some machines don't have the
python library installed.

Reviewed By: suitingtseng

Differential Revision: D16491020

fbshipit-source-id: e06470a609605c482f591418583b516918c49d93
2019-07-25 07:24:36 -07:00
Xavier Deguillard
9b21206b39 remotefilelog: remove python mutablehistorypack
Summary: There no users left, let's get rid of it.

Reviewed By: kulshrax

Differential Revision: D16423137

fbshipit-source-id: 6898e681f800ab677010d7b6cdd36d377e3ef644
2019-07-24 10:34:32 -07:00
Xavier Deguillard
10a59c9b75 remotefilelog: remove python mutablehistorypack from mutablestore
Summary: The Rust code is the default.

Reviewed By: kulshrax

Differential Revision: D16423134

fbshipit-source-id: 30baf041a5e7c786a28b31cfe5025e893b34594c
2019-07-24 10:34:32 -07:00
Xavier Deguillard
e86e388661 remotefilelog: remove python mutabledatapack code
Summary: Goodbye.

Reviewed By: kulshrax

Differential Revision: D16392290

fbshipit-source-id: 541b945e274f097b722b5e79ca03e104c4cfd6a0
2019-07-24 10:34:31 -07:00
Xavier Deguillard
bd88a79858 remotefilelog: remove python mutabledatapack reference from mutablestores
Summary:
The Rust code is now always taken, let's start removing all the references to
the python mutabledatapack code.

Reviewed By: kulshrax

Differential Revision: D16392287

fbshipit-source-id: dfccd4f4ec052a46975b6f9144106b51c3282988
2019-07-24 10:34:30 -07:00
Xavier Deguillard
334e0c0c2e remotefilelog: the rust mutable stores are the default
Summary: This is now enabled for the entire fleet, let's hardcode this in the code now.

Reviewed By: kulshrax

Differential Revision: D16392289

fbshipit-source-id: 462152ded12d00cf8218526d51a911d6fe5975ca
2019-07-24 10:34:30 -07:00
George-Catalin Tintareanu
15f36ceede hg client handler for blacklisted files
Summary: Checks if the retrieved content of a file is equal to a `magic string` representing a blacklisted file. If so, then the content is replaced by a readable text which suggests a `rebase` or `update` to a newer commit.

Reviewed By: ikostia

Differential Revision: D16260011

fbshipit-source-id: ac1d40132b9c947927271d8e6efda98b19dce984
2019-07-24 03:41:20 -07:00
Arun Kulshreshtha
a491bb06ea remotefilelog: only print debug messages during interactive usage
Summary: The debug messages from Eden API provide Source Control team members with useful diagnostic information about HTTP data fetching, but they have the potential to be spammy when written to log files. To prevent log spam, let's only print these messages during interactive usage.

Reviewed By: quark-zju

Differential Revision: D16445346

fbshipit-source-id: 001dc75e440eaf797f4f953648453086421f624e
2019-07-23 15:13:59 -07:00
Xavier Deguillard
7478874389 remotefilelog: remove maintenance repack memcache fetch
Summary:
When using fetchpacks, memcache will write to an indexedlog, which can't be
repacked. I'm also suspecting that there is a race between this repack, and
hg_memcache_client opening the newly created packfiles which can cause the
misses to not be sent to memcache.

Reviewed By: kulshrax

Differential Revision: D16432538

fbshipit-source-id: 62362682474883bcd58249791c02b9fed5cb8fea
2019-07-22 22:31:38 -07:00
Shu-Ting Tseng
5c49bedd8b add a trailing newline when committing to svn
Summary:
By adding a newline, we can ensure the meta message is always on its own line.

This is to address the comment in D16340374.

link to comment: https://our.intern.facebook.com/intern/diff/D16340374/?transaction_id=732272950561759&src_number=86745022

Reviewed By: quark-zju

Differential Revision: D16417344

fbshipit-source-id: caaae1748018bbe5ddbb587adacd45b8709da8cc
2019-07-22 14:06:12 -07:00
Stefan Filip
cb57f5d7ac bindings: add manifest python classes
Summary: Bindings so that the rust manifest code can be used in Python.

Reviewed By: quark-zju

Differential Revision: D16352532

fbshipit-source-id: 34d4522f5e084f531f31bcd21770950f15f2fe13
2019-07-22 13:03:00 -07:00
Stefan Filip
a1a75d5d73 tremanifest: rename tree holding variable to _tree
Summary: Minor rename

Reviewed By: quark-zju

Differential Revision: D16352529

fbshipit-source-id: 658f9843041d858e1471c07554b5715db011d17c
2019-07-22 13:02:58 -07:00
Jared Bosco
3c30d27350 copytrace: remove copytrace flag from mutating global options table
Summary:
Copytrace modified the global definitions table which was making it very difficult to keep track of side-effects as the code was executed, as well as making it harder to replace the fancyopts calls with native Rust.

Since the copytrace behavior can be achieved through a configuration, it now will no longer modify the global definitions table, and will display the correct flag for a user to use in order to get this same behavior.

Reviewed By: quark-zju

Differential Revision: D15902449

fbshipit-source-id: 1c254162d56823e65085b7047bb37513f187b487
2019-07-20 01:06:33 -07:00
Xavier Deguillard
8f47102275 fixcorrupt: fix debugfixcorrupt on treeonly repos
Summary:
Treeonly repos doesn't use revlogs, and thus debugfixcorrupt shouldn't try to
fix them.

Reviewed By: quark-zju

Differential Revision: D16373142

fbshipit-source-id: 6517b9516358223bfb6c646fd22aaa99c26b0372
2019-07-19 20:15:36 -07:00
Matt Glazar
9b88f1e59b Fix slow rebase for commits which move files
Summary:
When rebasing or showing a diff for a commit which moved files, remotefilectx.ancestors (called by _tracefile) calculates the linkrev for each ancestor. Sometimes [1], this is a disaster:

* remotefilectx._linkrev executes its slow path and scans the change log.
* For each entry in the change log, remotefilectx._linkrev downloads trees if needed.
* Hg downloads trees one-by-one (as of D15964145).

remotefilectx.ancestors is only calculating linkrevs so it can sort the ancestors topologically. _tracefile only needs the ancestors to be ordered topologically, not by linkrev. remotefilectx.ancestors's calls to remotefilectx._linkrev are redundant.

Optimize _tracefile's use of remotefilectx.ancestors: order remotefilectx objects topologically (breadth-first) without sorting by linkrev. Create a new function for this purpose (topological_ancestors) to avoid possibly breaking other callers of remotefilectx.ancestors. As a side effect, make this new function return remotefilectx objects lazily, similar to the filectx.ancestors function.

On my machine, with warm caches, this speeds up 'hg diff -c' and 'hg rebase' for a modestly-sized commit. 'hg diff -c' takes 0.64 seconds, down from 65.6 seconds.

[1] Hypothesis: After 'hg amend', 'hg bundle' packages linkrevs which refer to the pre-amend commit (which is not serialized into the bundle) rather than the post-amend commit. 'hg unbundle' thus creates linkrevs referring to a missing commit.

Reviewed By: DurhamG

Differential Revision: D16297426

fbshipit-source-id: 407597d5e36fc06b33719c28f5ea5052e01dc7a3
2019-07-19 12:35:22 -07:00
Aida Getoeva
3c81066860 commitcloud: fix sync when remotebooks sync disabled on one of the copies
Summary:
If one of the repo checkouts doesn't have remote bookmarks synchronization enabled, it must not affect the Cloud's remote bookmarks state.

I also changed `localserver` (is used for our tests) because Commit Cloud server deletes the "old" bookmark names from the db and inserts "new". However, the `localserver` just set the "new" books dictionary as a new state, which is not quite correct.

Reviewed By: simpkins

Differential Revision: D16338257

fbshipit-source-id: d77d9218b1c35ea1a097bbe7393d0910ce7b4d38
2019-07-19 10:04:25 -07:00
Aida Getoeva
6ab4fcf8f8 commitcloud: fix remote bookmarks' merge on sync
Summary: While checking if one public commit is an ancestor of another public commit, I used string hashes instead of binary nodes. Fixing.

Reviewed By: farnz

Differential Revision: D16338256

fbshipit-source-id: e27ed8d79ec9ed3a188cdee93366ab2f96526152
2019-07-19 10:04:25 -07:00
Saurabh Singh
c137206645 globalrevs: return globalrevs while resolving svnrev template keyword
Reviewed By: quark-zju

Differential Revision: D16361887

fbshipit-source-id: 547b03af9c17aa7ab033f9d1bd733f4a63830d07
2019-07-18 12:23:00 -07:00
Saurabh Singh
0766f36b29 hgsubversion: refactor method for svnrev template keyword to easy wrapping
Summary:
This commit is just a simple refactor of the method for the resolving
the `svnrev` template keyword. In particular, we split the method so that it
can be easily wrapped by other extensions like globalrevs in D16361887.

Reviewed By: quark-zju

Differential Revision: D16361888

fbshipit-source-id: 9f20fb33afd2b286c4f30571fa257b8284f2bb54
2019-07-18 12:23:00 -07:00
Shu-Ting Tseng
fd5abc16e3 rewrite svn commit message with hg hash
Summary:
When we are migrating www to hg as source of truth, we would like to maintain the
reverse sync for some time in case we need to rollback.

In order to achieve that, we need to know the latest svn and hg commit to operate on. We
would like to record this information in the svn commit itself so it doesn't require
extra syncing and transaction.

In ordre to get this info, we can run `svn log -l 1` and parse the commit message from
there.

Reviewed By: quark-zju

Differential Revision: D16337012

fbshipit-source-id: acf66babdb48c07f95e9eb49daac0d3d3e6a96a0
2019-07-18 10:06:05 -07:00
Jun Wu
cb0126cb4a util: add istest() method
Summary:
There are multiple places that want to know whether the code is running inside
tests or not. Add `util.istest` for that and migrate those callsites to use it.

Reviewed By: xavierd

Differential Revision: D16344715

fbshipit-source-id: faa4261c83e4d889d59d63968b440954c4cac2ce
2019-07-17 21:11:29 -07:00
Xavier Deguillard
18191934a6 remotefilelog: consider memcache write failure as a cache miss
Summary:
We've had cases where hg_memcache_client failed to write to the
indexedlogdatastore, but since it was returning a success code, hg wouldn't
find the node, and crash.

Let's add a new error code to signify that all the requested objects should be
considered as misses.

Reviewed By: quark-zju

Differential Revision: D16344530

fbshipit-source-id: 4e627fee1603f9e4d5f542ef2d1f0e881a085bad
2019-07-17 14:52:33 -07:00
Mohammad Ayoub
2257f3210d fix default value in cloud sl --version_number and hg cloud sync --workspace-version
Summary:
the default value was being set to type int, changed it in both occasions to "".

in cloudsync I had to do some parsing for the version into an int not to break the rest of the code

Reviewed By: mitrandir77

Differential Revision: D16340048

fbshipit-source-id: 7f7142ea4c7862c0a093a68d5c8ceb1d2e22df24
2019-07-17 13:03:13 -07:00
Marla Azriel
36d7d7604d commands: help text for undo
Summary: Updated help text for hg undo and fixed test

Reviewed By: kulshrax

Differential Revision: D15937058

fbshipit-source-id: 577d05fb9c16237f8b879ef9ebf60341d5fdf37e
2019-07-17 10:43:01 -07:00
Mohammad Ayoub
9b54adf9d8 add interactive cloud sl --history command
Summary: Added an interactive view for viewing historical versions of smartlogs.

Reviewed By: mitrandir77

Differential Revision: D16260236

fbshipit-source-id: 94582e2b6351dff50dc15c030aa73495b900d346
2019-07-17 05:29:47 -07:00
Mohammad Ayoub
ed8cf87d5e Add date and version options to hg cloud sl
Summary: Modified the hg cloud sl command to have two options --date and --version_number that display that historical version of the smartlog

Reviewed By: mitrandir77

Differential Revision: D16120273

fbshipit-source-id: 4f202ed49488247f43bd682574ff52dcf17c958e
2019-07-17 00:58:50 -07:00
Durham Goode
97b7106d24 historypack: add logic to prevent history cycles
Summary:
Bad callers could try to add nodes that had the same value as the
parent. Let's catch this and prevent it.

Reviewed By: quark-zju

Differential Revision: D16189602

fbshipit-source-id: 08220c18ee96743e4eda00e5e953a5946b40d95c
2019-07-12 10:47:29 -07:00
Adam Simpkins
691ef10cff fix fsmonitor on Windows
Summary:
The python runtime update in D15894694 broke ctypes for all APIs that accept a
Windows `HANDLE`.  This was used by the `fsmonitor` code that tries to connect
to watchman on windows.

As a result Mercurial would silently fail to use watchman.  Commands like
`hg status` became very slow, with no user-visible output to indicate that
anything was wrong.  (It wouldn't print a progress bar or any other
information either.)

Reviewed By: quark-zju

Differential Revision: D16198869

fbshipit-source-id: 675007674e0ac742c5b62739d766b8c3016e0c1b
2019-07-11 11:39:03 -07:00
Saurabh Singh
91e1b369e7 globalrevs: simplify the logic to resolve globalrev/svnrev to commit hash
Summary:
Following D16198896, we can really simplify the logic for resolving
globalrev/svnrev to commit hash. In particular, we can make much more stronger
assumptions about what is indexed now and therefore, narrow the search to only
the commits that are not cached.

Reviewed By: quark-zju

Differential Revision: D16199072

fbshipit-source-id: cec66cbda24ee6df200fc77aeed42c11c29edeba
2019-07-11 11:39:03 -07:00
Saurabh Singh
484346dd87 globalrevs: add svnrev to the globalrev map for fast lookup
Reviewed By: quark-zju

Differential Revision: D16198896

fbshipit-source-id: cc6fc4fdca8df51a24c701abdf43cea42776fa26
2019-07-10 21:30:00 -07:00
Mark Thomas
33b103a8bc remotefilelog: override fetchdepth when looking for linkrevs
Summary:
When looking for the matching filenode when searching for the linkrev of a
filectx, override fetchdepth to 1 so that we don't download the whole manifest
just to examine a single file, and add tracing and a progress bar, as this can
be slow.

Reviewed By: mitrandir77

Differential Revision: D15964145

fbshipit-source-id: d338de330c82d4240bed5569caf25769778458aa
2019-07-10 16:41:54 -07:00
Mark Thomas
398067390d remotefilelog: disable descendantrevfastpath by default
Summary:
With treemanifest and the eden api, descendantrevfastpath (which downloads all
the manifests) is slower than just downloading the history from the eden api.

We still want to record the descendantrev if we already know the real linkrev
of the current filenode, as that will still be fast.

Reviewed By: quark-zju

Differential Revision: D15943076

fbshipit-source-id: c6013801822bdfa3196e60cbcd34a9ce184c5c5f
2019-07-10 16:41:54 -07:00
Mark Thomas
5f2b5fbeb6 remotefilelog: add progress bar and perftrace for adjustlinknodes
Summary:
Adjusting linknodes can sometimes take a long time.  Add a progress bar and perftrace
for when this happens.

Reviewed By: sfilipco

Differential Revision: D15943077

fbshipit-source-id: f91bc6bb9f7c6d39ffe9ac7b2bf4ab0f32b4d9d3
2019-07-10 16:41:54 -07:00
Mark Thomas
d306b09539 commitcloud: disable prefetch and migrate during sync
Summary:
During `cloud sync`, disable the following options, as they slow sync down and
aren't really necessary.

* Set `pull.automigrate` to False, as there is no need to perform pull migrations
  in the sync pull.
* Set `treemanifest.pullprefetchrevs` to False, as we won't have updated the
  remote bookmarks, so there is no need to try to prefetch the trees.
* Set `treemanifest.prefetchdraftparents` to False, as synced commits are not
  usually checked out immediately, so there is no need to prefetch the tree.

Reviewed By: quark-zju

Differential Revision: D16054353

fbshipit-source-id: 0eeab49e5242fdddc593843ed67e6a17281ec912
2019-07-10 16:30:02 -07:00
Mark Thomas
5815917003 treemanifest: add prefetchdraftparents option
Summary:
Add `treemanifest.prefetchdraftparents`, which controls whether or not to
prefetch the trees for the parents of newly added draft commits.

We will want to avoid this in commit cloud, as the prefetch may take too
long, and the user might not access the commits anyway.

Reviewed By: quark-zju

Differential Revision: D16054354

fbshipit-source-id: cf590451fb5252d215748567d6ad421c589ed581
2019-07-10 16:30:02 -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
Saurabh Singh
ac9bb62a88 fbconduit: fix translating the globalrev for a commit not in repository
Reviewed By: quark-zju

Differential Revision: D16168059

fbshipit-source-id: 94276dbb3fb78f9e8d7f0e2b27ddc31225f2c256
2019-07-09 13:43:28 -07:00
Xavier Deguillard
ca0d0269fc remotefilelog: set umask before creating the repacklock
Summary:
On a shared host (like the devgpu), the shared cache will be used by many
users, and thus the repacklock needs to be able to be read/write by all the
users. Despite the code trying to open it as 664, the umask downgraded it to
644, only allowing the file creator to run repack.

Reviewed By: quark-zju

Differential Revision: D16151053

fbshipit-source-id: 4d3ecc19f2f6fbf9a8b831f7ea39d0a53bc4b8e9
2019-07-08 17:48:19 -07:00
Aida Getoeva
1e4f33a984 commitcloud: fix remote books sync
Summary:
Fixing bugs I've discovered by enabling remote bookmarks sync for myself:

* turned out, adding "None" to the dict field in Python doesn't work as a null-value of optional field in C++ Thrift structure

* I didn't update lastsyncstate in some of the cases, also fixing

Reviewed By: mitrandir77

Differential Revision: D16131799

fbshipit-source-id: bdee423f519820d702719b3dfe76865a7547221e
2019-07-08 02:24:15 -07:00
Jun Wu
9636711893 logging: move shortlist util to blackbox.py
Summary: It will be used in non-fsmonitor cases.

Reviewed By: markbt

Differential Revision: D15755286

fbshipit-source-id: 75ba7c5f227e1c9224c5d092b7e766afdf45c428
2019-07-06 02:46:19 -07:00
Jun Wu
1145e2541b logging: migrate fsmonitor to new blackbox API
Summary:
The new log is typed and concise.

Old log:

  [fsmonitor]> clock='c:1559600325:3956709:1:34762' len(nonnormal)=0
  [fsmonitor]> setlastclock 'c:1559600325:3956709:1:36405'
  [fsmonitor]> setlastisfresh False
  [fsmonitor]> watchman returned ["x"]
  [fsmonitor]> getlastclock 'c:1559600325:3956709:1:36405'
  [fsmonitor]> set clock='c:1559600325:3956709:1:36405' notefiles=["x"]

New log:

  [fsmonitor] clock: "c:1559600325:3956709:1:34762" -> "c:1559600325:3956709:1:36405"; need check: [] + ["x"]

In JSON form:

  {"fsmonitor":{"new_clock":"c:1559600325:3956709:1:36425","new_files":{"len":1,"short_list":["x"]},"old_clock":"c:1559600325:3956709:1:34762"}

The new logging does not cover every information exposed by the old logging.
For example:

- Non-treestate events like why fsmonitor state gets invalidated.
  Assuming most clients are on treestate now. These are removed.
- "fsmonitor_state = normal | unavailable | fresh" scuba logging. This can be
  inferred, and will be added in a later diff.
- New "notefiles". The next "fsmoniotr" event will log the information.

Reviewed By: markbt

Differential Revision: D15710672

fbshipit-source-id: 5c4cad08c0072c7dc711e5c1e65aa7552940699e
2019-07-06 02:46:17 -07:00
Jun Wu
0467d7ad61 logging: migrate watchman command logs to new blackbox event
Summary: Migrate ui.log("watchman", <str>) to blackbox.log(<Rust Event::Watchman>).

Reviewed By: markbt

Differential Revision: D15710675

fbshipit-source-id: e5aabb4447b03921adc968bb8f03f140f6056501
2019-07-06 02:46:16 -07:00
Jun Wu
e09af5792b logging: remove fastmanifest logging
Summary:
We don't actually use fastmanifest nowadays. Remove logging to reduce noise in
blackbox.

Reviewed By: markbt

Differential Revision: D15710673

fbshipit-source-id: 10d99b4276e76313bf43ffba87e5f2584a67d639
2019-07-06 02:46:16 -07:00
Xavier Deguillard
e533349097 remotefilelog: add hg debugindexedlogdatastore command
Summary:
This has the exact same behavior as `hg debugdatapack` but on
indexedlogdatastore. Since nodes can be added concurrently to the indexedlog,
we can't verify that nodes aren't duplicated, so disable that logic.

Reviewed By: kulshrax

Differential Revision: D16073582

fbshipit-source-id: b7bbefdca8062c8b797432cb76b0de9df850148e
2019-07-03 19:29:39 -07:00
Xavier Deguillard
e389d8ecd7 remotefilelog: remove python historypack code
Summary: All the users are now using the Rust code.

Reviewed By: kulshrax

Differential Revision: D16039092

fbshipit-source-id: 1341ed33ab9a17f30b541b02eaa577db56959e31
2019-07-03 19:29:38 -07:00
Xavier Deguillard
e901daf72e bindings: add iterentries for Rust historypack
Summary:
This allows switching hg debughistorypack to using Rust historypack code
instead of Python. Similarly to the iterentries for datapack, we collect all
the data in memory instead of using an iterator.

Reviewed By: kulshrax

Differential Revision: D16039098

fbshipit-source-id: 8b61c04e43a319a4601cc1aaae2eb46922d4a851
2019-07-03 19:29:38 -07:00
Xavier Deguillard
0eb3be2397 remotefilelog: remove Python datapack code
Summary:
This has now been entierely replaced by Rust code.

Goodbye.

Reviewed By: kulshrax

Differential Revision: D16039096

fbshipit-source-id: 8c3ce2eb5595a5f90c3ecab413a242a3d0afcb89
2019-07-03 19:29:37 -07:00
Xavier Deguillard
133a9820a1 treemanifest: replace use of Python datapack with Rust one
Summary: This is the last use of Python datapack in treemanifest

Reviewed By: kulshrax

Differential Revision: D16039101

fbshipit-source-id: 205b6fed0811ae86542f72aeed95cec81a61d741
2019-07-03 19:29:37 -07:00