Commit Graph

35100 Commits

Author SHA1 Message Date
Eamonn Kent
9d6491620e fsmonitor: fsmonitor should send wlock notifications to watchman
The fsmonitor extension should send state-enter and state-leave
notifications to watchman when the wlock is acquired/release, respectively.
This will allow watchman and watchman subscribers to customize behavior based
on whether source control operations are occurring.

Test Plan:
Tested checkout, update and working copy changes with extension enabled.

Differential Revision: https://phab.mercurial-scm.org/D1612
2017-12-06 18:37:49 -08:00
Eamonn Kent
329a529959 fsmonitor: remove watchman transaction and working copy change notifications
Remove working copy change and transaction notifications. We were relying
upon callbacks on transaction function. This caused issues with lock ordering.
A different approach will be adopted in a subsequent commit.

Differential Revision: https://phab.mercurial-scm.org/D1611
2017-12-06 18:37:49 -08:00
Matthieu Laneuville
b5b163535f patch: catch unexpected case in _inlinediff
If operation is neither 'diff.inserted' or 'diff.deleted', label and token won't
be define. This patch explicitely catches that exception.
2017-12-08 16:54:59 +09:00
Matthieu Laneuville
9b54f9af3b patch: reverse _inlinediff output for consistency 2017-12-08 16:47:18 +09:00
Joerg Sonnenberger
b1f2bd10ac phases: drop the list with phase of each rev, always comput phase sets
Change the C implementation of phasecache.loadphaserevs to provide only
the sets for draft and secret phase as well as the number of revisions
seen.

Change the pure Python implementation of the same functino to compute
the sets instead of the list of phases for each revision.

Change phasecache.phase to check the phase sets and assume public if the
revision is in neither draft nor secret set. This is computationally
slightly more expensive.

Change phasecache.getrevset for public() based queries to compute the
set of non-matching revisions and return the result as filtered
fullreposet. A shortcut is taken when no draft or secret revision
exists.

Bump the module version for the changed interface contract.

Overall, this saves around 16 Bytes per revision whenever the phasecache
is used, for the test case in issue5691 it is around 3MB. getrevset()
for a large repository is around 13% slower here, that seems an
acceptable trade off. Performance impact for phase() should be similar.

Differential Revision: https://phab.mercurial-scm.org/D1606
2017-12-06 15:46:41 +01:00
Joerg Sonnenberger
9c25f296a4 transaction: build changes['revs'] as range instead of a set
Revisions are added consecutively, so a range can easily represent them
in the changes list. This saves around 45 Bytes / revision on 64bit
platforms and reduces the memory footprint of issue5691 by 15MB.

Don't copy changes['revs'] in getobsoleted. Ranges have a very efficient
contains implementation already.

Differential Revision: https://phab.mercurial-scm.org/D1615
2017-12-08 01:23:34 +01:00
Augie Fackler
b3191ab441 ui: add diff.showfunc to tweakdefaults
This is a little risky, as I think we can have some encoding weirdness
crop up. showfunc also isn't the most robust feature, but it's still
often useful context...

Differential Revision: https://phab.mercurial-scm.org/D1610
2017-12-06 16:43:07 -05:00
Augie Fackler
0cf992efc2 ui: add curses interface to tweakdefaults
This was part of the original proposal, and while *I* don't like the
curses interface, most users anecdotally seem to greatly prefer it to
plain text interfaces.

Differential Revision: https://phab.mercurial-scm.org/D1609
2017-12-06 16:42:24 -05:00
Boris Feld
8fc5e92851 push: restrict common discovery to the pushed set
This changeset make use of the ability of the set discovery to only search
common changeset for a subset of the repository. Restricting that search to the
pushed set avoid potential waste of time finding out the status of many
unrelated related revision.

Repository with many heads were especially badly affected by this. Here is an
example of findcommonhead discovery for pushing 11 outgoing changeset on a
repository with tens of thousand of unrelated heads. (discovery run over a ssh
link to localhost).

Before:
    queries: 92
    time:    44.1996s

After:
    queries: 3
    time:    0.6938s

A x63 speedup even with a network link without latency.
2017-12-06 23:33:01 +01:00
Boris Feld
cc076020d2 setdiscover: allow to ignore part of the local graph
Currently, the push discovery first determines the full set of common nodes
before looking into what changesets are outgoing. When pushing a specific
subset, this can lead to pathological situations where we search for the status
of thousand of local heads that are unrelated to the requested pushes.

To fix this, we need to teach the discovery to ignores part of the graph. Most
of the necessary pieces were already in place. This changeset just makes them
available to higher level API and tests them.

Change actually impacting pushes are coming in a later changeset.
2017-12-06 22:44:51 +01:00
Boris Feld
d36b88cc11 largefiles: allow to run 'debugupgraderepo' on repo with largefiles
The extensions wrap the necessary function to ensure the 'largefiles'
requirements won't be dropped.

It is now possible to run `hg debugupgraderepo` on a repository with largefiles.
2017-12-07 01:53:14 +01:00
Boris Feld
8a1502d6d0 upgraderepo: allow extension to register preserved requirements
Some requirement does not directly result from config and needs more advanced
logic to be preserved. The current example is 'largefiles'. We add a hook
point in the upgrade code so that extensions can handle these cases.

The 'largefiles' extension will use it in the next changeset.
2017-12-07 01:51:54 +01:00
Yuya Nishihara
5db2725c37 revset: make follow() accept empty startrev
This is the same behavior as ancestors(emptyset).
2016-09-22 19:41:42 +09:00
Yuya Nishihara
85d4b98f53 revset: alias follow(startrev=rev) to ancestors(rev)
This seems natural given 'log -frREV' (with no file pattern) is equivalent
to 'log -frREV *'.
2016-09-22 19:40:07 +09:00
Yuya Nishihara
08c3b37347 revset: make follow() accept keyword arguments
Also renamed the argument from 'pattern' to 'file' conforming to
followlines().
2016-09-22 19:35:36 +09:00
Yuya Nishihara
3142b0e7d7 revset: make follow() accept multiple startrevs
The diff might look slightly complicated, but the initial "c = repo['.']" was
effective if rev = None.
2016-09-22 19:11:26 +09:00
Yuya Nishihara
d7842061cc dagop: use heap to compute max rev in filectxancestors() 2016-09-22 18:41:51 +09:00
Yuya Nishihara
e49a4312a9 dagop: add smartset interface to filectxancestors()
The original filectx API is kept public since we'll need it to walk ancestor
(rev, match) pairs efficiently. The current implementation scans ancestors
twice for 'hg log -fp FILE'.
2017-10-22 18:57:42 +09:00
Phil Cohen
e206413cfc overlayworkingctx: add _checkexist(path)
This is in preparation to switch this class to inheriting (and being based off
a) `commitctx` instead of a `workingctx`. `filectx` has no `exists` function,
so this is how we'll fall back in that case.

Differential Revision: https://phab.mercurial-scm.org/D1237
2017-12-07 13:20:47 -08:00
Phil Cohen
4cb0fafe39 overlayworkingctx: fix a bad reference to self._path
Differential Revision: https://phab.mercurial-scm.org/D1236
2017-12-07 13:20:47 -08:00
Phil Cohen
4dc892f75b overlayworkingctx: track copy information in the context
We can no longer do so in the dirstate, so add the functions to do so here.

Differential Revision: https://phab.mercurial-scm.org/D1235
2017-12-07 13:20:47 -08:00
Phil Cohen
69f2e46a16 rebaseruntime: raise InMemoryMergeConflictsError on merge conflicts
Differential Revision: https://phab.mercurial-scm.org/D1234
2017-12-07 13:20:47 -08:00
Phil Cohen
074da72360 rebase: do not bail on uncomitted changes if rebasing in-memory
Differential Revision: https://phab.mercurial-scm.org/D1233
2017-12-07 13:20:47 -08:00
Phil Cohen
81066c4093 rebase: add the --inmemory option flag; assign a wctx object for the rebase
In the future, the --inmemory flag might be deprecated in favor of something more
intelligent (for example, always rebasing in-memory if the working copy parent
isn't in the rebaseset). But we might keep it as a way to explicitly force IMM
on or off.

Differential Revision: https://phab.mercurial-scm.org/D1232
2017-12-07 13:25:23 -08:00
Phil Cohen
8024806695 overlayworkingctx: move _wrappedctx out of the constructor
With rebase, we will be setting the _wrappedctx at a different point from the
wctx construction (somewhat later, and possibly several times). Move it to a
public function.

Differential Revision: https://phab.mercurial-scm.org/D1231
2017-12-07 13:20:47 -08:00
Phil Cohen
d99691c52d merge: don't check for unknown files in IMM
Differential Revision: https://phab.mercurial-scm.org/D1214
2017-12-07 13:20:47 -08:00
Jun Wu
e7d2ff6ac8 rebase: enable multidest by default
This was intended to be done by D470. But there was a minor documentation
issue. The feature is quite usable now so it gets formally documented and
enabled.

There is no behavior change for people not using the `SRC` or `ALLSRC` in
rebase destination revset.

.. feature:: Rebase with different destination per source revision

  Previously, rebase only supports one unique destination. Now ``SRC`` and
  ``ALLSRC`` can be used in rebase destination revset to precisely define
  destination per each individual source revision.

  For example, the following command could move some orphaned changesets to
  reasonable new places so they become no longer orphaned::

    hg rebase
      -r 'orphan()-obsolete()'
      -d 'max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::)'

Differential Revision: https://phab.mercurial-scm.org/D1063
2017-10-13 14:08:14 -07:00
Phil Cohen
b85e71bd61 overlayworkingctx: make clean() public
It will be called directly by rebase after concluding a node.

Differential Revision: https://phab.mercurial-scm.org/D1230
2017-12-01 00:07:23 -08:00
Phil Cohen
635c6eaf7f overlayworkingctx: remove flushall()
Differential Revision: https://phab.mercurial-scm.org/D1216
2017-12-01 00:07:23 -08:00
Phil Cohen
da19a4a9f4 merge: skip subrepo state, update hooks, and updating the dirstate in IMM
Differential Revision: https://phab.mercurial-scm.org/D1215
2017-12-01 00:07:23 -08:00
Phil Cohen
d0b4ef96b4 merge: remove calls to flushall()
Since D1105, these are unnecessary since IMM will now never use workers.

Differential Revision: https://phab.mercurial-scm.org/D1213
2017-12-01 00:07:23 -08:00
Phil Cohen
cb5bf40a81 filemerge: raise InMemoryMergeConflictsError if we hit merge conflicts in IMM
Merge conflicts might be supported in the future, but for now are kept out of
scope.

Any places where we used to call `flushall()` should be replaced with some kind
of exception. At this point, IMM M1 is no longer supported.

Differential Revision: https://phab.mercurial-scm.org/D1212
2017-12-01 00:07:23 -08:00
Phil Cohen
5992e0fe48 context: switch ctx() use to changectx()
I added `ctx()` to `overlayworkingfilectx`, (and before that, `absentfilectx`),
because `absentfilectx` had reference to this function in its `cmp()` function.

But the standard is actually `changectx()`, and no other class implements
`ctx()`. So let's use the standard name.

(As a result, I'm not sure that part of the `absentfilectx` comparator ever
worked! It was written before I added either function.)

This will be necessary in the next patch.

Differential Revision: https://phab.mercurial-scm.org/D1211
2017-12-01 00:07:23 -08:00
Matt Harbison
1eac95a707 lfs: introduce a user level cache for lfs files
This is the same mechanism in place for largefiles, and solves several problems
working with multiple local repositories.  The existing largefiles method is
reused in place, because I suspect that there are other functions that can be
shared.  If we wait a bit to identify more before `hg cp lfutil.py ...`, the
history will be easier to trace.

The push between repo14 and repo15 in test-lfs.t arguably shouldn't be uploading
any files with a local push.  Maybe we can revisit that when `hg push` without
'lfs.url' can upload files to the push destination.  Then it would be consistent
for blobs in a local push to be linked to the local destination's cache.

The cache property is added to run-tests.py, the same as the largefiles
property, so that test generated files don't pollute the real location.  Having
files available locally broke a couple existing lfs-test-server tests, so the
cache is cleared in a few places to force file download.
2017-12-06 22:56:15 -05:00
Matt Harbison
bb9f48ac9d largefiles: refactor _usercachedir() to allow reuse with lfs
Largefiles puts everything into a flat directory, while lfs divides files up by
creating subdirectories consisting of the first two characters of the hash.
Therefore, pointing at the largefiles cache won't work.
2017-12-05 23:08:59 -05:00
Matt Harbison
e0780e4200 lfs-test: note a problem with unpushed lfs files and cloning/sharing
AFAIK, this isn't an issue with largefiles because it knows how to look in the
system-wide cache.
2017-11-16 21:05:15 -05:00
Matthieu Laneuville
14498f2bf5 patch: add within-line color diff capacity
The `diff' command usually writes deletion in red and insertions in green. This
patch adds within-line colors, to highlight which part of the lines differ.
Lines to compare are decided based on their similarity ratio, as computed by
difflib SequenceMatcher, with an arbitrary threshold (0.7) to decide at which
point two lines are considered entirely different (therefore no inline-diff
required).

The current implementation is kept behind an experimental flag in order to test
the effect on performance. In order to activate it, set inline-color-diff to
true in [experimental].
2017-10-26 00:13:38 +09:00
Yuya Nishihara
4c0e4dc497 dagop: extend filectxancestors() to walk multiple files 2016-09-22 18:23:58 +09:00
Yuya Nishihara
b05b96f608 dagop: put start fctx into visit dict of filectxancestors()
Prepares for multiple start revisions/files.
2016-09-22 18:18:56 +09:00
Yuya Nishihara
09a49f4137 dagop: change visit dict of filectxancestors() indexed solely by rev
In future patches, a max heap will be used to compute the next revision
to visit.
2016-09-22 18:11:37 +09:00
Yuya Nishihara
a17c36ca23 dagop: use fctx.rev() consistently in filectxancestors()
We can't use fctx.linkrev() to sort fctxs coming from multiple files.
This was changed at a5b8b1052ef6 due to performance issue, but we know
we evaluate parent.rev() in revset anyway.
2016-09-22 18:01:55 +09:00
Yuya Nishihara
70940bffa0 dagop: yield intro filectx by filectxancestors()
This is the convention of dagop.*ancestors() functions.
2016-09-22 17:48:46 +09:00
Yuya Nishihara
6245084744 filectx: extract helper method to obtain filectx pointing to its introrev 2017-10-22 17:23:34 +09:00
Yuya Nishihara
f55866843d dagop: copy basefilectx.ancestors() to free function
The primary goal of this series is to make follow() support multiple start
revisions.

dagop.filectxancestors() will be extended to take multiple filectxs.
basefilectx.ancestors() is not forwarded to this function because doing that
would resurrect the performance issue fixed by a5b8b1052ef6.
2016-09-22 17:16:53 +09:00
Yuya Nishihara
f3f2688b82 test-log: test that fctx.ancestors() can't index parents only by linkrev
This covers a possible bug that could be caused by the following change:

  --- a/mercurial/context.py
  +++ b/mercurial/context.py
  @@ -1047,7 +1047,7 @@ class basefilectx(object):

           while True:
               for parent in c.parents()[:cut]:
  -                visit[(parent.linkrev(), parent.filenode())] = parent
  +                visit[parent.linkrev()] = parent
               if not visit:
                   break
               c = visit.pop(max(visit))
2016-09-22 15:52:09 +09:00
Boris Feld
8e35ca84ad pull: retrieve bookmarks through the binary part when possible
This makes pull consistent with the part used by push and provide us with a
more compact representation of bookmarks.

In addition, this opens the way for smarter bookmark exchanges (e.g. filtering
by names or only sending the bookmark relevant to the pulled set, etc).
2017-10-17 15:27:22 +02:00
Boris Feld
96e2aa3564 getbundle: add support for 'bookmarks' boolean argument
This new argument requests a 'bookmarks' part from the server. It is meant to
be used instead of the "listkeys" request.
2017-10-17 15:27:17 +02:00
Boris Feld
d449bcaec6 bundle2: support a 'records' mode for the 'bookmarks' part
In this mode, the bookmarks changes are record in the 'bundleoperation' records
instead of inflicted to the repository. This is necessary to use the part when
pulling.
2017-10-17 15:26:16 +02:00
Boris Feld
85a28bae65 bundle2: add a 'modes' dictionary to the bundle operation
This new attribute allows the codes requesting an unbundling to pass important
information to individual part handlers. The current target use case is to
allow for receiving 'bookmarks' part without directly updating local
repository, but just recording the received data instead. This is necessary
for pull where the remote bookmarks are processed locally. I expect the
concept to be beneficial to other parts in the future.

To clarify the bookmark behavior on pull, the remote bookmark value are not just
taken -as-is- into the local repository. There is an extra step to detect
bookmark divergence. The remote bookmarks data are stored until this processing
happens.
2017-10-17 15:39:34 +02:00
Boris Feld
12ed35f197 bookmark: use the 'bookmarks' bundle2 part to push bookmark update (issue5165)
We use the new binary parts we introduced earlier to exchange bookmark. The
payload is a bit more compact since we use binary and the length of bookmarks
is no longer constrained to 255.

.. fix:: Issue 5165

   Bookmark, whose name is longer than 255, can again be exchanged again
   between 4.4+ client and servers.
2017-10-17 12:38:13 +02:00