Commit Graph

33860 Commits

Author SHA1 Message Date
Boris Feld
ee14b96e6f configitems: register the 'eol.only-consistent' config 2017-06-30 03:39:32 +02:00
Boris Feld
a15108d159 configitems: register the 'eol.native' config 2017-06-30 03:39:26 +02:00
Boris Feld
486110b0f4 configitems: register the 'eol.fix-trailing-newline' config 2017-06-30 03:39:21 +02:00
Boris Feld
21b0f2024e configitems: register the 'patchbomb.publicurl' config 2017-06-30 03:43:43 +02:00
Boris Feld
b7f48a76b1 configitems: register the 'patchbomb.intro' config 2017-06-30 03:43:41 +02:00
Boris Feld
9eb3cb7909 configitems: register the 'patchbomb.from' config 2017-06-30 03:43:40 +02:00
Boris Feld
a72f2bfb21 configitems: register the 'patchbomb.flagtemplate' config 2017-06-30 03:43:39 +02:00
Boris Feld
956178d827 configitems: register the 'patchbomb.confirm' config 2017-06-30 03:43:38 +02:00
Boris Feld
b7bafc583d configitems: register the 'patchbomb.bundletype' config 2017-06-30 03:43:37 +02:00
Jun Wu
6192c1e941 blackbox: remove _bbvfs state
`_bbvfs` is redundant because it could be calcualted from `_bbrepo`.

Differential Revision: https://phab.mercurial-scm.org/D651
2017-09-06 21:12:27 -07:00
Jun Wu
0b73011081 blackbox: do not cache file objects
Having the blackbox file objects cached in `ui._bbfp` could in theory be
troublesome if multiple processes (ex. chg servers) have file objects
referring to a same file. (Although I spent some time and failed to build a
convincing test case)

This patch makes blackbox re-open the file every time to make the situation
better. Ideally we also need proper locking.

The caching logic traces back to the commit introducing blackbox
(18242716a). That commit does not have details about why caching is
necessary.  Consider the fact that blackbox logs are not many, it seems fine
to remove the fp cache to be more confident.

Differential Revision: https://phab.mercurial-scm.org/D650
2017-09-06 21:08:59 -07:00
Jun Wu
38ee36031d blackbox: inline _bbwrite
There is no need to make it a separate method. This makes the next change
easier to read.

Differential Revision: https://phab.mercurial-scm.org/D649
2017-09-06 20:54:53 -07:00
Jun Wu
a97d2d42cb blackbox: fix rotation with chg
The added test will show:

  $ $PYTHON showsize.py .hg/blackbox*
  .hg/blackbox.log: < 500
  .hg/blackbox.log.1: < 500
  .hg/blackbox.log.2: < 500
  .hg/blackbox.log.3: < 500
  .hg/blackbox.log.4: < 500
  .hg/blackbox.log.5: >= 500

with previous code.

The issue is caused by blackbox caching file objects *by path*, and the
rotation size check could run on a wrong file object (i.e. it should check
"blackbox.log", but `filehandles["blackbox.log"]` contains a file object
that has been renamed to "blackbox.log.5").

This patch removes the "filehandlers" global cache added by 39bd7b0c79fe to
solve the issue.

I think the original patch was trying to make different ui objects use a same
file object if their blackbox.log path is the same. In theory it could also
be problematic in the rotation case. Anyway, that should become unnecessary
after D650.

Differential Revision: https://phab.mercurial-scm.org/D648
2017-09-06 19:27:30 -07:00
Jun Wu
7d887b076a test-blackbox: make it compatible with chg
Differential Revision: https://phab.mercurial-scm.org/D647
2017-09-06 18:31:25 -07:00
Durham Goode
477a318d3a ssh: fix flakey ssh errors on BSD systems
There's been a persistent issue with flakiness on BSD systems (like OSX) where
the 'no suitable response from remote hg' message would sometimes not appear.
This was caused by one of the earlier calls failing with a "IOError: Broken
pipe". Catching those errors and printing the same message removes the
flakiness.

Differential Revision: https://phab.mercurial-scm.org/D687
2017-09-11 15:59:18 -07:00
Phil Cohen
b6b5ecede4 context: add overlayworkingcontext and overlayworkingfilectx
These two classes will be used extensively in the first in-memory merge
milestone.

Differential Revision: https://phab.mercurial-scm.org/D616
2017-09-11 13:03:27 -07:00
Durham Goode
9ff843ded9 changegroup: rename getsubsetraw to makestream
Now that nothing uses getsubsetraw except makestream, let's move the
functionality into the makestream. This removes the last remaining excess
changegroup creation function, getsubsetraw.

Differential Revision: https://phab.mercurial-scm.org/D671
2017-09-10 18:52:40 -07:00
Durham Goode
792e177614 changegroup: remove external uses of getbundler
Now that makestream and makechangegroup are the primary creation methods for
changegroups, let's get rid of this rogue use of getbundler and getsubsetraw.

Differential Revision: https://phab.mercurial-scm.org/D670
2017-09-10 18:51:31 -07:00
Durham Goode
21faf618dc changegroup: replace getchangegroup with makechangegroup
As part of reducing the number of changegroup creation APIs, let's replace
getchangegroup with calls to makechangegroup. This is mostly a drop in
replacement, but it does change the version specifier to be required, so it's
more obvious which callers are creating old version 1 changegroups still.

Differential Revision: https://phab.mercurial-scm.org/D669
2017-09-10 18:50:12 -07:00
Durham Goode
738a32ad20 changegroup: replace changegroup with makechangegroup
As part of reducing the number of changegroup creation APIs, let's replace the
changegroup function with makechangegroup. This pushes the responsibility of
creating the outgoing set to the caller, but that seems like a simple and
reasonable concept for the caller to be aware of.

Differential Revision: https://phab.mercurial-scm.org/D668
2017-09-10 18:48:42 -07:00
Durham Goode
49825855fd changegroup: delete getlocalchangegroup
As part of reducing the number of changegroup creation APIs, let's go ahead and
delete this unused function. It appears to have been deprecated in the last
release anyway.

Differential Revision: https://phab.mercurial-scm.org/D667
2017-09-10 18:47:39 -07:00
Durham Goode
b470a6a2f1 changegroup: replace getlocalchangegroupraw with makestream
As part of reducing the number of changegroup creation apis, let's replace calls
to getlocalchangegroupraw with calls to makestream. Aside from one case of
checking if there are no outgoing commits and returning None, this is pretty
much a drop in replacement.

Differential Revision: https://phab.mercurial-scm.org/D666
2017-09-10 19:01:56 -07:00
Durham Goode
394bc74c72 changegroup: replace changegroupsubset with makechangegroup
As part of getting rid of all the permutations of changegroup creation, let's
remove changegroupsubset and call makechangegroup instead. This moves the
responsibility of creating the outgoing set to the caller, but that seems like a
relatively reasonable unit of functionality for the caller to have to care about
(i.e. what commits should be bundled).

Differential Revision: https://phab.mercurial-scm.org/D665
2017-09-10 18:43:59 -07:00
Durham Goode
00542dbd45 changegroup: replace getsubset with makechangegroup
The current changegroup APIs are a bit of a mess. Currently you can use
getsubsetraw, getsubset, changegroupsubset, getlocalchangegroupraw,
getchangegroup, and getlocalchangroup to produce changegroups. This patch is the
beginning of a refactor to boil all of that away to just makechangegroup and
makestream.

The first step adds the new functions and replaces getsubset function with them.

Differential Revision: https://phab.mercurial-scm.org/D664
2017-09-10 18:39:02 -07:00
Jun Wu
9a0daf2508 rebase: remove unnecessary '.unfiltered()' calls
Now we have a clear centric place to control whether `rbsrt.repo` is
unfiltered or not, we can drop `unfiltered()` in other places.

Differential Revision: https://phab.mercurial-scm.org/D645
2017-09-06 16:17:04 -07:00
Jun Wu
1392df8e4d rebase: remove complex unhiding code
This is similar to Martin von Zweigbergk's previous patch [1].

Previous patches are adding more `.unfiltered()` to the rebase code. So I
wonder: are we playing whack-a-mole regarding on `unfiltered()` in rebase?

Thinking about it, I believe most of the rebase code *should* just use an
unfiltered repo. The only exception is before we figuring out a
`rebasestate`. This patch makes it so. See added comment in code for why
that's more reasonable.

This would make the code base cleaner (not mangling the `repo` object),
faster (no need to invalidate caches), simpler (less LOC), less error-prone
(no need to think about what to unhide, ex. should we unhide wdir p2? how
about destinations?), and future proof (other code may change visibility in
an unexpected way, ex.  directaccess may make the destination only visible
when it's in "--dest" revset tree).

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/094277.html

Differential Revision: https://phab.mercurial-scm.org/D644
2017-09-06 16:13:04 -07:00
Jun Wu
9bfa16c243 rebase: use unfiltered repo when loading state
Before this patch, `rebase --abort` may fail to do the cleanup:

  $ hg rebase --abort
  rebase aborted (no revision is removed, only broken state is cleared)

The added test case makes sure `--abort` works in this case.

Differential Revision: https://phab.mercurial-scm.org/D643
2017-09-06 15:23:19 -07:00
Jun Wu
8b33f0c213 rebase: do not crash rebasing merge with a parent having hidden successor
The added test will crash with previous code.

Differential Revision: https://phab.mercurial-scm.org/D640
2017-09-06 12:40:00 -07:00
Durham Goode
1910a51ac1 changegroup: fix to allow empty manifest parts
The current chunk reading algorithm relied on counting the number of empty
chunks and comparing it to the number of chunk lists it expected (1 list of
files for cg1 and cg2, and 1 list of files + 1 list of trees for cg3). This
implicitly assumed that both the changelog part and the manifestlog part were
never empty (since them being empty would cause it to count it as one list being
done, and screw up the count). In our treemanifest code, the manifest section
could be empty, so we need to handle that case.

This patches refactors that code to be more explicit about how it counts the
expected parts.

Differential Revision: https://phab.mercurial-scm.org/D646
2017-09-06 18:33:55 -07:00
Jun Wu
8b69f8688d wrapcommand: use functools.partial
Like the previous patch, this helps remove noises in traceback.

Practically, this removes another 6 lines in `rebase -s . -d .` traceback in
my setup:

   ....
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
  -File "hg/mercurial/extensions.py", line 331, in closure
  -  return func(*(args + a), **kw)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
   File "fb-hgext/hgext3rd/fbhistedit.py", line 283, in _rebase
     return orig(ui, repo, **opts)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
  -File "hg/mercurial/extensions.py", line 331, in closure
  -  return func(*(args + a), **kw)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
   File "remotenames.py", line 633, in exrebasecmd
     ret = orig(ui, repo, **opts)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
  -File "hg/mercurial/extensions.py", line 331, in closure
  -  return func(*(args + a), **kw)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
   File "fb-hgext/hgext3rd/fbamend/__init__.py", line 453, in wraprebase
     return orig(ui, repo, **opts)
   File "hg/mercurial/util.py", line 1118, in check
     return func(*args, **kwargs)
   ....

Differential Revision: https://phab.mercurial-scm.org/D633
2017-09-05 15:18:45 -07:00
Jun Wu
f89434c718 wrapfunction: use functools.partial if possible
Every `extensions.bind` call inserts a frame in traceback:

   ... in closure
     return func(*(args + a), **kw)

which makes traceback noisy.

The Python stdlib has a `functools.partial` which is backed by C code and
does not pollute traceback. However it does not support instancemethod and
sets `args` attribute which could be problematic for alias handling.

This patch makes `wrapfunction` use `functools.partial` if we are wrapping a
function directly exported by a module (so it's impossible to be a class or
instance method), and special handles `wrapfunction` results so alias
handling code could handle `args` just fine.

As an example, `hg rebase -s . -d . --traceback` got 6 lines removed in my
setup:

   File "hg/mercurial/dispatch.py", line 898, in _dispatch
     cmdpats, cmdoptions)
  -File "hg/mercurial/extensions.py", line 333, in closure
  -  return func(*(args + a), **kw)
   File "hg/hgext/journal.py", line 84, in runcommand
     return orig(lui, repo, cmd, fullargs, *args)
  -File "hg/mercurial/extensions.py", line 333, in closure
  -  return func(*(args + a), **kw)
   File "fb-hgext/hgext3rd/fbamend/hiddenoverride.py", line 119, in runcommand
     result = orig(lui, repo, cmd, fullargs, *args)
   File "hg/mercurial/dispatch.py", line 660, in runcommand
     ret = _runcommand(ui, options, cmd, d)
  -File "hg/mercurial/extensions.py", line 333, in closure
  -  return func(*(args + a), **kw)
   File "hg/hgext/pager.py", line 69, in pagecmd
     return orig(ui, options, cmd, cmdfunc)
   ....

Differential Revision: https://phab.mercurial-scm.org/D632
2017-09-05 13:37:36 -07:00
Saurabh Singh
63cd1bdef8 cmdutil: remove redundant commitfunc parameter in amend (API)
Since the redundant commit during the amend has been been removed, there is no
need for commit callback function in amend now. Therefore, this commit removes
the unused parameter "commmitfunc" which was being used for this purpose.

Test Plan:
Ensured that all the tests pass

Differential Revision: https://phab.mercurial-scm.org/D635
2017-09-01 12:34:36 -07:00
Saurabh Singh
d207bf8f86 cmdutil: remove the redundant commit during amend
There was an extra commit made during the amend operation to track the
changes to the working copy. However, this logic was written a long time back
and newer API's make this extra commit redundant. Therefore, I am removing the
extra commit. After this change, I noticed that

  - Execution time of the cmdutil.amend improved by over 40%.
  - Execution time of "hg commit --amend" improved by over 20%.

Test Plan:
I ensured that the all the hg tests passed after the change. I had
to fix a few tests which were aware of the extra commit made during the amend.

Differential Revision: https://phab.mercurial-scm.org/D636
2017-09-01 12:34:36 -07:00
Jun Wu
5533f78606 checknlink: rename file object from 'fd' to 'fp'
Make it clear that `fp` (`file` object) is different from `fd` (low-level
file descriptor number).

Differential Revision: https://phab.mercurial-scm.org/D642
2017-09-06 12:56:19 -07:00
Martin von Zweigbergk
cb8b36b8aa cleanup: rename "matchfn" to "match" where obviously a matcher
We usually call matchers either "match" or "m" and reserve "matchfn"
for functions.

Differential Revision: https://phab.mercurial-scm.org/D641
2017-09-05 15:06:45 -07:00
Martin von Zweigbergk
78fb62643c check-code: fix incorrect capitalization in camelcase regex
This was found internally at Google as part of a monorepo-wide
cleanup.

Differential Revision: https://phab.mercurial-scm.org/D637
2017-09-06 08:22:54 -07:00
Martin von Zweigbergk
e34765d999 amend: use context manager for config override
Differential Revision: https://phab.mercurial-scm.org/D639
2017-09-06 10:41:13 -07:00
Martin von Zweigbergk
f238d550cd amend: delete dead assignment to "newid"
Differential Revision: https://phab.mercurial-scm.org/D638
2017-09-06 10:42:02 -07:00
Jun Wu
b6ac2e259f checknlink: use a random temp file name for checking
Previously, if `.hg/store/00manifest.d.hgtmp1` exists, hg will copy the
entire `00manifest.d` every time when appending new manifest revisions.
That could happen if Mercurial or the machine crashed when `.hgtmp1` was
just created but not deleted yet.

This patch changes the fixed name to a random generated name. To be
consistent with D468, `~` suffix was used.

Differential Revision: https://phab.mercurial-scm.org/D611
2017-09-01 17:09:53 -07:00
Pulkit Goyal
b8929368f2 copytrace: move the default copytracing algorithm in a new function
We are going to introduce a new fast heuristic based copytracing algorithm, so
lets make mergecopies the function which decides which algorithm to go with and
then calls the related function.

While I was here, I add a line in test-copy-move-merge.t saying its a test
related to the full copytracing algorithm.

Differential Revision: https://phab.mercurial-scm.org/D622
2017-09-03 02:34:01 +05:30
Pulkit Goyal
59fe14130c copytrace: replace experimental.disablecopytrace config with copytrace (BC)
This patch replaces experimental.disablecopytrace with experimental.copytrace.
Since the words does not means the same, the default value is also changed. Now
experimental.copytrace defaults to 'on'. The new value is not boolean value as
we will be now having two different algorithms (current one and heuristics one
to be imported from fbext) so we need this to be have more options than
booleans.

The old config option is not kept is completely replaced as that was under
experimental and we don't gurantee BC to experimental things.

.. bc::

   The config option for copytrace `experimental.disablecopytrace` is now
   replaced with `experimental.copytrace` which defaults to `on`. If you need to
   turn off copytracing, add `[experimental] copytrace = off` to your config.

Differential Revision: https://phab.mercurial-scm.org/D621
2017-09-03 01:52:19 +05:30
Phil Cohen
6320e90d1b filemerge: use fctx.write() in the internal:dump tool, instead of copy
This is slower but allows this tool to work with the "deferred writes"
milestone of in-memory merge.

The performance hit is not too noticiable since this only used for the :dump
merge tool during a conflict.

Differential Revision: https://phab.mercurial-scm.org/D617
2017-09-05 12:04:02 -07:00
Martin von Zweigbergk
7bcdc77ac9 largefiles: remove unused assignments from wrapfunction()
The return values from wrapfunction() were never used here. Using the
value is also a little tricky and wrappedfunction() should be
preferred, so let's just delete the assignments.

There's also a bunch of return values from wrapcommand() being
assigned to a variable here, but at least that value can be (and is
used after some of the assignments).

Differential Revision: https://phab.mercurial-scm.org/D618
2017-08-31 22:39:10 -07:00
the31k
27daecb480 branches: correctly show inactive multiheaded branches
Issue being fixed here: `hg branches` incorrectly renders inactive multiheaded
branches as active if they have closed heads.

Example:

```
$ hg log --template '{rev}:{node|short} "{desc}" ({branch}) [parents: {parents}]\n'
4:2e2fa7af8357 "merge" (default) [parents: 0:c94e548c8c7d 3:7be622ae5832 ]
3:7be622ae5832 "2" (somebranch) [parents: 1:81c1d9458987 ]
2:be82cf30409c "close" (somebranch) [parents: ]
1:81c1d9458987 "1" (somebranch) [parents: ]
0:c94e548c8c7d "initial" (default) [parents: ]

$ hg branches
default                        4:2e2fa7af8357
somebranch                     3:7be622ae5832
```

Branch `somebranch` have two heads, the 1st one being closed (rev 2) and
the other one being merged into default (rev 3). This branch should be shown as
inactive one.

This happens because we intersect branch heads with repo heads to check branch
activity. In this case intersection in a set with one node (rev 2). This head
is closed but the branch is marked as active nevertheless.

Fix is to check branch activity by intersecting only open heads set.

Fixed output:

```
$ hg branches
default                        4:2e2fa7af8357
somebranch                     3:7be622ae5832 (inactive)
```

Relevant tests for multihead branches added to test-branches suite.

Implentation note about adding `iteropen` method:

At first I have tried to modify `iterbranches` is such a way that it would
filter out closed heads itself. For example it could have `closed=False`
parameter. But in this case we would have to filter closed tips as well.
Reasoning in terms of `hg branches` we actually are not allowed to do this.

Also, we need to do heads filtering only if tip is not closed itself. But if it
is - we are ok to skip filtering, because branch is already known to be inactive.

So we can't implement heads filtering in `iterbranches` in elegant way, because
we will end up with something like `closed_heads=False` or even
`closed_heads_is_tip_is_open`. Finally I decided to move this logic to the
`branches` function, adding `iteropen` helper method.

Differential Revision: https://phab.mercurial-scm.org/D583
2017-08-31 18:24:08 +03:00
Yuya Nishihara
f0fc1531a4 parser: stabilize output of prettyformat() by using byte-safe repr()
The format of leaf nodes is slightly changed so they look more similar to
internal nodes.
2017-09-03 21:17:25 +09:00
Yuya Nishihara
2142d803e8 py3: fix repr(util.url) to return system string
This is required on Python 3.
2017-09-03 17:51:23 +09:00
Yuya Nishihara
84faf498bc py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate() 2017-09-03 17:37:17 +09:00
Yuya Nishihara
c05be6158c py3: fix type of attribute name in smartset.py 2017-09-03 17:14:53 +09:00
Yuya Nishihara
6567bed4cb py3: fix mixed bytes/unicode in revsetlang._aliassyminitletters 2017-09-03 17:03:23 +09:00
Yuya Nishihara
a406b0a270 py3: fix type of regex literals in subrepo.py 2017-09-03 15:01:23 +09:00