Summary:
Add a #define which allows selecting between the sha1collisiondetection and
openssl SHA-1 implementations at build time.
For now setup.py always uses sha1collisiondetection, but we have some other
internal build environments where we will likely default to OpenSSL's SHA-1
implementation instead.
Test Plan: Confirmed the code builds and passes tests.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D285
Summary:
The sha1collisiondetection library by default performs its own "safe-hash"
algorithm, which is not actually the same as the normal SHA-1 algorithm.
For most inputs the output will be the actual SHA-1 hash, but if the input
happens to contain one of several known SHA-1 disturbance vectors this code
returns an alternate "safe-hash" output instead.
This updates the code to explicitly disable "safe-hash" mode and collision
detection, so that we always get actual SHA-1 hashes.
Test Plan: Ran the unit tests.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D284
Summary:
Update the code to the stable-v1.0.3 release of sha1collisiondetection, and
include the upstream README file as well.
Test Plan: Confirmed the code builds and passes tests.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D283
Summary:
Add a clib/sha1.h file with SHA-1 utility functions that hide the details of
the underlying SHA-1 implementation being used. This will make it easier in
the future if we want to use the faster SHA-1 implementation from OpenSSL if it
is available, but fall back to the sha1collisiondetection library if it is not
available.
Test Plan: Confirmed the code builds and passes unit tests.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D282
Summary:
Move the third-party sha1collisiondetection code from clib/sha1 to
third-party/sha1dc. This helps isolate third-party code from our own
internally developed code.
This also updates the code to use the same include paths and library names as
used by the sha1collisiondetection's upstream Makefile, which would be needed
to link against a version of sha1collisiondetection installed locally.
Test Plan:
Confirmed "make local" succeeds.
All of the tests pass, except for test-check-commit-hg, which complains about
the fact that some of this third-party code contains multiple empty lines in a
row. It doesn't seem straightforward to update test-check-commit to ignore
this third-party code, but these test failures shouldn't affect any future
commits.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D281
Summary:
Check in the .clang-format file used for most of Facebook's other C++ projects.
This will allow clang-format to be used in the fb-hgext repository and produce
consistently formatted code with our other C++ code bases.
Test Plan:
Confirmed clang-format behaved as expected when auto-formatting sections of
files.
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D280
Summary: Object lookup fails in blobstore provided vague error message when a specific file was not present. Updating error message to reference the filename associated with the blob not found.
Test Plan:
In facebook-hg-rpms/fb-hgext/tests directory: rt test-lfs-test-server.t
Shows no error and validates that correct error message is displayed
Reviewers: quark, rainee, davidsp
Reviewed By: davidsp
Subscribers: medson, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D5617283
Tasks: T18972111
Signature: t1:5617283:1503070630:56fdcab5295ce7d050a24f1a989806066ef7054f
Change preview to just show the delta and connected commits. This means we need
to calculate oldworkingcopyparent and bookmarks diffs. This output will be
cleaner especially for people with a lot of commits in their repo.
Differential Revision: https://phab.mercurial-scm.org/D467
Summary:
The first version of infinitepush smartlog summary included some false
positives (in particular, not-backed-up but obsolete revs), and took a long
time to compute the set if there were many heads in the repo.
Improve the revset that is used by taking into account the heads that *should*
be backed up. Ancestors of these heads, that are not ancestors of the actual
backup heads are the ones that should be considered "not backed up".
Test Plan:
Re-run unit tests.
Manual test on devvm.
Perf test against stash's repo which has more heads than mine.
Reviewers: #fbhgext, stash
Differential Revision: https://phab.mercurial-scm.org/D475
Summary:
--list-remote can return too many nodes if used without a pattern.
Let's require a pattern.
Test Plan: Run unittests
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Subscribers: ryanmce
Differential Revision: https://phab.mercurial-scm.org/D221
Summary:
ui.warn() just prints to the stderr. It has two disadvantages:
1) Distracts a user
2) Doesn't notify us about the problem.
Let's use ui.log() that will send result to our logging system
Test Plan: Run unit-tests
Reviewers: #fbhgext, quark
Reviewed By: #fbhgext, quark
Differential Revision: https://phab.mercurial-scm.org/D443
Prevent flashing in 'hg undo -i' for smoother ux. Tested by running hg undo -i
and not seeing flashes when hitting left or right.
Differential Revision: https://phab.mercurial-scm.org/D465
D319 renamed `peer.pipe[ioe]` to `peer._pipe[ioe]`.
D320 removed `peer.batch`.
D331 renamed `subprocess` to `_subprocess`.
D336 renamed `_capabilities` to `capabilities`.
Let's be compatible with those changes.
Differential Revision: https://phab.mercurial-scm.org/D425
Visible obsolete commits are slightly tricky. For example, an amend in the
middle of a stack will leave behind a visible obsoleted commit. This diff
removes visible obsolete commits from 'olddraft()'. This removes the need for
some special casing and allows for a more powerful preview.
Differential Revision: https://phab.mercurial-scm.org/D463
Makes hg undo -i and hg undo -p output show an "undo to time, before command"
message and adds directions (left, right, return, q). Also adds pager check as
pager break interactiveui.
Testing: run hg undo -p and hg undo -i and see output
Differential Revision: https://phab.mercurial-scm.org/D448
Summary:
New keepset computation algorithm yields 50% time improvement on a small set of
commits and about 90% time improvement on a large set of commits. Currently it
takes about 1m10s to compute a keepset of 10 commits with treemanifest
usecunionstore flag unset and 3 seconds with cunionstore config set, provided
all trees are prefetched.
Test Plan: * Ensure that unit tests pass, in particular *-gc.t and *-gcrepack.t
Reviewers: ryanmce, simonfar, durham, #fbhgext
Reviewed By: ryanmce, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D442
Obsoleted commits may be visible. To make sure that they are un-obsoleted after
undo when appropriate, we add "draft() & obsolete()" recording. The most common
case where this matters is undoing a mid stack amend.
Differential Revision: https://phab.mercurial-scm.org/D438
Instead of the _showstats output from hg.py, we now output the args and time of
the mercurial command we are undoing.
Differential Revision: https://phab.mercurial-scm.org/D412
hg rebase, histedit, unshelve and other commands may stop in an unfinished state
because of merge conflicts or other reasons. The user then has the ability to
continue or abort. Undoing in this case is slightly tricky as for example
aborting a rebase will perform real strips and so undo will fail with an error.
This change still records these states, but flags them as unfinished and skips
over them when undoing and redoing. Hg undo --absolute does not ignore these
states in the really unlikely situation you want to go to one of them.
Differential Revision: https://phab.mercurial-scm.org/D410
Summary:
Since f33f2b5b487453a0387c80a2d736ec450696cefe, a failed `hg commit -A` will no
longer update the dirstate.
Reviewers: #fbhgext, simonfar
Reviewed By: #fbhgext, simonfar
Differential Revision: https://phab.mercurial-scm.org/D433
Summary: Get in line with upstream name change and eliminate develwarns.
Reviewers: #fbhgext, simonfar, simpkins
Reviewed By: #fbhgext, simonfar, simpkins
Subscribers: quark, simpkins, simonfar
Differential Revision: https://phab.mercurial-scm.org/D429
Undo -p is really slow on certain large repos. This caches 'olddraft()' by
using the revlog nodes. Since revlogs are immutable this should be really safe
and could hopefully dramatically improve not only hg undo -p performance, but
performance of all undo commands.
Differential Revision: https://phab.mercurial-scm.org/D439
The modern pager API is to use `ui.pager()` explicitly just before the time
a command needs a pager. It's now hard-coded in individual commands, and
opt-in by default. Users wanting to disable pagers for certain commands need
to disable them explicitly. Ideally we don't need the pager extensions or
the `pager.attend` setting.
This patch migrates `show`, `smartlog`, `fastannotate`, and `grep` to use
the modern API.
Differential Revision: https://phab.mercurial-scm.org/D437
Summary: This happens in case of "pull --rebase" if the source is ancestor of destination
Test Plan: see the new test, it's making hg crash without this change
Reviewers: #fbhgext, ryanmce, simonfar
Reviewed By: #fbhgext, ryanmce, simonfar
Subscribers: ryanmce
Differential Revision: https://phab.mercurial-scm.org/D436
Summary:
Added config option 'prefetchdays' which indicates that commits older than
'prefetchdays' days should not be prefetched. This option is necessary to avoid
prefetch of huge amount of data. The default value is set to 14 days.
Test Plan: Ensure that unit tests pass
Reviewers: ryanmce, simonfar, durham, #fbhgext, simpkins
Reviewed By: #fbhgext, simpkins
Subscribers: simpkins
Differential Revision: https://phab.mercurial-scm.org/D420
Summary:
The test fails due to a race condition. Now the failing part of the test
output is optional.
Test Plan: Ensure that unit tests do not fail
Reviewers: ryanmce, simonfar, #fbhgext
Reviewed By: ryanmce, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D417
Summary:
The test-treemanifest-pushrebase test was failing in our continuous integration
environment with a perplexing error:
```
$ pushclients
+ abort: exporting bookmark master failed!
```
(plus some additional failures later)
I thought this should not be possible because of the redirect, but it turns out
that the order of the redirects matters:
`>/dev/null 2>&1` redirects both stderr and stdout to `/dev/null`, but
`2>&1 >/dev/null` redirects stdout to /dev/null and stderr to stdout
(TIL)
However, this was the only clue to the issue that was going on, and so it's
better to actually keep the error around, if one occurs, so I removed the 2>&1
redirect altogether.
Furthermore, the test was failing with various clients failing to push.
To increase the chance of this succeeding, I'm bumping the sleep time. Ideally,
we should wait for the server to be "ready", but I'm not certain what that means
or how to test and would like to discuss to figure it out. This hopefully will
unblock the continuous integration for now.
Test Plan: Test still passes locally; wait to see if it passes in automation.
Reviewers: #fbhgext, mitrandir
Reviewed By: #fbhgext, mitrandir
Differential Revision: https://phab.mercurial-scm.org/D415
Previously, if the system hg does not work, `helper-testrepo.sh` will skip
the test (usually `test-check-*.t`). This patch makes it stricter so a
non-functional system hg will be an error so it's less likely to be ignored.
Differential Revision: https://phab.mercurial-scm.org/D387
Undo commands where undo wasn't first, for example `hg --pager=off undo` break
multiple things, including hg redo. This change fixes this.
Differential Revision: https://phab.mercurial-scm.org/D396
Mercurial sometimes leaves bad caches. Easiest example is when updating to a
hidden commit, where hg undo will fail, but can be reproduced with many commands
(such as fold which is used for testing here).
Test Plan:
unit tests
Differential Revision: https://phab.mercurial-scm.org/D395
Adds scuba logging to dev command timers so we can see how often some seemingly
unlikely edge (error) cases happen. Once we are confident that hg undo is
stable we can get rid of these logs. This is specifically for things that
don't loudly fail (since the user shouldn't care about them) but we still would
like to know about. Note that
[sampling]
key.undo=perfpipe_dev_command_timers
is needed in an hgrc file for this to work.
Test: deleted gap file, ran undo and confirmed error was noted in dev command
timers
Differential Revision: https://phab.mercurial-scm.org/D357
Summary:
If os.name is "posix", add the "e" flag when opening pack files. On systems
using glibc 2.7+ this causes the underlying operating system open() call to use
the O_CLOEXEC flag. This ensures that the pack file descriptors will not be
inherited by any children processes. This can be helpful since the
remotefilelog code can sometimes have thousands of pack files open. This
causes problems for children processes that expect to be able to use select()
on file descriptors they create, since they can end up with file descriptor
numbers over 1024.
While making sure to always set close_fds=True when calling subprocess.Popen()
can help with this, using O_CLOEXEC to fix the problem from the start seems
like a nicer fix.
The extra "e" flag generally should be ignored by other C library
implementations that do not support this flag. I explicitly scoped this to the
"posix" OS just to ensure that this cannot collide with other OS-specific flags
on other operating systems. (Windows also defines several of its own custom
fopen() flags. Windows does not currently use "e", but it seems best to avoid
it anyway.)
Test Plan:
Ran hg under strace and confirmed that the pack files were opened with
O_CLOEXEC.
Reviewers: quark, durham, #fbhgext
Reviewed By: quark, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D398
Summary:
amend --to is a thin wrapper around histedit, and fails if you ask it
to update the date. tweakdefaults can be configured to ask amend to change the
date. When this is the case, don't change the date when using --to, so that it
can work.
Test Plan:
Test case added here fails before the change complaining about other
flags with --to, and fails in the histedit afterwards (I'm not clear on why - I
suspect phases are significant here).
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D349
Summary:
Repack is also used for repack of local trees, which should not be garbage
collected. Therefore, we want to be able to pass the gc option to the repacker
class so that we could garbage collect the shared cache but not local trees.
Test Plan:
* Run unit tests
* Test manually on www repo
Reviewers: ryanmce, durham, simonfar, #fbhgext
Reviewed By: ryanmce, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D408
Summary: The test failed due to a race condition. Now the failing part of the test output is optional.
Test Plan: Ensure that unit tests do not fail
Reviewers: #fbhgext, ryanmce
Reviewed By: #fbhgext, ryanmce
Differential Revision: https://phab.mercurial-scm.org/D407
Summary:
Update the traceprof contextmanager to always print the profile information,
even when exiting due to an exception.
In particular, this fixes the behavior so that we report profiling information
even if a slow command is interrupted with Ctrl-C. This also matches the
behavior of the upstream statprof profiler.
Test Plan:
Confirmed that a profile was printed when interrupting a long-running
`hg log -f` command in a large repository.
Reviewers: quark, #fbhgext
Reviewed By: quark, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D386
Adds --branch handling to the no argument redo. Also adds better branch testing
and takes a more sensible approach to an undo after an undo --branch.
Redo now restores undoredo.i's --branch field. Undo after a undo --branch is
now an absolute undo. See test cases.
Test Plan:
unit
Differential Revision: https://phab.mercurial-scm.org/D324
Strips docs of unnescerary info and sticks complex things behind --verbose flag.
In most cases hg undo and redo or hg undo --preview should be enough for the
user. Also changes --index to --step, which seems clearer.
Differential Revision: https://phab.mercurial-scm.org/D287
Changes redo to straight up undo the previous undo. This is a bit trickier than
it may seem. The previous redo capabilities are still covered in hg undo as
--index accepts negative numbers allowing you to step both forward and
backwards one step at a time. The new redo reads the linear undo log to find
out where to undo to while updating the undo/redo index allowing you to continue
from where you left off.
Differential Revision: https://phab.mercurial-scm.org/D286
Provide interactive preview. undo -p now provides support of using arrow keys
and return to select state. The interactive ui is set up to be generic so
potentially could be used for other commands.
Test Plan:
1. Running a bash script that sets up an interesting repo
2. hitting hg undo -p and trying every key combination
Specifically: control-C still works, q quits, left goes forward,
right goes backwards, return brings you to a state
3. running redo after preview and return
4. running undo a few times and then using undo -p to go back forward
5. going out of bounds both up and down
6. hitting other random keys during hg undo -p
7. running hg undo -p with other flags
Differential Revision: https://phab.mercurial-scm.org/D263