Commit Graph

33 Commits

Author SHA1 Message Date
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Mark Thomas
ddecddf074 commitcloud: improve specification of workspace names
Summary:
Replace the `-w` option of the commit cloud commands that process workspace
names with general options of the form:

 * `-u` or `--user` - to select the workspaces of a particular user.
 * `-w` or `--workspace` - to select a particular workspace for that user.

A (hidden) `--raw-workspace` option is provided to allow use a workspace
by its exact name, should that be needed.

The `-w` option still accepts full user workspaces, but shows a warning.

These options apply uniformly to any command that takes a workspace.

Reviewed By: liubov-dmitrieva

Differential Revision: D13730839

fbshipit-source-id: d1b884b100caf909619511db4861eb1b880a0d3e
2019-01-21 03:33:31 -08:00
Saurabh Singh
bc9e47bfb6 infinitepush: fix visibility issue during update
Summary:
I faced an issue where I had the following DAG:

```
A   B
@   o
|  /
| /
|/
o C
```

I did the following operations at that point:

```
hg hide -r A
hg up top
```

but the update took me back to A instead of taking me to B as I expected.
quark-zju debugged the issue and we found out that this was due to D6899232.
This commit fixes the issue by ensuring that we do not make a filtered repo
unfiltered before the update operation.

Reviewed By: DurhamG

Differential Revision: D13388494

fbshipit-source-id: 1678f97a4b3179720c30cf1366e9301a2c27a5ba
2018-12-07 18:07:16 -08:00
Mark Thomas
a3c411c1e8 commitcloud: omit older commits when pulling during sync
Summary:
Add a new config option: `commitcloud.max_sync_age`.  When set, commit cloud
will not pull in any commits that are older than this when it is joining or
syncing.  The commits are still nominally in the cloud workspace, we just
save join or sync time by not including the commits.

Reviewed By: liubov-dmitrieva

Differential Revision: D13062470

fbshipit-source-id: 17a4bdb4095766a83a4bf6d4151ae86b39edf59c
2018-11-15 12:16:19 -08:00
Mark Thomas
861e5ca8d5 commitcloud: pull unknown public bookmark hashes as well as draft heads
Summary:
When syncing a commit cloud repo, if the user has put a bookmark on a public
commit that we don't have locally, also pull that public commit into the repo
so that we can put the bookmark on it.

Reviewed By: quark-zju

Differential Revision: D12815471

fbshipit-source-id: 080038e4e239170cad994ff4ab9326d787d1c0fa
2018-10-29 04:19:07 -07:00
Saurabh Singh
6317ba0ca2 amend: replace with the fbamend extension
Summary:
The functionality we care about is provided by the `fbamend`
extension. Therefore, lets replace the `amend` extension with the `fbamend`
extension.

Reviewed By: farnz

Differential Revision: D10320739

fbshipit-source-id: 5700d39f488777fcc4033f60ce0a51cda15ef2ad
2018-10-11 06:59:23 -07:00
Liubov Dmitrieva
75817a809e commitcloud: make port and TLS options configurable to connect to Commit
Reviewed By: markbt

Differential Revision: D9942698

fbshipit-source-id: b0426498d67cea84d3831ee46a29b32145edb46e
2018-09-20 05:50:53 -07:00
Liubov Dmitrieva
e638e652e9 commitcloud: add option to select only commits related to the user in the default workspace
Summary:
this is usefull when a user have a lot of other users commits in the default workspace

the set of commits includes all the stacks where at least one commit is user's own

the option is for the default workspace only, it doesn't apply for other workspaces a user may collaborate in

the idea is that the client code will never offer other user's commits to sync, so cloud sync will perfectly work with some extra commit might present on any machine.

this allow users to continue have other users commits in their workspace for review or other purposes even if it is very very large, but provides reliable backup and sync solution for user's own work.

the option works for all commands `hg cloud join` `hg cloud rejoin` `hg cloud sync` and `hg cloud recover`

Reviewed By: simpkins

Differential Revision: D9645571

fbshipit-source-id: 9adb68568083c87c22bb86c19fb7a5bb0f639265
2018-09-05 17:39:31 -07:00
Liubov Dmitrieva
a51873a3fb cloud sync - add an option to specified a head to include
Summary:
this is an option to take into consideration only specified heads that run cloud sync

this is helpful to debug issues with individual stacks on push part of cloud sync

Reviewed By: quark-zju

Differential Revision: D9349821

fbshipit-source-id: c5220be3b30cfc300bf62bdcfc472368ce74104e
2018-08-21 10:51:39 -07:00
Phil Cohen
917604f2f5 tests: fold tglog into tinit; standardize
Summary:
Like D9323267, hg tests commonly reinvent common aliases to render the DAG, and they often differ very slightly. This makes adding a test require more boilerplate, and reading a test in a foreign new area slightly more overhead.

Let's standardize these to reduce the copypasta.

It's necessary to define this as a shell function instead of an hgrc alias to prevent tests that list aliases from printing it. Plus that enforces a nice separation of test/stdlib logic.

Bookmarks and branches are easy enough to add since they're empty if not used. A good number added `{phase}` -- I renamed this to `tglogp`.

Reviewed By: quark-zju

Differential Revision: D9347072

fbshipit-source-id: 6aac7de3e65d2295a7ebecd2ab30901709af3ff1
2018-08-16 10:53:43 -07:00
Liubov Dmitrieva
f3937b3937 cloud join - add workspace parameter
Summary:
Add this as an experimental option

We don't have switching of workspaces so far, but hg clone is very fast with eden, so it is easy to create a brand new repo and join to any workspace.

This is already useful for debugging and repro user's issues.

You just join to the user's workspace from a brand new repo and can see what is going on there.

Reviewed By: quark-zju

Differential Revision: D9082157

fbshipit-source-id: 561314cddfced07c81c4bb6c1c2ccf99e140b27c
2018-08-02 05:20:28 -07:00
Liubov Dmitrieva
14ff03f833 fbclone: enable commit cloud check
Summary: enable call of hg cloud rejoin in fbclone

Reviewed By: markbt

Differential Revision: D8677927

fbshipit-source-id: e50ad2dd5db838c4051061da46fa067153eb866d
2018-07-02 03:04:54 -07:00
Liubov Dmitrieva
4ff0279f08 cloud rejoin command
Summary:
this command will be use in fbclone

it does sync and join if a person has been used already the commit cloud workspace in that repo

Reviewed By: markbt

Differential Revision: D8640667

fbshipit-source-id: 9c8d96497cf7930b995a49c8bdaebe7048e0c1e8
2018-06-26 12:36:29 -07:00
Liubov Dmitrieva
45801f1f5f commitcloud fix ux when password is not found in the keychain
Summary:
recent refactoring broke user experience if token is not found
not found is actually an error, rather than an empty result for security command

Reviewed By: markbt

Differential Revision: D8489287

fbshipit-source-id: 5ee6e821ce79877b43f93cb86b6935294b9e4a67
2018-06-18 12:49:34 -07:00
Liubov Dmitrieva
041bd1198e commitcloud improve error message for access keychain from ssh sessions
Summary:
security command normally show a GUI prompt to allow you to type your password if the keychain is locked
if it is unable to do so, it returns 36 and empty stderr

it is ok that it is failed, because it happens due to security reasons,
the problem is only that stderr is empty, so the reason of failure is not clear to user.

I didn't find any option in the man of security command itself. So, I checked the status code.

Reviewed By: markbt

Differential Revision: D8418363

fbshipit-source-id: 0c8f0bf55f588822e50395c3ec8bfa8d3188ecf7
2018-06-14 06:46:34 -07:00
Mark Thomas
6fd3772316 commitcloud: update bookmarks and obsmarkers as part of the sync pull
Summary:
Avoid transient partially synced stated by updating the bookmarks and
obsmarkers as part of the pull command, if there is one.   Additionally,
prevent remotenames bookmarks from being updated in cloud-sync pulls that
happen to include public commits.  That's preferable, as usually this will only
be a subset of remote bookmarks, and this can give confusing results.

Reviewed By: DurhamG

Differential Revision: D8401117

fbshipit-source-id: 5ee646d8c7e49ea70d3ec5fd7df5c9009de7bcdd
2018-06-14 02:42:39 -07:00
Mark Thomas
84b7a0a84f commitcloud: push commits stack-by-stack
Summary:
Rather than pushing a bundle containing all unpushed draft commits, instead
push stack by stack.  This reduces the individual bundle size, and means
failure to push some commits means we can still make progress.

Reviewed By: DurhamG

Differential Revision: D8241383

fbshipit-source-id: 6f1528613fa228627fe156a8e4720dd46929ebe2
2018-06-05 04:36:07 -07:00
Mark Thomas
5180dd5cf2 infinitepush: split backups into infinitepushbackup extension
Summary:
Split the infinitepush backups code into a separate module.

The infinitepush extension is responsible for providing scratch pushes, as well
as the server-side implementation for storing scratch bundles.

The infinitepushbackup extension uses this feature to provide automatic backup
support.  It is an alternative to the commitcloud extension, and the two will
be mutually exclusive.

Reviewed By: DurhamG

Differential Revision: D8204418

fbshipit-source-id: 9279c426da35d451a5e7b39a72f2c91d364e3fd4
2018-06-05 04:36:06 -07:00
Liubov Dmitrieva
fd4980147d commitcloud: add / remove subscription
Summary: add / remove subscription to Commit Cloud Notifications (and notify the daemon to restart subscriptions)

Reviewed By: markbt

Differential Revision: D8186751

fbshipit-source-id: 7d726c8a29752793bf038c5bfc3a379c17712275
2018-06-04 05:38:22 -07:00
Liubov Dmitrieva
f6de146d60 commitcloud: add hint for updateonmove option
Reviewed By: quark-zju

Differential Revision: D8204928

fbshipit-source-id: 2bdf1fed3416be2f1a89355020208022327b6524
2018-05-31 18:56:28 -07:00
Liubov Dmitrieva
f3c9a2cf11 cloud sync: add new options
Summary:
These are secret options for SCM Daemon

1. specify the version that comes from notification.
 if notification comes from itself, we can save server time from unnecessary requests.

2. respect auto backup current settings
before auto backup setting were only respected by the background backup triggered when you make a commit. It is logical that SCM Daemon will also respect that settings

Reviewed By: markbt

Differential Revision: D8143296

fbshipit-source-id: 0d407d489a723543bdb2ce25af8b9fd6687e2d53
2018-05-29 05:03:26 -07:00
Mark Thomas
6b20072672 commitcloud: use source repo when writing infinitepushbackupstate
Summary:
The infinitepushbackupstate file must be written using the vfs of the source
repo when the share extension is in use.

Reviewed By: mitrandir77

Differential Revision: D7936097

fbshipit-source-id: a57e241ca969632ced65029cb5ccf61373bd8aeb
2018-05-10 11:32:30 -07:00
Mark Thomas
37a68060fa commitcloud: prevent race between creating and syncing obsmarkers
Summary:
In order to prevent newly added obsmarkers from being lost while we are syncing
them, we separate out the obsmarkers that we are in the process of syncing into
a separate `syncing` file.  New obsmarkers that are created during sync go into
the `pending` file and are synced on the next sync, which means it's safe to
delete the `syncing` file when sync completes.

Differential Revision: D7932299

fbshipit-source-id: bd86e836ded10e75790b87ca6734a29f068f3571
2018-05-10 03:06:03 -07:00
Mark Thomas
eef982accb commitcloud: add test demonstrating obsmarker race
Summary:
A command that creates obsmarkers while they are being synced can cause the
obsmarkers to be dropped.

In this test, the obsmarker for the rebase restack is lost.

Differential Revision: D7932300

fbshipit-source-id: 11988f2a2c77eed9f9fab258a6623abd8c50e1cd
2018-05-10 03:06:03 -07:00
Mark Thomas
17c3e2dd8f commitcloud: UX improvements
Summary:
Rework the commit cloud commands:

* Arrange them under a top-level `cloud` command.
* Make `join` call `register` if necessary and `sync`.  This gives one-step
  on-boarding.
* Add help text to all commands; clean up existing help text.
* Simplify output a little.

Differential Revision: D7876295

fbshipit-source-id: 1f7c0cabfa3d426ced34b90bdca64bef78d78211
2018-05-04 08:05:42 -07:00
Mark Thomas
88b23256ca commitcloud: push commits when syncing
Summary:
Make commitcloud push unsynced commits to the server before modifying the cloud
state.

At the moment, this uses an infinitepush push, calling the underlying push
functions directly (since commitcloud knows exactly which commits to push,
there is no point performing discovery to calculate them).  Infinitepush pushes
require the full draft stack to be included, but in the future, this will be
replaced with an even smaller push of just the changed commits to Mononoke.

The re-use of infinitepush's internal functions is a bit hacky.  Later on I
will refactor the common functionality out to a utility library.

Reviewed By: StanislavGlebik

Differential Revision: D7535890

fbshipit-source-id: 975028a63bd6d9377a37e224a0cfd95ae1f1e16d
2018-04-16 10:35:14 -07:00
Liubov Dmitrieva
efebe7a94b add move logic to update current rev to its new location (optional)
Summary:
move logic to update current rev to its new location (optional)
we are trying to update only if it is unambiguous

Reviewed By: DurhamG

Differential Revision: D7431940

fbshipit-source-id: 72e7fea7365a231c4d98ceb4cf4872a4db02d9ca
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
de0082660b commit cloud recover state
Summary:
[commitcloud] commit cloud recover state

`hg cloudrecover` command

It might be helpful to have a command like this in cases something goes wrong
with the local state

Reviewed By: DurhamG

Differential Revision: D7417147

fbshipit-source-id: 4b236f2753b1f212ff4881a649032e53e032c66c
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
06bd6c5c91 speed up commitcloud pull many times
Summary: [commitcloud] speed up commitcloud pull many times

Reviewed By: markbt

Differential Revision: D7444195

fbshipit-source-id: 869e31ea3e6b6141c83fc28a605b788d192649be
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
ad6ffda306 join to workspace
Summary: `hg cloudjoin` command

Reviewed By: DurhamG

Differential Revision: D7414658

fbshipit-source-id: b612885bf6226b164a7efd21d9f4166fbf7efd1d
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
e3276c7e7b introduced secure token injection
Summary:
new command `hg cloudregister`

storing user token

Reviewed By: DurhamG

Differential Revision: D7367301

fbshipit-source-id: e8eb3d51cf62e9c1e91c39be45e0ad8b49a74442
2018-04-13 21:51:47 -07:00
Mark Thomas
4cea23b3a9 commitcloud: sync obsmarkers
Summary:
Add obsmarkers to the things that are synced.

For the LocalService, obsmarkers are stored base64-encoded using version 1 of
the obsmarker binary format.  This is sufficient for unit tests.

Differential Revision: D7181399

fbshipit-source-id: 61377105986de561622a160134d20fdbd54bb88f
2018-04-13 21:51:28 -07:00
Mark Thomas
6660438ea2 commitcloud: add basic cloudsync command
Summary:
Adds the initial skeleton of the `commitcloud` extension to Mercurial, which
will synchronise heads and bookmarks (and later, obsmarkers) with commit cloud.

Current limitations:
  - only supports a stub version of the service that uses local files
  - requires manual pushbackup to send commits to the server via infinitepush
  - doesn't do anything with obsmarkers

Differential Revision: D7167715

fbshipit-source-id: 53443f3fb8dff0fe52257d7b20fc601dbe10c883
2018-04-13 21:51:28 -07:00