Commit Graph

42592 Commits

Author SHA1 Message Date
Jun Wu
f1c575a099 flake8: enable F821 check
Summary:
This check is useful and detects real errors (ex. fbconduit).  Unfortunately
`arc lint` will run it with both py2 and py3 so a lot of py2 builtins will
still be warned.

I didn't find a clean way to disable py3 check. So this diff tries to fix them.
For `xrange`, the change was done by a script:

```
import sys
import redbaron

headertypes = {'comment', 'endl', 'from_import', 'import', 'string',
               'assignment', 'atomtrailers'}

xrangefix = '''try:
    xrange(0)
except NameError:
    xrange = range

'''

def isxrange(x):
    try:
        return x[0].value == 'xrange'
    except Exception:
        return False

def main(argv):
    for i, path in enumerate(argv):
        print('(%d/%d) scanning %s' % (i + 1, len(argv), path))
        content = open(path).read()
        try:
            red = redbaron.RedBaron(content)
        except Exception:
            print('  warning: failed to parse')
            continue
        hasxrange = red.find('atomtrailersnode', value=isxrange)
        hasxrangefix = 'xrange = range' in content
        if hasxrangefix or not hasxrange:
            print('  no need to change')
            continue

        # find a place to insert the compatibility  statement
        changed = False
        for node in red:
            if node.type in headertypes:
                continue
            # node.insert_before is an easier API, but it has bugs changing
            # other "finally" and "except" positions. So do the insert
            # manually.
            # # node.insert_before(xrangefix)
            line = node.absolute_bounding_box.top_left.line - 1
            lines = content.splitlines(1)
            content = ''.join(lines[:line]) + xrangefix + ''.join(lines[line:])
            changed = True
            break

        if changed:
            # "content" is faster than "red.dumps()"
            open(path, 'w').write(content)
            print('  updated')

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
```

For other py2 builtins that do not have a py3 equivalent, some `# noqa`
were added as a workaround for now.

Reviewed By: DurhamG

Differential Revision: D6934535

fbshipit-source-id: 546b62830af144bc8b46788d2e0fd00496838939
2018-04-13 21:51:09 -07:00
Jun Wu
0daed9e7f6 flake8: resolve some F checks
Summary:
Solves issues below:
```
hgext/backups.py:18:1: F811 redefinition of unused 'registrar' from line 17
hgext/catnotate.py:1:1: F811 redefinition of unused 'util' from line 1
hgext/remotenames.py:57:5: F811 redefinition of unused 'registrar' from line 34
hgsubversion/setup.py:103:5: F401 'mercurial' imported but unused
hgsubversion/setup.py:109:5: F401 'hgsubversion.svnwrap.svn_swig_wrapper' imported but unused
i18n/polib.py:1281:29: F841 local variable 'exc' is assigned to but never used (Python 2)
i18n/polib.py:1427:13: F841 local variable 'typ' is assigned to but never used
i18n/polib.py:28:1: F401 'sys' imported but unused
mercurial/manifest.py:411:5: F811 redefinition of unused '_lazymanifest' from line 168
mercurial/posix.py:419:5: F811 redefinition of unused 'normcasefallback' from line 362
mercurial/posix.py:425:5: F811 redefinition of unused 'checkexec' from line 167
mercurial/posix.py:431:5: F811 redefinition of unused 'checklink' from line 234
mercurial/pycompat.py:29:5: F401 'http.cookiejar as cookielib' imported but unused
mercurial/pycompat.py:30:5: F401 'http.client as httplib' imported but unused
mercurial/pycompat.py:31:5: F401 'pickle' imported but unused
mercurial/pycompat.py:33:5: F401 'socketserver' imported but unused
mercurial/pycompat.py:34:5: F401 'xmlrpc.client as xmlrpclib' imported but unused
mercurial/statprof.py:573:36: F812 list comprehension redefines 'parent' from line 562 (Python 2)
mercurial/util.py:1076:5: F811 redefinition of unused 'nogc' from line 1051
mercurial/util.py:3221:5: F811 redefinition of unused 'dirs' from line 3184
tests/silenttestrunner.py:24:5: F811 redefinition of unused 'main' from line 6
tests/test-context.py:90:1: F811 redefinition of unused 'scmutil' from line 4
tests/test-fb-hgext-cstore-treemanifest.py:146:5: F811 redefinition of unused 'testDeeplyNested' from line 134
tests/test-fb-hgext-extutil.py:46:5: F811 redefinition of unused 'testbgcommandfailure' from line 37
tests/test_hgsubversion_util.py:47:1: F811 redefinition of unused 'svnwrap' from line 31 (Python 2)
tests/test_hgsubversion_util.py:49:1: F811 redefinition of unused 'svnwrap' from line 47 (Python 2)
```

Reviewed By: ryanmce

Differential Revision: D6934533

fbshipit-source-id: 8b51851a76fec88bb59107ed05a901d42c7326f8
2018-04-13 21:51:09 -07:00
Kostia Balytskyi
6f179126c7 hg: on Windows, use mmap with explicit ACCESS_READ argument passed
Summary:
On Windows, the intended access to the file handle must align with the
intended access to the memory mapping object, see [1].

When called without and argument, Python's `mmap.mmap` on Windows assumes
`ACCESS_WRITE` mode[3], therefore we get failures like [2] in Lego Windows.

[1]
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366537(v=vs.85).aspx

[2] P59034213

[3] https://docs.python.org/2/library/mmap.html

Reviewed By: quark-zju

Differential Revision: D6952583

fbshipit-source-id: 93159f8282e27d3e62d859f4c220e7c3bdfbe958
2018-04-13 21:51:09 -07:00
Jun Wu
f5924da1d3 tests: improve test compatibility with different zlib
Summary:
When running with a Python runtime with a slightly different zlib module,
some `zlib.compress` outputs are different. Some tests are testing the
length, or the content of `zlib.compress` output, directly or indirectly.
That's causing issues.

This patch adds a `common-zlib` hghave test so it can be used to gate tests
checking zlib output. Some lengths are also changed to glob patterns to be
compatible.

Reviewed By: ryanmce

Differential Revision: D6937735

fbshipit-source-id: 2328a39d7f2022f16d51f61b6178568b26dfe2fb
2018-04-13 21:51:09 -07:00
Jun Wu
c9f1645a98 check-code: fix foo_bar naming detection and add a whitelist
Summary:
This patch fixes the regex. There are too many methods with underscores.
So a whitelist was added to avoid unnecessary churn of line numbers in
test-check-code.t.

Reviewed By: ryanmce

Differential Revision: D6937917

fbshipit-source-id: 9b7816278fc6f414c21f921b67d1cbb6a735a30f
2018-04-13 21:51:09 -07:00
Jun Wu
d56ebc52af buck: fix tests with opt build
Summary: D6937883 turns out to be ineffective. Let's fix it in another way.

Reviewed By: DurhamG

Differential Revision: D6940006

fbshipit-source-id: 082d0ddcf464d7056426bde2feab52a7717eb057
2018-04-13 21:51:09 -07:00
Jun Wu
2946a1c198 codemod: use single blank line
Summary: This makes test-check-code cleaner.

Reviewed By: ryanmce

Differential Revision: D6937934

fbshipit-source-id: 8f92bc32f75b9792ac67db77bb3a8756b37fa941
2018-04-13 21:51:08 -07:00
Jun Wu
e3bbd1757c serve: assign hg serve ports dynamically (part 2)
Summary:
This is similar to what D6925398 does. But covers areas that D6925398 missed
because the codemod script wasn't able to handle multiple-line `hg serve`
commands.

Reviewed By: DurhamG

Differential Revision: D6937919

fbshipit-source-id: a67de178527c11a0ed8bbac82f0c46d44b81be77
2018-04-13 21:51:08 -07:00
Jun Wu
b8967f2eef extensions: disable foreign import check if non-standard layout
Summary:
It seems the non-standard xar layout could conflict with the foreign
import check somehow.

Reviewed By: singhsrb

Differential Revision: D6937883

fbshipit-source-id: b7c4dfc6836f6f1c8a693775dc42c16c537dc8e6
2018-04-13 21:51:08 -07:00
Mark Thomas
7c9dff743f fsmonitor: use progress.spinner when querying watchman
Summary:
Watchman operations can take a long time if watchman is initializing and
crawling all the directories.  Inform the user of this by showing a spinner.

Reviewed By: farnz

Differential Revision: D6937078

fbshipit-source-id: 26455235828eefdd598d773b5c919c165146a170
2018-04-13 21:51:08 -07:00
Mark Thomas
d89367ab90 progress: add spinner context manager for easy spinners
Summary:
Some actions can take a long time, and not all of them have progress bars.
When this happen the user is left with an empty prompt and doesn't know that
Mercurial is actually working.

This adds a context manager which can be used to give long-running processes a
spinner-style progress bar, indicating that something is happening in the
background.

Reviewed By: farnz

Differential Revision: D6937079

fbshipit-source-id: 396d7b11157b4f13e0c12dac1e2403d9269938ab
2018-04-13 21:51:08 -07:00
Mark Thomas
eb36f462bf check-commit: remove test-check-commit
Summary:
`test-check-commit` gives false positives for some commits.  Remove it.

Facebook
The commits that give false positives include commits that are outside of
`fbcode/scm/hg`.

Reviewed By: quark-zju

Differential Revision: D6819543

fbshipit-source-id: ddfaae7350d4ad6503b7a7ec22e899bb7ae743df
2018-04-13 21:51:08 -07:00
Jun Wu
ad26d27bc8 flake8: enable part of flake8 checks
Summary:
Previously the linter is disabled. It's still nice to have it detect obvious
errors. So let's enable a subset of the warnings that won't complain the
current codebase.

I have put an `#` before warnings that could be useful but are incompatible
with the current code base. We can fix them later.

hgsubversion tests are excluded explicitly for now to reduce the files that
need cleanup.

Reviewed By: ryanmce

Differential Revision: D6934532

fbshipit-source-id: b2b29139cb3cb3c70a9cdeb9dc29074a7217a828
2018-04-13 21:51:08 -07:00
Jun Wu
874b872352 test-contrib-check-commit: update the test
Summary:
Should be part of D6928820. This was not noticed since contrib/* and .t
changes did not trigger buck test.

Reviewed By: DurhamG

Differential Revision: D6933803

fbshipit-source-id: 0e7465f2440d2346418a1bf6ea21732a71cdf79f
2018-04-13 21:51:08 -07:00
Durham Goode
6b35de4f33 hg: fix initial commits in treeonly repos
Summary:
Previously we weren't able to commit right after creating a treeonly
repository. This was caused by the code attempting to read the null tree from
the store, which doesn't exist. The fix is to handle the null case and return an
empty tree instead of trying to look it up in the store. We already do this in a
number of other cases, so this was just a missing one.

Reviewed By: singhsrb

Differential Revision: D6930919

fbshipit-source-id: e227612be2640282eb997f4d563102d86f0be43a
2018-04-13 21:51:08 -07:00
Jun Wu
88dccd4a14 test-check: port some check-commit rules to check-code
Summary:
Port the double blank line and "foobar" naming rules to check-code.
check-commit checks "changes" while check-code checks "snapshot".

Checking changes would have a couple of disadvantages:
- No check after code is committed
- Could have difficulity dealing with commits involving other changes
  in a mono repo.

Facebook
Context: https://fb.facebook.com/groups/scm/permalink/1558174000898881

Reviewed By: DurhamG

Differential Revision: D6928820

fbshipit-source-id: 9ea998731778150b60112840bce702d9584ba15b
2018-04-13 21:51:08 -07:00
Jun Wu
3d51e478ca test-remotefilelog-http: do not test zstd capability
Summary: This makes the test pass using a build without zstd.

Reviewed By: DurhamG

Differential Revision: D6928821

fbshipit-source-id: 68e858aa2d4e86c0271cd339385cc49179d97d92
2018-04-13 21:51:08 -07:00
Jun Wu
00d45cbaed copytrace: do not use anydbm.get
Summary:
`db.get(x)` is not implemented for `gdbm` object.
Use `db[x]` instead.

Reviewed By: DurhamG

Differential Revision: D6928822

fbshipit-source-id: 513aaae47708c64427c9dc499798963da0863043
2018-04-13 21:51:07 -07:00
Jun Wu
4a7b28d08b serve: assign hg serve ports dynamically in tests
Summary:
Previously `hg server` uses `HGPORT` that might be in use. This patch uses
`-p 0 --port-file ...` so `hg server` always gets assigned a free port.

The change was first made by the following Ruby script:

```
re = /^  \$ hg serve(.*) -p \$(HGPORT[12]?) (.*[^\\])$\n  \$/
Dir['*.t'].each do |path|
  old = File.read(path)
  new = old.lines.map do |l|
    next l if l[/\(glob\)/] or not l['$HGPORT'] or l[/^  [$>]/]
    "#{l.chomp} (glob)\n"
  end.join.gsub re, <<-'EOS'.chomp
  $ hg serve\1 -p 0 --port-file $TESTTMP/.port \3
  $ \2=`cat $TESTTMP/.port`
  $
  EOS
  File.write(path, new) if old != new
end
```

Then there are some manual changes:

run-tests.py: It now treats `$HGPORT` in output as glob pattern `*`, since
it does not know the assigned value in tests.

test-bookmarks-pushpull.t, test-https.t: Some `hg pull`s were changed to use
explicit paths instead of relying on `.hgrc` since the test restarts the
server and `.hg/hgrc` having an outdated URL.

test-schemes.t: The test writes `$HGPORT` to `.hgrc` before assigning it.
Changed the order so the correct `$HGPORT` is written.

test-patchbomb-tls.t: Changed `(?) (glob)` to `(glob) (?)`.

Reviewed By: DurhamG

Differential Revision: D6925398

fbshipit-source-id: d5c10476f43ce23f9e99618807580cf8ba92595c
2018-04-13 21:51:07 -07:00
Jun Wu
bc139eb86b hgweb: add --port-file flag
Summary:
This allows us to specify `-p 0 --port-file X` to get the port assigned in
an atomic way. So there won't be "server failed to start" caused by race
conditions in tests.

Reviewed By: DurhamG

Differential Revision: D6925397

fbshipit-source-id: 5bbb61b7eb2695f0a673afdb0730d2a61827f8b3
2018-04-13 21:51:07 -07:00
Ryan McElroy
694229631f phabstatus: TypeErrors are no longer thrown
Summary:
We've now fixed the bugs that caused TypeErrors to show up at the
caller level, so we can remove catching them.

Reviewed By: DurhamG

Differential Revision: D6826615

fbshipit-source-id: 00efba751445164b81ec361a6883ace9cb032505
2018-04-13 21:51:07 -07:00
Ryan McElroy
297c6ce041 phabstatus: remove O(n^2) double loop
Summary:
This was unneeded. We can just populate the dict directly.
Note that now we catch any errors in the expected data format gracefully
and no longer stack trace with bad inputs.

Reviewed By: DurhamG

Differential Revision: D6826455

fbshipit-source-id: adc9cc1fc4895f3c67b112d914f566601336ce3b
2018-04-13 21:51:07 -07:00
Ryan McElroy
57daa71514 phabstatus: remove bad early exit
Summary:
This would cause us to return data outside of our contract, which
crashes in a worse, less useful way that if we catch things ourselves and
print useful debug information.

Reviewed By: quark-zju

Differential Revision: D6826454

fbshipit-source-id: 9cdb2987f762c98c6167ffcea03545bc46eb2119
2018-04-13 21:51:07 -07:00
Ryan McElroy
8cb6affc20 phabstatus: add two more tests showing unhandled errors
Summary: These cause tracebacks; grepped out for readability.

Reviewed By: DurhamG

Differential Revision: D6826450

fbshipit-source-id: 4ea27f0f30cd9ab97710a234f5a451912ccc55c1
2018-04-13 21:51:07 -07:00
Ryan McElroy
389ac72c31 phabstatus: mock full graphql response
Summary:
This will allow us to expose bugs in the graphql client code and
write tests to prevent future regressions. Note that this exposes a KeyError
bug when the response is malformed.

Having finally, we have arrived at full graphql responses both from the real
system and from mocking. We can now write tests more confidently.

Reviewed By: DurhamG

Differential Revision: D6826452

fbshipit-source-id: 4fd246fbafb353ce0138289262cbdfd0e9e35229
2018-04-13 21:51:07 -07:00
Ryan McElroy
83dd5f6841 phabstatus: no longer mock unused fields
Summary:
I do not know why all of these fields that we never checked were
mocked in the fist place.

Reviewed By: DurhamG

Differential Revision: D6826457

fbshipit-source-id: 78d336940b6146b61684c7789172298497c0b57f
2018-04-13 21:51:07 -07:00
Ryan McElroy
9c0bd152ae phabstatus: reverse mock order to prevent O(n^2) behavior
Reviewed By: DurhamG

Differential Revision: D6826451

fbshipit-source-id: dd14dbed5e1e018fd67e6f2ff2a6e2c6caf1c031
2018-04-13 21:51:07 -07:00
Ryan McElroy
3fe4fbbda9 phabstatus: expand test to cover more code
Summary:
Previously, we mocked returns from the code that processed the
graphql data, but that code has some bugs that were therefore not testable.
Here we move the tests to return mock graphql data, so we can also test the
processing functions. In future commits, we will fix some of the possible
issues.

Reviewed By: DurhamG

Differential Revision: D6826453

fbshipit-source-id: 5a390723e48ccf2477295602dd85bd065c072bd3
2018-04-13 21:51:07 -07:00
Ryan McElroy
f9de59f662 phabstatus: reindent query
Summary: Separate commit to make previous one easier to review

Reviewed By: quark-zju

Differential Revision: D6826448

fbshipit-source-id: 95ee95887476ae3f718265aa26605e7dbb7799e6
2018-04-13 21:51:06 -07:00
Ryan McElroy
264617b4d6 phabstatus: refactor graphql code into sub-functions
Summary:
In future commits, we want to make the test mock actual wire results
from graphql, not just the final results from the processing function. This
is a step in that direction.

Reviewed By: DurhamG

Differential Revision: D6826456

fbshipit-source-id: 529b17f8068506d38e87e18aa9974f478c87a206
2018-04-13 21:51:06 -07:00
Ryan McElroy
e194006ddb phabstatus: catch TypeErrors thrown from revision lookup code
Summary:
In T25434376, we see that this data can in some cases be None, and when
we index into None, we get a TypeError:

```
'NoneType' object has no attribute '__getitem__'
```

I re-arranged the except statements and added TypeError to the second one.
I'm not totally happy with this since it's a programming error not actually
well dealt with, but this is the quickest fix. Future commits will fix things
more thoroughly.

Reviewed By: DurhamG

Differential Revision: D6826446

fbshipit-source-id: a21abba25817b746cb77a1f652ed15a189fce8fe
2018-04-13 21:51:06 -07:00
Ryan McElroy
0b734e33e7 phabstatus: use shorter query alias for ssl lookup
Summary:
Mostly this just makes the lookups nicer to write. In a future commit,
we'll be wrapping more of these in try/catch blocks so the shorter lines will
really help.

Reviewed By: DurhamG

Differential Revision: D6826447

fbshipit-source-id: e07494176a09e1ec22fb70dfc34cf029d152d254
2018-04-13 21:51:06 -07:00
Jun Wu
4c44fcc611 revlog: calculate rawsize correctly when applying deltas
Summary: This fixes the `hg verify` issue.

Reviewed By: DurhamG

Differential Revision: D6920596

fbshipit-source-id: 4a777f182b58acf29a62d50aca65d668b307e5b3
2018-04-13 21:51:06 -07:00
Jun Wu
0ee42bec7e test-lfs-bundle: add hg verify
Summary:
This reveals an issue where rawsize stored in revlog could
be wrong.

Reviewed By: DurhamG

Differential Revision: D6920597

fbshipit-source-id: c195d2613c06455204cc59497bfb97aa963c529a
2018-04-13 21:51:06 -07:00
Adam Simpkins
ee2ff2f2bd help: don't crash when trying to display help for disabled commands
Summary:
Check to see if the module documentation is None before trying to call
`splitlines()` on it.

Reviewed By: singhsrb

Differential Revision: D6919043

fbshipit-source-id: 93c458cde9643a3f1b2d6fe6eb56fa312ae2a192
2018-04-13 21:51:06 -07:00
Kostia Balytskyi
662ade9719 hg: make sure blocked times logged during atexit handlers are logged
Summary:
Previosuly, we would miss anything logged in the `ui.atexit`-registered
handler, since the actual logging would happen before those handlers were
called.

Reviewed By: quark-zju

Differential Revision: D6912321

fbshipit-source-id: 77600b7ae535b4da56fef1f92b51998de8e304e2
2018-04-13 21:51:06 -07:00
Jun Wu
49cbfb1878 filelog: allow trading file history correctness for performance
Summary:
With certain setup, the file history could be incorrect. That makes
`adjustlinknode` much slower since it has to scan the full history.
It is extremely slow if there is a commit with a massive renames.

This is undesirable since `hg log FILE` would give a wrong result.
But it does make the repo usable. Automation that does not care
about `hg log FILE` correctness can probably enable this relatively
safely.

This patch changes both shallow and full repos.

Reviewed By: DurhamG

Differential Revision: D6912051

fbshipit-source-id: 23d6f6c8dd91d4f72b43bc560cf26686bd6c4b47
2018-04-13 21:51:06 -07:00
Jun Wu
7c49ae28cf test-help: update text with sigtrace change
Reviewed By: DurhamG

Differential Revision: D6916334

fbshipit-source-id: 33e6f11d5156bc9bdf2fd8395dfab7cb372dc5a2
2018-04-13 21:51:06 -07:00
Durham Goode
297d368e38 hg: fix unbounded manifest memory usage during pushrebase
Summary:
During pushrebase we graft each commit one by one onto the destination
commit. To do so we iterate over the list of changectx's in variable `revs` and called
rev.manifest() on each one. Because `revs` is a list, and because each
rev.manifest() stores a reference to the manifest in the changectx, we end up
keeping every manifest alive which uses a lot of memory.

To fix this, let's treat revs as mutable pop it as we go.

Reviewed By: ryanmce

Differential Revision: D6912485

fbshipit-source-id: 18d1df470dfbc52c215104e620c9a6471ff32571
2018-04-13 21:51:06 -07:00
Jun Wu
efc6fe7319 remotefilelog: disallow delta on copied revisions
Summary:
The remotefilelog cgunpacker logic could enter an infinite loop
if a copyfrom file node uses its copyto as delta base.

This repros without LFS in test-lfs-bundle.t.

Reviewed By: DurhamG

Differential Revision: D6910079

fbshipit-source-id: 99fea316e77218cd4bc9ea6f5506779a3e4ab9a6
2018-04-13 21:51:06 -07:00
Jun Wu
19c474492b remotefilelog: respect lfs copy metadata
Summary: Otherwise the copy data will be lost when applying LFS bundles.

Reviewed By: DurhamG

Differential Revision: D6906207

fbshipit-source-id: bc94c6614f9d4b2a2b4c7f44f57de49bd54d6b49
2018-04-13 21:51:05 -07:00
Jun Wu
c323bb68e8 lfs: move hg filelog metadata calculation to a separate method
Summary: The method will be reused by remotefilelog.

Reviewed By: DurhamG

Differential Revision: D6906205

fbshipit-source-id: 5e36a5c7f40c7e226e6dd18e102e433632b1005d
2018-04-13 21:51:05 -07:00
Jun Wu
c223bb4eaf remotefilelog: resolve lfs rawtext to vanilla rawtext before applying delta
Summary: This is similar to the previous patch, but applies to remotefilelog.

Reviewed By: DurhamG

Differential Revision: D6906206

fbshipit-source-id: 2a9a56a57544b5e4d892f77438b2faaadece73ee
2018-04-13 21:51:05 -07:00
Jun Wu
a226ef4969 revlog: forbid revdiff revisions with non-zero flags
Summary:
Calling revdiff with non-zero flags is a sign of a hard-to-debug
error. Raise ProgrammingError in this case.

The change is straightforward. Apply it to both shallow and full
repos.

Reviewed By: DurhamG

Differential Revision: D6910080

fbshipit-source-id: cbcf1a444de90e104867cc9f1525629b7edda851
2018-04-13 21:51:05 -07:00
Jun Wu
d76d41a0b2 revlog: resolve lfs rawtext to vanilla rawtext before applying delta
Summary:
This happens when the client with LFS revisions applies a bundle
with a delta base pointing to an LFS revision stored in the repo.

Reviewed By: DurhamG

Differential Revision: D6906210

fbshipit-source-id: 8b47f8304f8ef5ae4b02d7239b680f70106a4d83
2018-04-13 21:51:05 -07:00
Jun Wu
453b043043 revlog: do not use delta for lfs revisions
Summary:
This is similar to what we have done for changegroups, but for non-changegroup
(addrawrevision) case. This is needed to make sure the delta application code
path can assume deltas are always against vanilla (non-LFS) rawtext so the next
fix becomes possible.

Reviewed By: DurhamG

Differential Revision: D6906202

fbshipit-source-id: a7d62dfed4206d45b42299f1dabf013620ae52b3
2018-04-13 21:51:05 -07:00
Jun Wu
1be09a10bc remotefilelog: do not delta lfs revisions
Summary: This is similar to the previous patch, but applies to remotefilelog.

Reviewed By: DurhamG

Differential Revision: D6906212

fbshipit-source-id: 30383632046f57b169dcb8a2ba1c0dd73113154a
2018-04-13 21:51:05 -07:00
Jun Wu
07042a2157 changegroup: do not delta lfs revisions
Summary:
There is no way to distinguish whether a delta base is LFS or non-LFS.

If the delta is against LFS rawtext, and the client trying to apply it has the
base revision stored as fulltext, the delta (aka. bundle) will fail to apply.

This patch forbids using delta on LFS revisions.

Note: this does not solve the problem entirely. Since the problem could also be
a client with base file revision being LFS tries to apply a non-LFS delta
(bundle).

Reviewed By: DurhamG

Differential Revision: D6878326

fbshipit-source-id: 9c3951e4673b8de61aae73a51e1bfff422f38d0f
2018-04-13 21:51:05 -07:00
Jun Wu
381158f7df test-lfs-bundle: new test testing lfs bundle exchanging behavior
Summary: This test covers bundle application between repos.

Reviewed By: DurhamG

Differential Revision: D6906245

fbshipit-source-id: 827b49eec49f1ffaac6363e38783705d0c399c45
2018-04-13 21:51:05 -07:00
Jun Wu
6529990478 debugfilerevision: add a new debug command
Summary:
This is similar to `debugdata`, but instead of taking a file revision (or
file node in remotefilelog's case), it takes a revset.

This is more useful practically, since the user would know commit hashes
easily but file nodes are hidden from the UI.

This is intended to make it easier to investigate LFS contents.

Reviewed By: DurhamG, ryanmce

Differential Revision: D6891770

fbshipit-source-id: 415da9b773c30830a48c09eda9f1854c416e3222
2018-04-13 21:51:05 -07:00