Commit Graph

43107 Commits

Author SHA1 Message Date
Jun Wu
b0b9ac188f chg: work with illformed envp
Summary:
By using low-level APIs, `environ` could contain ill-formed entries that do
not have the `NAME=VAL` form:

  #define _GNU_SOURCE
  #include <unistd.h>
  char *envp[] = { "X", 0 };
  char *argv[] = { "hg", "log", 0 };
  int main() {
      return execvpe("chg", argv, envp);
  }

Ignore them silently so they won't break chg.

Reviewed By: DurhamG

Differential Revision: D7537406

fbshipit-source-id: 3fef3d656383723d451fbfa29ba9a9fa170311d0
2018-04-13 21:51:48 -07:00
Adam Simpkins
39cd1c0389 fix hg journal to avoid printing non-JSON data with -Tjson
Summary:
Avoid printing "no recorded locations" directly to stdout when a format
template was specified.  In particular this avoids printing non-JSON data
when using `-Tjson`.

We potentially could change this to print to stderr instead.  However for now
I just followed the same pattern of checking the template as was done above for
the "previous locations" message.

Reviewed By: ryanmce

Differential Revision: D7512030

fbshipit-source-id: 2c32f07962fac4ca3d6bfd8f2ca3c4840b2a8a9b
2018-04-13 21:51:48 -07:00
Kostia Balytskyi
4a9c3c59c0 hg: support linking against external libs in setup.py
Summary:
On Windows, the `mman` and `dirent` functionality can be provided by external
libs, which we would not like to mention in the `setup.py`. This change allows
us to to call `setup.py` with the right env and link with the right libs, same
approach as with headers.

Reviewed By: quark-zju

Differential Revision: D7535358

fbshipit-source-id: d0364cb305a9114260106844f9a3575a731419e9
2018-04-13 21:51:48 -07:00
Kostia Balytskyi
14bc2a155c hg: merge common_include_dirs and include_dirs in setyp.py
Summary: We don't really need this separation.

Reviewed By: quark-zju

Differential Revision: D7535364

fbshipit-source-id: a480ddb62883e2e9044e06ff7b27201151632b71
2018-04-13 21:51:48 -07:00
Liubov Dmitrieva
d27069f7cd infinitepush: replace separate single-row DELETE statements with a single DELETE
Summary:
Run single DELETE query instead of using separate single DELETE statements because it is much faster and the common way in mysql world.

One query is better because:

* Only one plan will need to be generated
* Only one transaction will be involved
* Less overhead with ODBC calls and network traffic
*  Any indexes will need to be refreshed just once, not many times.

Reviewed By: StanislavGlebik

Differential Revision: D7526427

fbshipit-source-id: 39f1d4605adb26d8690a9b39e783c792dee6ad87
2018-04-13 21:51:48 -07:00
Liubov Dmitrieva
82169bcf89 reduce number of mysql queries
Summary:
Reduce number of queries for infinitepush

Use bulk INSERT instead of using separate single-row INSERT statements, that is many many times faster.

('executemany' builds a single query for us)
(out max_allowed_packet is about 134M)

One query is better than 'for loop' because:
* Only one plan will need to be generated
* Only one transaction will be involved
* Less overhead with ODBC calls and network traffic
* Any indexes will need to be refreshed just once, not many times.

Reviewed By: StanislavGlebik

Differential Revision: D7504452

fbshipit-source-id: 9b0beb1ff572bf6c7b28892878d91e0cf4897e1f
2018-04-13 21:51:48 -07:00
Mark Thomas
9cc2b1cc64 phabstatus: fix long line
Summary: Fix long line which breaks `test-check-code.t`.

Reviewed By: farnz

Differential Revision: D7532586

fbshipit-source-id: e5add9c9407b34bb3bd4cd701ba491e0e0ce1079
2018-04-13 21:51:48 -07:00
Liubov Dmitrieva
5db9e2748e improve handling 401
Summary:
improve handling http 401 (unauthorized)
happen if token is invalid

Reviewed By: DurhamG, StanislavGlebik

Differential Revision: D7502317

fbshipit-source-id: abc9fdbc6dfad393f2ddf050b686cb6cfce259b6
2018-04-13 21:51:47 -07:00
Liubov Dmitrieva
7e39e14368 fix phabstatus for commit cloud
Summary:
fix `hg ssl` for Commit Cloud

In Commit Cloud world, obstore can sometimes have more knowledge than the unfiltered repo.
For example, in case of many amends on one client, some stuff can not be backed up
and not fetched to another client.
But we don't need to have all obsoleted versions in both repos,
obstore helps us to provide enough information to a user of what has happened
but we need to be carefull with operator []

Reviewed By: DurhamG

Differential Revision: D7516465

fbshipit-source-id: 7e109741829b26c30f20a7528b21b5ebc9b31dde
2018-04-13 21:51:47 -07:00
Kostia Balytskyi
e1f2cac08e hg: use Windows libraries in a way that preserves GetLastError
Summary:
Using windows libs like `_kernel32 = ctypes.windll.kernel32` means that
the `GetLastError` calls are useless.

(1317 is a non-existent process)
```
In [44]: k32 = ctypes.WinDLL('kernel32', use_last_error=True)

In [52]: ctypes.windll.kernel32.OpenProcess(0x0001, False, 1317)
Out[52]: 0

In [53]: ctypes.windll.kernel32.GetLastError()
Out[53]: 0

In [54]: k32.OpenProcess(0x0001, False, 1317)
Out[54]: 0

In [55]: k32.GetLastError()
Out[55]: 5
```

This behavior can explain why we can't auto-delete the stale lock file. See the `testpid` code:
```
def testpid(pid):
    '''return True if pid is still running or unable to
    determine, False otherwise'''
    h = _kernel32.OpenProcess(_PROCESS_QUERY_INFORMATION, False, pid)
    if h:
        try:
            status = _DWORD()
            if _kernel32.GetExitCodeProcess(h, ctypes.byref(status)):
                return status.value == _STILL_ACTIVE
        finally:
            _kernel32.CloseHandle(h)
    return _kernel32.GetLastError() != _ERROR_INVALID_PARAMETER
```

The non-existent `pid` causes `h` to be `0` and `_kernel.GetLastError()` to also be `0` (see above why). This means that we think that this process exists!

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D7519457

fbshipit-source-id: c08f727228073962359e93db13f1fdb76f3699e6
2018-04-13 21:51:47 -07:00
Chad Austin
26464349a5 improve exception message when backupfiles format is invalid
Summary:
When a .backupfiles file is invalid, hg recover gives a not very
useful stack trace.  This makes it a bit easier to debug.

Reviewed By: DurhamG

Differential Revision: D7482578

fbshipit-source-id: e8c7ad73bb14a38d2d43b636d60a3b77cd947331
2018-04-13 21:51:47 -07:00
Martijn Pieters
964bbe67d5 simplecache: correct indentation error, causing an UnboundLocal exception
Summary: When no cache has been set (`simplecache.caches=`) then there's no `name` set either. This exposed a logic error in this section of the code.

Reviewed By: ryanmce

Differential Revision: D7513976

fbshipit-source-id: ecbc7a8ac8c6eb23010d64ab8cbf9f9fb7d8f497
2018-04-13 21:51:47 -07:00
Stanislau Hlebik
84724bbd11 infinitepush: handle reply:changegroup part
Summary:
Currently hg doesn't return anything from processing infinitepush parts.
However, mononoke will treat infinitepush parts just like normal hg parts.
So let's not panic if we see reply:changegroup part

Reviewed By: markbt

Differential Revision: D7513729

fbshipit-source-id: 8417a285bd49efadf2f2ef9ed80ad2f2b6d6bc94
2018-04-13 21:51:47 -07:00
Saurabh Singh
99bff7b6fe hgbuild: write deb packages to a consistent location
Summary:
Currently, the `build_deb.py` writes the packages to the directory
from which the script was invoked. This leads to issues in integrating with our
continuous build setup. Therefore, this commit changes the script to write to a
known location.

Reviewed By: quark-zju

Differential Revision: D7511832

fbshipit-source-id: 85beaf37e92418cae932fd81c72065cf5d64c249
2018-04-13 21:51:47 -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
457c8ba50c infinitepush: handle remote aborts when pushing backup bundles
Summary:
When pushing a backup bundle to the server, check if the response contains an
error, and fail the backup accordingly.

Differential Revision: D7498324

fbshipit-source-id: a08807ac54e9d3044ff1450e93d2a8ea9d6f767f
2018-04-13 21:51:46 -07:00
Mark Thomas
bf2d6f85e3 infinitepush: make max bundle size configurable
Summary:
Add a server-side config option `infinitepush.maxbundlesize` to control the
maximum bundle size (currently 100MB).

Add a test that shows bad behaviour when pushing backups that exceed this size.

Differential Revision: D7498323

fbshipit-source-id: 640478e7a58cb3c39408fe2a24d8d581f14d891c
2018-04-13 21:51:46 -07:00
Jun Wu
ac52e4a6fb indexedlog: add a test against std hashmap for multi-values
Summary: Since we now have the ability to store multiple values. Add a test.

Reviewed By: DurhamG

Differential Revision: D7472880

fbshipit-source-id: 85b1c69245ac7f0c4702daf22a02f5e5072f0924
2018-04-13 21:51:46 -07:00
Jun Wu
de74642bc7 indexedlog: implement value iterator
Summary:
The value type is a linked list of u64 integers. Add an API to expose that.

Using iterator framework has benefits about flexibility - the caller can
take the first value, or convert it to a vector, or count the values, etc.
easily.

Reviewed By: DurhamG

Differential Revision: D7472881

fbshipit-source-id: d31e81770e069734b54fa08729c0cd45a699aae2
2018-04-13 21:51:46 -07:00
Jun Wu
cc4193ba29 indexedlog: handle radix null child correctly
Summary:
This is caught by a later test. Looking up a non-existed child (jumptable
value is 0) returns InvalidData error, while it should return Offset(0).

The added if condition does not seem to have noticeable performance impact:

  index insertion                 3.840 ms
  index flush                     3.740 ms
  index lookup (memory)           1.085 ms
  index lookup (disk, no verify)  1.972 ms
  index lookup (disk, verified)   7.752 ms

Reviewed By: DurhamG

Differential Revision: D7472882

fbshipit-source-id: 1cc51e9afa248e123cca9c561d7bb2128fd898b1
2018-04-13 21:51:46 -07:00
Jun Wu
b82b0daab5 indexedlog: make LinkOffset also return next link offset
Summary:
Previously, the code was focusing on getting the hardest (index) part right,
but less about the value part. There is no way to get all values in the
linked list, as designed, yet. This diff starts the work.

Similar to `KeyOffset::key_and_link_offset`, change the internal API of
LinkOffset to return both value and the next link offset.

Reviewed By: DurhamG

Differential Revision: D7472879

fbshipit-source-id: 4a4512d7c63abbb667146de582e0f8cd04c9c04a
2018-04-13 21:51:46 -07:00
Jun Wu
b9b1f1e907 indexedlog: use OpenOptions
Summary:
`Index::open` now takes too many parameters, which is not very convenient to
use. Inspired by `fs::OpenOptions`, use a dedicated strut for specifying
open options.

Motivation: To test checksum ability more confidently, I'd like to write
something that randomly mutates 1 byte from a sane index. To make sure the
checksum coverage is "correct", checksum chunk size is another parameter.

Reviewed By: DurhamG

Differential Revision: D7464182

fbshipit-source-id: 469ce7d1cfa5de3946028418567a9f3e2bc303fa
2018-04-13 21:51:46 -07:00
Jun Wu
6cb2b1dd23 indexedlog: make OffsetMap::get have no assumption about offset
Summary:
Address DurhamG's review comment on D7422832.

Previously, `OffsetMap::get` expects a dirty offset. That's because it was
changed from `HashMap` and we don't control `HashMap::get`. It's cleaner to
let `OffsetMap` do the `is_dirty` check.

Reviewed By: DurhamG

Differential Revision: D7461707

fbshipit-source-id: 9f2abdf6c6f993d98d9443f16bafcc6154ee0dbb
2018-04-13 21:51:46 -07:00
Jun Wu
9787cfc15b indexedlog: add more tests about leaf split
Summary:
The new test covers the `else` branch inside `LeafOffset::set_link`
previously not covered.

Coverage was checked by the following script:

```
from __future__ import absolute_import

import glob
import os
import shutil

os.system('cargo rustc --lib --profile test -- -Ccodegen-units=1 -Clink-dead-code -Zno-landing-pads')
path = max((os.stat(path).st_mtime, path) for path in glob.glob('./target/debug/*-????????????????'))[1]
shutil.rmtree('target/kcov')
os.system('kcov --include-path $PWD/src --verify target/kcov %s' % path)
```

Reviewed By: DurhamG

Differential Revision: D7446902

fbshipit-source-id: 293da2ff53b83c8f11534f0f8e5e7fd102216a01
2018-04-13 21:51:46 -07:00
Jun Wu
5209e8360b indexedlog: support external keys
Summary:
Change `insert_advanced` to accept an enum that could be either a key, or an
(offset, len) that refers to the external key buffer.

Insertion becomes slower due to new flexibility overhead.  For some reason,
"index lookup (no verify)" becomes faster (restores pre-D7440248 performance):

  index insertion                 6.434 ms
  index flush                     3.757 ms
  index lookup (memory)           1.068 ms
  index lookup (disk, no verify)  1.969 ms
  index lookup (disk, verified)   7.805 ms

With 2M 20-byte keys, the non-external key version generates a 105MB index:

  seconds operation
  1.247   insert
  0.622   flush
  1.859   flush done
  0.702   lookup (without checksum)
  1.395   lookup (with checksum)

Using external keys,the index is 70MB, and time for each operation:

  seconds operation
  1.086   insert
  0.702   flush
  0.665   lookup (without checksums)
  1.602   lookup (with checksums)

The external key will have more space wins for longer keys, ex. file path.

`Index` module was made public so `InsertKey` type is usable.

Reviewed By: DurhamG

Differential Revision: D7444907

fbshipit-source-id: b89d95246845799c2c55fb73ad203a7e6724b85e
2018-04-13 21:51:46 -07:00
Jun Wu
36dfda984c indexedlog: relax leaf entry's key offset type
Summary:
Previously, a leaf entry can only have a `KeyOffset`. This diff makes it
possible to be either `KeyOffset`, or `ExtKeyOffset`. The API didn't change
much since `LeafOffset::key_and_link_offset` handles the difference
transparently.

Latest benchmark result:

  index insertion                 4.879 ms
  index flush                     3.620 ms
  index lookup (memory)           1.827 ms
  index lookup (disk, no verify)  3.508 ms
  index lookup (disk, verified)   7.861 ms

Reviewed By: DurhamG

Differential Revision: D7444909

fbshipit-source-id: 5441e1ae187d42931377d7213dcb77156b2af714
2018-04-13 21:51:46 -07:00
Jun Wu
44a0998bc6 indexedlog: let leaf entry return key content
Summary:
The leaf entry has a `key_and_link_offset` method. Previously it returns a
`KeyOffset`, since we now have `ExtKeyOffset`, it's friendly to handle the
key entry type difference at the leaf entry level, instead of requiring the
caller to handle it.

Reviewed By: DurhamG

Differential Revision: D7444905

fbshipit-source-id: 56d87641a2a5a50ddca8b1e4c74c9aaa3891b542
2018-04-13 21:51:46 -07:00
Jun Wu
1294c1b471 indexedlog: add an "external key" entry type
Summary:
Previously, I thought there is only one index that will use "commit hash" as
keys, that is the nodemap, and other indexes (like childmap) would just use
shorter integer keys (ex. revision number, or offsets). So the space overhead
of storing full keys only applies to one index and seems acceptable.

But that implies strict topo order for the source of truth data (ex. to use
integers as keys in childmap, you have to know how to translate parent
revisions from hashes to integers at the time writing the revision).

Thinking about it again, it seems the topo-order requirement would make a lot
of things less flexible. It's much easier to just use hashes as keys in the
index. Then it's worthwhile to address the space efficiency problem by
introducing an "external key buffer" concept. That's actually what `radixbuf`
does.

This is the start. It adds the type to the strcut. The feature is not completed
yet.

Reviewed By: DurhamG

Differential Revision: D7444904

fbshipit-source-id: 60a83c9e6e8b0734450f0c5827928a7c5bd111d5
2018-04-13 21:51:45 -07:00
Phil Cohen
9fb4c786a9 datapack: add yieldall (default False) to iterentries
Summary:
A subsequent diff will need access to the node's diff and meta during iteration time. It seems like a
natural part of the API so let's add it.

Note: It's possible to call `.getdelta(name, node)` to get this data if we don't read it here.
But I ran into some weird occassional OSErrors from the mmap API when I did that. So let's just
do this.

Reviewed By: DurhamG

Differential Revision: D7369225

fbshipit-source-id: 252839a549242909153c74287db8f36d6c63bd9c
2018-04-13 21:51:45 -07:00
Durham Goode
32ac5d0647 hg: make pull use the connectionpool
Summary:
This makes hg pull use the connectionpool. This means prefetches can
reuse the existing ssh connection when appropriate. This both speeds up
prefetches, and also means they will speak to the same server that served the
pull.

Reviewed By: ryanmce

Differential Revision: D7481107

fbshipit-source-id: f9a3670527cb7e8956029c86d50d8e030dd3cc01
2018-04-13 21:51:45 -07:00
Durham Goode
77de196aa5 hg: move connectionpool to core Mercurial
Summary:
Previously the connectionpool was a remotefilelog specific concept. We
want to start sharing connections between pull and prefetches, so let's move it
to core Mercurial.

Reviewed By: ryanmce, phillco

Differential Revision: D7480670

fbshipit-source-id: 1b2eff3b0e61a815709ffaec35df802eeda0c24b
2018-04-13 21:51:45 -07:00
Mark Thomas
9e898effa5 debugcommands: show fallback colors in debugcolor --style
Summary:
`hg debugcolor --style` shows the component parts of each style individually,
however this doesn't work if the styles are defined as the new fallback styles
(separated by colons).  This is because the fallback is only implemented for
actual style names - it doesn't work for `ui.label('brightblue:blue', 'text')`.

It's usefule to see what the fallbacks are (even if they're not necessary on
your own system), so change debugcolor to split the elements of the fallback
style and show them separately.

Reviewed By: quark-zju

Differential Revision: D7485545

fbshipit-source-id: dce7204c9f0a98bb730b3ba864db28a9ec52a339
2018-04-13 21:51:45 -07:00
Martijn Pieters
0aa55642b8 hg: make sure len(manifest) always raises TypeError
Summary:
`len()` on a hybrid manifest wrapping a treemanifest would raise an attribute error. But if there is no treemanifest or there is *only* a treemanifest, then a TypeError is raised. Using `len()` on an object that doesn't support length should always raise `TypeError`, consistently.

Instead of looking up the `__len__` attribute, use the built-in `len()` function, which will raise `TypeError` if the wrapped manifest in a hybrid doesn't have a `__len__` method. This ensures that we get a consistent exception.

Reviewed By: farnz

Differential Revision: D7485510

fbshipit-source-id: 4132d6b383171cde8dd99dd60098716d4aedc527
2018-04-13 21:51:45 -07:00
Mark Thomas
6ea1e7437d clienttelemetry: correctly log full command line
Summary:
The full command line needs to come from the `dispatch.runcommand` function, as
`sys.argv` contains `serve ...` for chg invocations.

Also make sure the correlator remains the same for commands that make multiple
connections to the server.

Reviewed By: quark-zju

Differential Revision: D7443727

fbshipit-source-id: a785e372b7b67fbd0b4ab4d73e7ff914aa5db9c3
2018-04-13 21:51:45 -07:00
Mark Thomas
12e35a491c remotefilelog: use correct parameter name in peer override
Summary:
`remotefilelog.fileserverclient.peersetup.remotefilepeer` overrides the
`_callstream` method, however it uses `command` rather than `cmd` for the first
parameter name.  This doesn't match the method it's overriding, and clashes
with clienttelemetry's use of this parameter for the original command that the
user ran.

Make this method match all the others.

Reviewed By: quark-zju

Differential Revision: D7443726

fbshipit-source-id: 1170feb21056c3e044bffaf55d95f7c48ff972fb
2018-04-13 21:51:45 -07:00
Jun Wu
d0886b9b94 gitignore: add a config option
Summary:
gitignore could have performance issues stating .gitignore files everywhere.
That happens if watchman returns O(working copy) files. Add a config to
disable it as we're finding solutions.

Reviewed By: DurhamG

Differential Revision: D7482499

fbshipit-source-id: 4c9247b0318bf034c8e9af4b74c21110cc598714
2018-04-13 21:51:45 -07:00
Alexandre Marin
1b393dbae1 Get file contents from local storage if possible
Summary:
Turns out I incorrectly assessed this situation before. We do use content from
perforce servers a lot. This change makes p4seqimport read from local disk
directly if possibel rather than resorting solely on `p4 print` to obtain file content.

```name=Checking file content src on master-importer task 0 (running for 15h+)
[15:40:23 twsvcscm@priv_global/independent_devinfra/ovrsource-master-importer/0 ~]$ egrep -o 'src: (gzip|rcs|p4)' /logs/stdout | sort | uniq -c
   2567 src: gzip
     24 src: p4
```

Differential Revision: D7388797

fbshipit-source-id: 5fe1a525bc211d64a75954d529edc152d22970a7
2018-04-13 21:51:45 -07:00
Phil Cohen
502ebf39fb add mutablepack.destpath, set once a pack gets written
Summary:
Subsequent commits will need the new path of a mutable{data, hist}pack -- this makes
that data accessible.

Reviewed By: DurhamG

Differential Revision: D7369226

fbshipit-source-id: f6849aaed747fbd9afee7191e6a0e5e1357ca618
2018-04-13 21:51:45 -07:00
Durham Goode
e53a3e253a hg: don't use statvfs when it's not available
Summary: fastmanifest used the statvfs function to be smart about how much disk space it used. That function isn't available on windows though. This optimization is optional, and we probably won't end up using the fastmanifest cache on windows anyways, so let's just skip it if its not available.

Reviewed By: quark-zju

Differential Revision: D7478478

fbshipit-source-id: e9595f3fef397d66d76f3ecfa54f8e4328ce0921
2018-04-13 21:51:45 -07:00
Alexandre Marin
d3523cdc77 Feedback
Summary:
dsp had a look at the whole stack and suggested some changes:

* Only write bookmark once at the end of the import - we are doing a single transaction anyways so updating the bookmark after every changelist import is moot
* Remove unused function seqimporter.ChangelistImporter._safe_open
* Require fncache to preserve behavior from p4fastimport

Differential Revision: D7375481

fbshipit-source-id: f4407d5d0276f96d72bf67544091640fe1c46044
2018-04-13 21:51:44 -07:00
Alexandre Marin
275306c97a importer - use seqimport
Summary: Updates the importer wrapper to use the new p4seqimport, replacing p4fastimport.

Differential Revision: D7326764

fbshipit-source-id: 588486bfd747086396f47e678da05c6eafd30565
2018-04-13 21:51:44 -07:00
Alexandre Marin
b807fcb05d Make it work with remotefilelog
Summary:
When testing p4seqimport with remotefilelog it would barf on call to `.tip()`,
because remotefilelog doesn't have that.

This change makes use of the change context from the repo instead to get the
tip node.

Differential Revision: D7294979

fbshipit-source-id: 18b4a5107f4cbf676016d44d5134bf0d252eeff3
2018-04-13 21:51:44 -07:00
Alexandre Marin
738df53c01 Test branching
Summary:
Testing that p4seqimport works properly for branching
Based on comment on D7172867

For a high-level overview of p4seqimport, please check https://our.intern.facebook.com/intern/wiki/IDI/p4seqimport/

Differential Revision: D7203765

fbshipit-source-id: 2e328f5b43fc47a60bfe2c41f9454f8471dda814
2018-04-13 21:51:44 -07:00
Alexandre Marin
9e6c6e4e3f Handle p4 keyworded files
Summary:
Perforce supports RCS keyworded files, more info here:
http://answers.perforce.com/articles/KB/3482

We replace things back in p4fastimport, this replicates the behavior in
p4seqimport (unit test should clarify what this means)

Differential Revision: D7188163

fbshipit-source-id: 594f71d6114c73001753ae36c4973c2db3310e62
2018-04-13 21:51:44 -07:00
Alexandre Marin
d4c8ee992a Track executable files
Summary:
Respect the executable bit on files based on perforce type.

For a high-level overview of p4seqimport, please check https://our.intern.facebook.com/intern/wiki/IDI/p4seqimport/

Differential Revision: D7185388

fbshipit-source-id: 59afec7bd857572b8347ebe546d131017a79928c
2018-04-13 21:51:44 -07:00
Alexandre Marin
e2fc55f8a6 Use memctx to create commit without working copy
Summary:
p4seqimport has used very high level mercurial abstractions so far (almost
equivalent to running hg add / mv / rm / commit on command line). This is very
easy to grasp as we use it day to day. It is not performant enough for our
importer:
- It does the work twice (write to working copy, then commit changing hg metadata)
- It requires the working copy (this would force us to update between revs,
  materializing a prohibitively large number of files)

This change makes use of memctx, which is basically an in-memory commit. This way
we don't need a working copy and we save time + a lot of space.

For a high-level overview of p4seqimport, please check https://our.intern.facebook.com/intern/wiki/IDI/p4seqimport/

Differential Revision: D7176903

fbshipit-source-id: 2773d7c001b615837496ea9db3229d9afc020124
2018-04-13 21:51:44 -07:00