Commit Graph

6401 Commits

Author SHA1 Message Date
Boris Feld
0e74ab2663 configitems: register the 'convert.hg.saverev' config 2017-06-30 03:35:12 +02:00
Boris Feld
4285533e9f configitems: register the 'convert.hg.revs' config 2017-06-30 03:34:58 +02:00
Boris Feld
796bce4006 configitems: register the 'convert.hg.ignoreerrors' config 2017-06-30 03:34:49 +02:00
Boris Feld
5222300c2f configitems: register the 'convert.hg.clonebranches' config 2017-06-30 03:34:45 +02:00
Boris Feld
16cc412230 configitems: register the 'convert.git.skipsubmodules' config 2017-06-30 03:34:32 +02:00
Boris Feld
1d68ca2454 configitems: register the 'convert.git.similarity' config 2017-06-30 03:34:23 +02:00
Boris Feld
66b082d31c configitems: register the 'convert.git.saverev' config 2017-06-30 03:34:14 +02:00
Boris Feld
1f1b9ffd32 configitems: register the 'convert.git.renamelimit' config 2017-06-30 03:34:06 +02:00
Boris Feld
928c7aa1bb configitems: register the 'convert.git.remoteprefix' config 2017-06-30 03:34:00 +02:00
Boris Feld
6621aa529f configitems: register the 'convert.git.findcopiesharder' config 2017-06-30 03:33:51 +02:00
Boris Feld
6186c0bccf configitems: register the 'convert.git.extrakeys' config 2017-06-30 03:33:41 +02:00
Boris Feld
7c75720e99 configitems: register the 'convert.git.committeractions' config 2017-06-30 03:33:29 +02:00
Boris Feld
c19e6a920f configitems: register the 'convert.cvsps.mergeto' config 2017-06-30 03:33:25 +02:00
Boris Feld
ad979210fc configitems: register the 'convert.cvsps.mergefrom' config 2017-06-30 03:33:15 +02:00
Boris Feld
f6e4ab41d9 configitems: register the 'convert.cvsps.fuzz' config 2017-06-30 03:33:06 +02:00
Boris Feld
fc15e4e927 configitems: register the 'convert.cvsps.cache' config
The convert extensions has code a bit all around, but it seems simpler to use a
central declaration of options at the root first.
2017-06-30 03:32:53 +02:00
Yuya Nishihara
6de6cb029d doctest: upgrade old-style "except" clause 2017-09-03 15:16:01 +09:00
Yuya Nishihara
dcc07e5503 doctest: use print_function and convert bytes to unicode where needed 2017-09-03 14:56:31 +09:00
Yuya Nishihara
a71f259bd2 doctest: bulk-replace string literals with b'' for Python 3
Our code transformer can't rewrite string literals in docstrings, and I
don't want to make the transformer more complex.
2017-09-03 14:32:11 +09:00
Phil Cohen
a1eba8f292 merge: pass wctx to premerge, filemerge
In the in-memory merge branch. we'll need to call a function (``flushall``) on
the wctx inside of _xmerge.

This prepares the way so it can be done without hacks like ``fcd.ctx()``.

Differential Revision: https://phab.mercurial-scm.org/D449
2017-09-11 13:03:27 -07:00
Augie Fackler
85e2672134 merge with stable 2017-09-12 11:18:35 -04:00
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
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
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
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
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
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
Michael Bolin
094c271fff editor: use an unambiguous path suffix for editor files
Changes the API of `ui.edit()` to take an optional `action` argument,
which is used when constructing the suffix of the temp file.
Previously, it was possible to set the suffix by specifying a `suffix` to the
optional `extra` dict that was passed to `ui.edit()`, but the goal is to
drop support for `extra.suffix` and make `action` a required argument.
To this end, `ui.edit()` now yields a `develwarn()` if `action` is not set
or if `extra.suffix` is set.

I updated all calls to `ui.edit()` I could find in `hg-crew` to specify the
appropriate `action`. This means that when creating a commit, instead
of the path to the editor file being something like:

`/tmp/hg-editor-XXXXXX.txt`

it is now something like:

`/tmp/hg-editor-XXXXXX.commit.hg.txt`

Some editors (such as Atom) make it possible to statically define a [TextMate]
grammar for files with a particular suffix. For example, because Git reliably
uses `.git/COMMIT_EDITMSG` and `.git/MERGE_MSG` as the paths for commit-type
messages, it is trivial to define a grammar that is applied when files of
either name are opened in Atom:

https://github.com/atom/language-git/blob/v0.19.1/grammars/git%20commit%20message.cson#L4-L5

Because Hg historically used a generic `.txt` suffix, it was much harder to
disambiguate whether a file was an arbitrary text file as opposed to one
created for the specific purpose of authoring an Hg commit message.

This also makes it easier to add special support for `histedit`, as it has its own
suffix that is distinct from a commit:

`/tmp/hg-histedit-XXXXXX.histedit.hg.txt`

Test Plan:
Added an integration test: `test-editor-filename.t`.

Manually tested: ran `hg ci --amend` for this change and saw that it
used `/tmp/hg-editor-ZZjcz0.commit.hg.txt` as the path instead of
`/tmp/hg-editor-ZZjcz0.txt` as the path.

Verified `make tests` passes.

Differential Revision: https://phab.mercurial-scm.org/D464
2017-08-30 20:25:56 +00:00
Augie Fackler
e2774d9258 python3: wrap all uses of <exception>.strerror with strtolocal
Our string literals are bytes, and we mostly want to %-format a
strerror into a one of those literals, so this fixes a ton of issues.
2017-08-22 20:03:07 -04:00
Jun Wu
0bba32af82 rebase: use _ctxdesc in one more place
This simplifies the code.

Differential Revision: https://phab.mercurial-scm.org/D566
2017-08-29 17:51:54 -07:00
Jun Wu
4e250e8aa3 rebase: move working parent and bookmark for obsoleted revs (BC)
Previously, obsoleted revs with successors in destination are completely
ignored. That caused some inconvenience when working copy is obsoleted. Most
commands avoid working copy being obsoleted, but `hg pull` is an exception.

This patch makes rebase able to move bookmarks or working parent for those
obsoleted revs. It does so by keeping the obsoleted revs in `state` and
marking them as "skipped, rebased to desired destination" during run-time.

This reverts part of the behavior change of 80d53a39fbcc and D24.

Differential Revision: https://phab.mercurial-scm.org/D527
2017-08-27 02:47:47 -07:00
Jun Wu
fc9e88f730 rebase: remove an unnecessary adjustdest in clearrebased
`rev` being "skipped" could currently be caused by moving `rev` does not
create a new commit. In this case, `state[rev]` is already changed to `p1`,
and is a sane destination for bookmark or working parent movement. Therefore
an additional destination adjustment is unnecessary.

Differential Revision: https://phab.mercurial-scm.org/D565
2017-08-29 17:49:13 -07:00
Jun Wu
3d0b72dc6a rebase: sort destmap topologically
Previously rebase source and destination could not overlap. But with the
multi-destination support, source and destination could reasonably partially
overlap. That requires another topological sort on `{sourcerev: destrev}`
graph (destmap). This patch implements that.

If a revision's destination is itself, the error message gets changed from
"source is ancestor of destination" to "source and destination form a
cycle". Not marking as BC since automation should depend on exit code, not
error message.

Differential Revision: https://phab.mercurial-scm.org/D470
2017-08-21 20:22:07 -07:00
Jun Wu
973c4f76d4 rebase: initial support for multiple destinations
This patch defines `SRC` (a single source revision) and `ALLSRC` (all source
revisions) to be valid names in  `--dest` revset if `--src` or `--rev` is
used. So destination could be defined differently according to source
revisions. The names are capitalized to make it clear they are "dynamically
defined", distinguishable from normal revsets (Thanks Augie for the
suggestion).

This is useful, for example, `-r 'orphan()' -d 'calc-dest(SRC)'` to solve
instability, which seems to be a highly wanted feature.

The feature is not completed, namely if `-d` overlaps with `-r`, things
could go wrong. A later patch will handle that case.

The feature is also gated by `experimental.rebase.multidest` config option
which is default off.

Differential Revision: https://phab.mercurial-scm.org/D469
2017-08-29 17:27:37 -07:00
Jun Wu
4706eacb8d rebase: change internal format to support destination map
A later patch will add multiple destination support. This patch changes
internal state and the rebase state file format to support that. But the
external interface still only supports single destination.

A test was added to make sure rebase still supports legacy state file.

The new state file is incompatible with old clients. We had done similar
state file format change before: 5eac7ab, 92409f8, and 72412af. The state
file is transient, so the impact of incompatibility is limited. Besides,
the old client won't support multiple destinations anyway so it does not
really make sense to make the file format compatible with them.

Differential Revision: https://phab.mercurial-scm.org/D348
2017-08-11 00:32:19 -07:00
Jun Wu
7eaa8f29d7 rebase: rewrite _computeobsoletenotrebased
The old code stores successors of all related nodes together, which works
fine if destination is unique. A future patch would make destination
non-unique so let's change the implementation to test successors for
rebaseset separately.

Differential Revision: https://phab.mercurial-scm.org/D347
2017-08-11 00:31:52 -07:00
Rishabh Madan
f35bfd559f releasenotes: view admonition titles using -l flag
Since this extension is fairly new for almost all the contributors, remembering
the admonition (with titles) is difficult. The list (-l) flag provides
a list of all the active admonitions along with titles.

For usage, hg releasenotes -l returns the list.

Differential Revision: https://phab.mercurial-scm.org/D454
2017-08-28 04:11:58 +05:30
Jun Wu
00a74fd4f2 journal: do not use atomictemp (issue5338)
Writing journal files using `atomictemp` leads to quadratic performance that
could be problematic if automation runs many commands. Other logs like
blackbox does not use atomictemp, and journal logs are not critical for repo
correctness. So let's make them non-atomictemp.

Differential Revision: https://phab.mercurial-scm.org/D517
2017-08-24 21:43:54 -07:00
Rishabh Madan
973eda14de releasenotes: add check flag for use of admonitions and its validity
While using releasenotes extension, we will be using admonitions in commit messages.
The check (-c) flag will look for an admonition within the message. If it exists, it will
verify if it is stated under default or custom admonition. The check fails if the
admonition is not present in any of them. It also suggests similar admonitions
in case the admonition is invalid.

Differential Revision: https://phab.mercurial-scm.org/D368
2017-08-13 19:58:45 +05:30
Jun Wu
d84c305f2a rebase: only change self.state when collapsing in _finishrebase
When the code executes to _finishrebase, self.state should be populated with
correct destinations and do not need to be written to a node. The code was
introduced by 8dc45c9059, which seems to avoid setting state values to None
but it didn't provide more details.

Differential Revision: https://phab.mercurial-scm.org/D346
2017-08-11 01:34:11 -07:00
Jun Wu
13f8aae09c rebase: choose merge base without unwanted revisions
Previously, when there are 2 merge base candidates, we choose p1 blindly,
which may make the merge result to have "unwanted content". This patch makes
rebase smarter - choose a merge base that does not have "unwanted revs" if
possible. Since we don't really have a good solution when there are
"unwanted revs", abort in that case.

Differential Revision: https://phab.mercurial-scm.org/D340
2017-08-10 22:17:15 -07:00
Jun Wu
7c75b06935 rebase: optimize "source" calculation in adjustdest
The "source" variable is calculated inside a loop but it does not depend on
loop variables. Therefore move it outside the loop.

Differential Revision: https://phab.mercurial-scm.org/D345
2017-08-11 01:08:07 -07:00
Jun Wu
7793d2cdf5 rebase: remove "state >= revtodo" condition
Now the minimal value of state is revtodo, that condition is always true,
therefore removed.

Differential Revision: https://phab.mercurial-scm.org/D344
2017-08-11 01:36:59 -07:00
Jun Wu
0c8152cb4c rebase: remove self.destancestors
The state is no longer used after calculating "self.external", therefore
removed.

Differential Revision: https://phab.mercurial-scm.org/D343
2017-08-11 01:05:47 -07:00
Jun Wu
e1a6ae2bac rebase: remove rebaseset from _checkobsrebase
The parameter is not used. Therefore removed.

Differential Revision: https://phab.mercurial-scm.org/D85
2017-07-14 09:01:45 -07:00
Jun Wu
79f323ea22 rebase: remove revignored and nullmerge states
They are no longer necessary to make rebase behavior correct. Therefore
remove them to make the code cleaner and easier to reason about.

Differential Revision: https://phab.mercurial-scm.org/D26
2017-07-10 12:18:32 -07:00
Jun Wu
075caa84b6 rebase: remove messages for nullmerge and revignored (BC)
These states will be removed to make the code cleaner and more robust.
Remove their messages first to make review easier.

Differential Revision: https://phab.mercurial-scm.org/D25
2017-07-08 20:38:34 -07:00
Jun Wu
0f5023c94c rebase: remove revprecursor and revpruned states (BC)
Those states are no longer necessary for rebase to function properly. Remove
them to make the code cleaner.

Marked as BC because in a corner case where working parent is obsoleted, and
is skipped for rebase, we no longer move working parent after rebase
completes. That is better since if working parent is obsoleted, it should be
the user moving working parent back there (after a rebase) explicitly, in
that case, we shouldn't move working parent again.

Differential Revision: https://phab.mercurial-scm.org/D24
2017-07-08 20:38:34 -07:00
Jun Wu
d763d13686 rebase: move obsoleted not rebased messages earlier (BC)
A later patch will clean up those states. This patch moves the messages
earlier.

Marked as BC since the order of message has changed.

Differential Revision: https://phab.mercurial-scm.org/D23
2017-07-08 20:14:33 -07:00
Jun Wu
5fe54ecae3 rebase: extract ctx description logic to a function
The function will be used in a later patch.

Differential Revision: https://phab.mercurial-scm.org/D22
2017-07-08 20:05:52 -07:00
Augie Fackler
a80f148d0c py3: introduce a wrapper for __builtins__.{raw_,}input()
In order to make this work, we have to wrap the io streams in a
TextIOWrapper so that __builtins__.input() can do unicode IO on Python
3. We can't just restore the original (unicode) sys.std* because we
might be running a cmdserver, and if we blindly restore sys.* to the
original values then we end up breaking the cmdserver. Sadly,
TextIOWrapper tries to close the underlying stream during its __del__,
so we have to make a sublcass to prevent that.

If you see errors like:

TypeError: a bytes-like object is required, not 'str'

On an input() or print() call on Python 3, the substitution of
sys.std* is probably the root cause.

A previous version of this change tried to put the bytesinput() method
in pycompat - it turns out we need to do some encoding handling, so we
have to be in a higher layer that's allowed to use
mercurial.encoding.encoding. As a result, this is in util for now,
with the TextIOWrapper subclass hiding in encoding.py. I'm not sure of
a better place for the time being.

Differential Revision: https://phab.mercurial-scm.org/D299
2017-07-24 14:38:40 -04:00
FUJIWARA Katsunori
d3e11740a0 largefiles: fix help text to avoid warning at "make update-pot"
This change helps hggettext to find out help text in original source,
because it assumes that backslash ('\') is doubled in docstring.
2017-08-02 01:15:07 +09:00
Jun Wu
7a9096496d rebase: change "result would have 3 parent" error message (BC)
The old error message "cannot use revision REV as base, result would have 3
parents" is confusing - why use REV as base? why add a new parent?.

This patch changes it to "cannot move parent", which seems better.

Differential Revision: https://phab.mercurial-scm.org/D342
2017-08-12 21:01:06 -07:00
Jun Wu
87f820de49 rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:

  - Assertion error: no base found (demonstrated by D212, issue5578)
  - Asymmetric result (demonstrated by D211, "F with one parent")
  - Wrong new parent (demonstrated by D262, "C':A'A'")
  - "revlog index out of range" (demonstrated by D262, issue5630)
  - "nothing to merge" (demonstrated by D262)

As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.

.. fix:: Issue 5578, Issue 5630

   Core rebase algorithm has been rewritten to be more robust.

Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-10 21:30:31 -07:00
Rishabh Madan
4829d3de30 releasenotes: minor bug fix for index error while serializing
Differential Revision: https://phab.mercurial-scm.org/D356
2017-08-12 09:21:42 +05:30
Jun Wu
c218b8b432 fsmonitor: correct an error message
Without the change, the error looks like:

  warning: Watchman unavailable: "watchman" executable not in PATH (%s),
  while executing [Errno 2] No such file or directory

With the change, it now looks like:

  warning: Watchman unavailable: "watchman" executable not in PATH
  ([Errno 2] No such file or directory)

Differential Revision: https://phab.mercurial-scm.org/D322
2017-08-10 09:37:50 -07:00
Gregory Szorc
ad1ddbea6f largefiles: remove remotestore.batch()
This method was added in 6fb54510b150. AFAICT it didn't do anything at
inception. If it did, there was no test coverage for it because
changing it to raise doesn't fail any tests at that revision.

3bcb9f9a4a63 later refactored all remote.batch() calls to
remote.iterbatch(). So if this was somehow used, it isn't called
any more because there are no calls to .batch() remaining in the
repo.

I suspect the original patch author got confused by the distinction
between the peer/remote interface and the largefiles store. The lf
store is a gateway to a peer instance. It exposes additional
lf-specific methods to execute against a peer. However, it is not
a peer and doesn't need to implement batch() because peer itself
does that.

Differential Revision: https://phab.mercurial-scm.org/D316
2017-08-09 21:04:03 -07:00
André Klitzing
fb861bea86 histedit: check first changeset for verb "roll" or "fold" (issue5498)
If someone changes "pick" to "roll" or "fold" for the first
changeset in a histedit rule Mercurial could remove a wrong
changeset if the phase is non-public.

roll or fold for the first changeset should be invalid.
2017-08-11 15:20:41 +02:00
Boris Feld
b1539c55c0 configitems: register the 'notify.test' config 2017-06-30 03:43:31 +02:00
Boris Feld
a40deebbae configitems: register the 'notify.template' config 2017-06-30 03:43:30 +02:00
Boris Feld
540c73467b configitems: register the 'notify.style' config 2017-06-30 03:43:29 +02:00
Boris Feld
a8dced4101 configitems: register the 'notify.strip' config 2017-06-30 03:43:28 +02:00
Boris Feld
f3bd1de48b configitems: register the 'notify.sources' config 2017-06-30 03:43:27 +02:00
Boris Feld
d32ccbab59 configitems: register the 'notify.merge' config 2017-06-30 03:43:26 +02:00
Boris Feld
43c3734660 configitems: register the 'notify.mbox' config 2017-06-30 03:43:25 +02:00
Boris Feld
a8548941d5 configitems: register the 'notify.maxsubject' config 2017-06-30 03:43:24 +02:00
Boris Feld
183f3607c4 configitems: register the 'notify.maxdiff' config 2017-06-30 03:43:23 +02:00
Boris Feld
9400d81aec configitems: register the 'notify.fromauthor' config 2017-06-30 03:43:22 +02:00
Boris Feld
0e80269f91 configitems: register the 'notify.domain' config 2017-06-30 03:43:20 +02:00
Boris Feld
77b5c0d17a configitems: register the 'notify.diffstat' config 2017-06-30 03:43:19 +02:00
Boris Feld
16425ec90a configitems: register the 'notify.config' config 2017-06-30 03:43:18 +02:00
Augie Fackler
ef945af30b merge with stable 2017-08-10 18:55:33 -04:00
Augie Fackler
9a0febea27 merge with stable 2017-08-10 14:23:41 -04:00
Rishabh Madan
0c4fe49845 releasenotes: add similarity check function to compare incoming notes
It is possible that the incoming note fragments have some similar content as the
existing release notes. In case of a bug fix, we match for issueNNNN in the
existing notes. For other general cases, it makes use of fuzzywuzzy library to get
a similarity score. If the score is above a certain threshold, we ignore the
fragment, otherwise add it. But the score might be misleading for small commit
messages. So, it uses similarity function only if the length of string (in words)
is above a certain value. The patch adds tests related to its usage. But it needs
improvement in the sense of combining incoming notes. We can use interactive mode
for adding notes. Maybe we can do this if similarity is under a certain range.
2017-08-05 05:25:36 +05:30
Kostia Balytskyi
ebe8e04f0d sparse: treat paths as cwd-relative
This commit makes it so sparse treats passed paths as CWD-relative,
not repo-root-realive. This is a more intuitive behavior in my (and some
other FB people's) opinion.

This is breaking change however. My hope here is that since sparse is
experimental, it's ok to introduce BCs.

The reason (glob)s are needed in the test is this: in these two cases we
do not supply path together with slashes, but `os.path.join` adds them, which
means that under Windows they can be backslashes. To demonstrate this behavior,
one could remove the (glob)s and run `./run-tests.py test-sparse.t` from
MinGW's terminal on Windows.
2017-08-04 05:38:22 -07:00
Durham Goode
87e4b5267e rebase: use one dirstateguard for when using rebase.singletransaction
This was previously landed as 4bc0c14fb501 but backed out in b63351f6a2 because
it broke hooks mid-rebase and caused conflict resolution data loss in the event
of unexpected exceptions. This new version adds the behavior back but behind a
config flag, since the performance improvement is notable in large repositories.

The old commit message was:

Recently we switched rebases to run the entire rebase inside a single
transaction, which dramatically improved the speed of rebases in repos with
large working copies. Let's also move the dirstate into a single dirstateguard
to get the same benefits. This let's us avoid serializing the dirstate after
each commit.

In a large repo, rebasing 27 commits is sped up by about 20%.

I believe the test changes are because us touching the dirstate gave the
transaction something to actually rollback.
(grafted from 9e3dc3a1638b9754b58a0cb26aaa75d868058109)
(grafted from 7d38b41d2266d9a02a15c64229fae0da5738dcec)

Differential Revision: https://phab.mercurial-scm.org/D135
2017-07-20 01:30:41 -07:00
Martin von Zweigbergk
e9ccfc8938 shelve: don't reimplement mergestate.unresolved() 2015-12-01 09:19:54 -08:00
Gregory Szorc
fa7c02cef4 sparse: move some temporary includes functions into core
Functions for reading and writing the tempsparse file have been
moved. prunetemporaryincludes() will be moved separately
because it is non-trivial.
2017-07-06 14:48:16 -07:00
Gregory Szorc
23bd6434bf sparse: move config file writing into core
The code was refactored during the move to be more procedural
instead of using string formatting. This has the benefit of not
writing empty sections, which changed tests.
2017-07-06 12:24:55 -07:00
Gregory Szorc
0cd417305b localrepo: add sparse caches
The sparse extension maintains caches for the sparse files
to a signature and a signature to a matcher. This allows the
sparse matchers to be resolved quickly, which is apparently
something that can occur in loops.

This patch ports the sparse caches to the localrepo class
pretty much as-is. There is potentially room to improve the
caching mechanism. But that can be done as a follow-up.

The default invalidatecaches() now clears the relevant sparse
cache. invalidatesignaturecache() has been moved to sparse.py.
2017-07-06 12:20:53 -07:00
Gregory Szorc
82797a75d4 sparse: move active profiles function into core
Also includes some light formatting changes.
2017-07-06 12:26:04 -07:00
Gregory Szorc
b77eafa212 sparse: move resolving of sparse patterns for rev into core
This method is reasonably well-contained and simple to move.

As part of the move, some light formatting was performed.

A "working copy" reference in an error message was changed to
"working directory."

The biggest change was to _refreshoncommit() in sparse.py. It
was previously checking for the existence of an attribute on
the repo instance. Since the moved function now returns empty
data if sparse isn't enabled, we unconditionally call the
new function. However, we do have to protect another method
call in that function. This will all be unhacked eventually.
2017-07-06 12:15:14 -07:00
Gregory Szorc
19d9143b89 sparse: variable to track if sparse is enabled
Currently, the sparse extension sniffs repo instances for
attributes defined by the sparse extension to determine if
sparse is enabled. As we move code away from repo instances,
these checks will be a bit more brittle.

We introduce a module-level variable to track whether sparse is
enabled as a temporary workaround.
2017-07-06 12:06:37 -07:00
Gregory Szorc
c16ee0ee8c sparse: move profile reading into core
One more step towards weaning off methods on repo instances and
moving code to core. While this function is only used once and
is simple, it needs to exist on its own so Facebook can monkeypatch
it to enable simplecache integration.
2017-07-06 12:14:12 -07:00
Gregory Szorc
2316ea9a38 sparse: move config parsing into core
This patch marks the beginning of moving code from the sparse
extension into core. The goal is to move as much of the
functionality as possible into core, where it will be an
experimental feature. The extension will likely continue to
exist to enable the feature and provide UI elements.

As part of the move, the repo method was converted to a module
function. It doesn't need to exist on repos.

An error message was also updated to reflect that an error isn't
necessarily from the .hg/sparse file. The API should be updated
later to pass in a filename so the error can be more descriptive.

Copyright of the added file was copied from the sparse extension.
2017-07-06 12:14:03 -07:00
Gregory Szorc
1db9bed779 sparse: use vfs.tryread()
vfs.exists() followed by a file read is an anti-pattern because it
incurs an extra stat() to test for file presence. vfs.tryread()
returns empty string on missing file and avoids the stat().
2017-07-06 10:58:45 -07:00
Gregory Szorc
49b16cba64 sparse: refactor sparsechecksum()
This was relying on garbage collection to close the opened
file, which is a bug. Both callers simply called into self.vfs
to resolve the path. So refactor to use the vfs layer.

While we're here, rename the method to reflect it is internal
and to break anyone relying on the old behavior.
2017-07-01 11:56:39 -07:00
Gregory Szorc
8febc1c48e sparse: document config file format
This was previously undocumented. Seems useful to have.
2017-07-06 10:57:26 -07:00
Gregory Szorc
259226f5d1 sparse: rename command to debugsparse
Sparse checkout is still highly experimental and not protected
by BC guarantees yet. We also haven't had a discussion on the UX.

To discourage use, we rename the sparse command to debugsparse.
2017-07-01 10:29:27 -07:00
Gregory Szorc
6a8520b1b6 sparse: remove reference to simplecache
This is a 3rd party extension authored by Facebook. References in
core are not appropriate.

It will be possible to restore this code/optimization via
monkeypatching. So Facebook won't lose any functionality.

The removed code is important for performance. So add a comment
tracking it.
2017-07-06 10:54:23 -07:00
Gregory Szorc
4ff8c49366 sparse: remove reference to hgwatchman
This is a legacy extension. Now that the extension is in core,
we only need to support what's in core, which is fsmonitor.
2017-07-01 10:24:31 -07:00
Gregory Szorc
6301d186f7 sparse: expand module docstring
Clarify lack of BC guarantees. And say a bit more about the extension.
2017-07-01 10:36:03 -07:00
Gregory Szorc
82b7f72254 sparse: vendor Facebook-developed extension
Facebook has developed an extension to enable "sparse" checkouts -
a working directory with a subset of files. This feature is a critical
component in enabling repositories to scale to infinite number of
files while retaining reasonable performance. It's worth noting
that sparse checkout is only one possible solution to this problem:
another is virtual filesystems that realize files on first access.
But given that virtual filesystems may not be accessible to all
users, sparse checkout is necessary as a fallback.

Per mailing list discussion at
https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095868.html
we want to add sparse checkout to the Mercurial distribution via
roughly the following mechanism:

1. Vendor extension as-is with minimal modifications (this patch)
2. Refactor extension so it is more clearly experimental and inline
   with Mercurial practices
3. Move code from extension into core where possible
4. Drop experimental labeling and/or move feature into core
   after sign-off from narrow clone feature owners

This commit essentially copies the sparse extension and tests
from revision 71e0a2aeca92a4078fe1b8c76e32c88ff1929737 of the
https://bitbucket.org/facebook/hg-experimental repository.

A list of modifications made as part of vendoring is as follows:

* "EXPERIMENTAL" added to module docstring
* Imports were changed to match Mercurial style conventions
* "testedwith" value was updated to core Mercurial special value and
  comment boilerplate was inserted
* A "clone_sparse" function was renamed to "clonesparse" to appease
  the style checker
* Paths to the sparse extension in tests reflect built-in location
* test-sparse-extensions.t was renamed to test-sparse-fsmonitor.t
  and references to "simplecache" were removed. The test always skips
  because it isn't trivial to run it given the way we currently run
  fsmonitor tests
* A double empty line was removed from test-sparse-profiles.t

There are aspects of the added code that are obviously not ideal.
The goal is to make a minimal number of modifications as part of
the vendoring to make it easier to track changes from the original
implementation. Refactoring will occur in subsequent patches.
2017-07-01 10:43:29 -07:00
Pierre-Yves David
0c7dcefb43 configitems: register the 'factotum.service' config 2017-06-30 03:42:15 +02:00
Pierre-Yves David
cf658b866d configitems: register the 'factotum.mountpoint' config 2017-06-30 03:42:13 +02:00
Pierre-Yves David
5fe99bc6f6 configitems: register the 'factotum.executable' config 2017-06-30 03:42:12 +02:00
Pierre-Yves David
afaa007c67 configitem: create a new list of each 'acl.sources' access
Thanks for goes to Yuya for spotting this.
2017-07-02 23:10:33 +02:00
Gregory Szorc
42af67624f show: document why accidentally quadratic is (probably) acceptable 2017-07-03 21:26:39 -07:00
Gregory Szorc
0a3762821d show: also catch AmbiguousCommand
cmdutil.findcmd() can raise this as well. While we'll almost certainly
never encounter this in the wild, guard against it regardless.
2017-07-03 21:18:32 -07:00
Gregory Szorc
ef389a50e2 show: avoid extra list operations 2017-07-03 21:12:04 -07:00
Gregory Szorc
663cfcdd36 show: tweak warning message
'.' is "working directory parent" not "working directory."
2017-07-03 21:10:48 -07:00
Gregory Szorc
0520797e9d show: implement "stack" view
People often want to know what they are working on *now*. As part of
this, they also commonly want to know how that work is related to other
changesets in the repo so they can perform common actions like rebase,
histedit, and merge.

`hg show work` made headway into this space. However, it is geared
towards a complete repo view as opposed to just the current line of
work. If you have a lot of in-flight work or the repo has many heads,
the output can be overwhelming. The closest thing Mercurial has to
"show me the current thing I'm working on" that doesn't require custom
revsets is `hg qseries`. And this requires MQ, which completely changes
workflows and repository behavior and has horrible performance on large
repos. But as sub-optimal as MQ is, it does some things right, such as
expose a model of the repo that is easy for people to reason about.
This simplicity is why I think a lot of people prefer to use MQ, despite
its shortcomings.

One common development workflow is to author a series of linear
changesets, using bookmarks, branches, anonymous heads, or even topics
(3rd party extension). I'll call this a "stack." You periodically
rewrite history in place (using `hg histedit`) and reparent the stack
against newer changesets (using `hg rebase`). This workflow can be
difficult because there is no obvious way to quickly see the current
"stack" nor its relation to other changesets. Figuring out arguments to
`hg rebase` can be difficult and may require highlighting and pasting
multiple changeset nodes to construct a command.

The goal of this commit is to make stack based workflows simpler
by exposing a view of the current stack and its relationship to
other releant changesets, notably the parent of the base changeset
in the stack and newer heads that the stack could be rebased or merged
into.

Introduced is the `hg show stack` view. Essentially, it finds all
mutable changesets from the working directory revision in both
directions, stopping at a merge or branch point. This limits the
revisions to a DAG linear range.

The stack is rendered as a concise list of changesets. Alongside the
stack is a visualization of the DAG, similar to `hg log -G`.

Newer public heads from the branch point of the stack are rendered
above the stack. The presence of these heads helps people understand
the DAG model and the relationship between the stack and changes made
since the branch point of that stack. If the "rebase" command is
available, a `hg rebase` command is printed for each head so a user
can perform a simple copy and paste to perform a rebase.

This view is alpha quality. There are tons of TODOs documented
inline. But I think it is good enough for a first iteration.
2017-07-01 22:38:42 -07:00
Pierre-Yves David
dd58f467f2 configitems: register the 'blackbox.logsource' config 2017-06-30 03:28:18 +02:00
Pierre-Yves David
e633829f37 configitems: register the 'blackbox.dirty' config 2017-06-30 03:28:11 +02:00
Pierre-Yves David
6b8771d327 configitems: register the 'automv.similarity' config
Default value has been ported.
2017-06-30 03:27:24 +02:00
Pierre-Yves David
0554b7fad5 acl: use configlist to retrieve the source config
This is what the previous code was about.
2017-07-01 20:58:34 +02:00
Pierre-Yves David
137b284c91 configitems: register the 'acl.sources' config
The existing default value is now formally declared. It seems like the whole
config should be a list, but this is an adventure for the next changesets.
2017-06-30 03:27:07 +02:00
Pierre-Yves David
ba936f63d6 configitems: register the 'acl.config' config 2017-06-30 03:26:57 +02:00
Pierre-Yves David
d997c3083a zeroconf: blindly forward extra argument to the core config method
The new default value handling is simpler if we let the original function handle
everything.
2017-07-01 21:57:17 +02:00
Martin von Zweigbergk
6ec81d71ce rebase: always pass destination as revnum to _handleskippingobsolete()
We were passing it as a revision number in one place and as a context
in another. It worked because the only use was in "repo[dest].rev()",
but it was confusing. By always passing a revision number, we can also
remove that unnecessary lookup.
2017-06-28 14:53:54 -07:00
Pierre-Yves David
719387c7c7 obsutil: move 'allsuccessors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:36:20 +02:00
Martin von Zweigbergk
3ce6c1796d merge with stable 2017-06-29 15:21:52 -07:00
Pierre-Yves David
17353b92ba rebase: backed out changeset 507f16f4aa51 (issue5610)
Having a single transaction for rebase means the whole transaction gets rolled back
on error. To work around this a small hack has been added to detect merge
conflict and commit the work done so far before exiting. This hack works because
there is nothing transaction related going on during the merge phase.

However, if a hook blocks the rebase to create a changeset, it is too late to commit the
work done in the transaction before the problematic changeset was created. This
leads to the whole rebase so far being rolled back. Losing merge resolution and
other work in the process. (note: rebase state will be fully lost too).

Since issue5610 is a pretty serious regression and the next stable release is a
couple day away, we are taking the backout route until we can figure out
something better to do.
2017-06-27 17:40:24 +02:00
Pierre-Yves David
70672e4541 rebase: backed out changeset 4bc0c14fb501
In the process of fixing issue5610 in 4.2.2, we are trying to backout
507f16f4aa51. This changeset is making changes that depend on 507f16f4aa51,
so we need to back it out first.

Since issue5610 is pretty serious regression and the next stable release is a
couple of days away, we are taking the backout route until we can figure out
something better to do.
2017-06-27 17:39:55 +02:00
Gregory Szorc
800ebdc7ca show: config option to register aliases for views
As part of using `hg show` in my daily workflow, I've found it slightly
annoying to have to type full view names, complete with a space. I've
locally registered an alias for "swork = show work."

I think others will have this same complaint and could benefit from
some automation to streamline the creation of aliases. So, this
commit introduces a config option that allows `hg show` views to be
automatically aliased using a given prefix. e.g. a value of "s"
will automatically register "swork" and "sbookmarks." Multiple
values can be given for ultimate flexibility. This arguably isn't
needed now. But since we don't register aliases if there will be
a collision and we're bound to have a collision, it makes sense to
allow multiple prefixes so specific views can avoid collisions by
using different prefixes.
2017-06-25 22:20:37 -07:00
Pierre-Yves David
1b59e168fe eol: fix 'error' parameter name in the commitctx wrapper
Since its introduction in c7ec460797a9, the parameter has always been name
"error". Yet the eol extension have been using 'haserror' as the argument name,
breaking extensions with subclass passing 'error' as a keyword argument.
2017-06-23 13:22:04 +02:00
Pierre-Yves David
f83c410836 eol: import 'error' as 'errormod'
We need the 'error' name available to fix another bug, so we rename the imported
module.
2017-06-23 13:24:45 +02:00
Pierre-Yves David
69222bbf87 blackbox: use a human readable version of the default
Now that the default value is also converted we can use a human readable version
for it. This will be useful if we start to automatically display the default
config value in various place.
2017-06-18 20:49:08 +02:00
Pierre-Yves David
050ba47e1c configitems: register 'blackbox.maxsize' as an example of 'configbytes'
This exercise the default value handling in 'configbytes'.
2017-06-17 13:21:06 +02:00
Pierre-Yves David
85f9bed0b5 blackbox: minor code reordering
The version declaration should come first in my opinion. This will help gather
the command table with the config table.
2017-06-17 13:41:28 +02:00
FUJIWARA Katsunori
07e0e6566d keyword: wrap functions only once at loading keyword extension
Before this patch, some functions are wrapped in reposetup(), but this
causes redundant nested wrapping, if two ore more repositories enable
keyword extension (e.g. hgweb serves multiple repositories).

Now, there is no need to define these wrapper functions in
reposetup(), because previous patches made them not directly refer to
kwtemplater instanciated in reposetup().

This patch factors these wrapper functions out from reposetup(), and
uses them to wrap functions only at once at loading keyword extension.
2017-06-26 03:47:11 +09:00
FUJIWARA Katsunori
2e705b83b8 keyword: use _keywordkwt of repository instead of kwtools['templater']
Now, kwtemplater instance can be obtained via _keywordkwt property of
repository.
2017-06-26 03:46:17 +09:00
FUJIWARA Katsunori
d5dd62b804 keyword: obtain kwtemplater instance via repository at runtime
Wrapper functions of keyword extension are defined in reposetup(),
because they refer to kwtemplater instantiated in reposetup().

This patch makes them obtain kwtemplater instance via repository at
runtime. For reviewability, this patch focuses on wrapper functions,
which handle generator.

This is a part of preparations for defining them statically.
2017-06-26 03:44:50 +09:00
FUJIWARA Katsunori
194e8aed9d keyword: obtain kwtemplater instance via repository at runtime
Wrapper functions of keyword extension are defined in reposetup(),
because they refer to kwtemplater instantiated in reposetup().

This patch makes them obtain kwtemplater instance via repository at
runtime.

This is a part of preparations for defining them statically.
2017-06-26 03:43:47 +09:00
FUJIWARA Katsunori
5ed9c1efe5 keyword: make wrapped repository and kwtemplater refer to each other
Wrapper functions of keyword extension are defined in reposetup(),
because they refer to kwtemplater instantiated in reposetup().

But these functions can be defined statically, if kwtemplater can be
obtained via repository at runtime.

This is a part of preparations for defining them statically.

To avoid cyclic reference, this patch makes kwtemplater use weakref to
refer related repository instance.
2017-06-26 03:42:17 +09:00
FUJIWARA Katsunori
3692ff90a9 keyword: make comparison webcommand suppress keyword expansion
Before this patch, diff in "comparison" webcommand doesn't suppress
keyword expansion as same as diff output of other webcommands.
2017-06-26 03:40:12 +09:00
FUJIWARA Katsunori
68301828cc keyword: restore kwtemplater.match at the end of wrapped webcommands
Before this patch, kwweb_skip doesn't restore kwtemplater.match after
wrapped webcommands. This suppresses keyword expansion at wrapped
webcommands.

Typical usecase of this issue is "file" webcommand after annotate,
changeset, filediff or so on.

To ensure kwtemplater.match=util.never while original webcommand
running, this patch makes kwweb_skip yield values returned by it,
because it returns generator object.
2017-06-26 03:40:06 +09:00
FUJIWARA Katsunori
bd6e3a5360 keyword: restore kwtemplater.restrict at the end of wrapped patch.diff
Before this patch, kwdiff doesn't restore kwtemplater.restrict after
invocation of wrapped patch.diff(). This suppresses keyword expansion
at subsequent filelog.read().

Typical usecase of this issue is "hg cat" after "hg diff" with command
server. In this case, kwtemplater.restrict=True is kept in command
server process even after "hg diff".

To ensure kwtemplater.restrict=True while original patch.diff()
running, this patch makes kwdiff() yield values returned by it,
because it returns generator object.

Strictly speaking, if filelog.read() is invoked before completely
evaluating the result of previous patch.diff(), keyword expansion is
still suppressed, because kwtemplater.restrict isn't restored yet.

But this fixing should be reasonable enough, because patch.diff() is
consumed immediately, AFAIK.
2017-06-26 03:38:12 +09:00
Jun Wu
e906874924 rebase: clean up rebasestate from active transaction
Previously, rebase assumes the following pattern:

    rebase:
        with transaction as tr: # top-level
            ...
        tr.__close__ writes rebasestate
        unlink('rebasestate')

However it's possible that "rebase" was called inside a transaction:

    with transaction as tr1:
        rebase:
            with transaction as tr2: # not top-level
                ...
            tr2.__close__ does not write rebasestate
            unlink('rebasestate')
    tr1.__close__ writes rebasestate

That leaves a rebasestate on disk incorrectly.

This patch adds "removefilegenerator" to notify transaction code that the
state file is no longer needed therefore fixes the issue.
2017-06-24 21:13:48 -07:00
Gregory Szorc
29b466d186 show: construct changeset templater during dispatch
Previously, we constructed a formatter from a specific template
topic. Then from show() we reached into the internals of the
formatter to resolve a template string to be used to construct
a changeset templater.

A downside to this approach was it limited us to having the
entire template defined in a single entry in the map file. You
couldn't reference other entries in the map file and this would
lead to long templates and redundancy in the map file.

This commit teaches @showview how to instantiate a changeset
templater so we can construct a templater with full access to
the map file. To prove it works, we've split "showwork" into
components.
2017-06-24 12:47:25 -07:00
Martin von Zweigbergk
2625447afc bundle: make applybundle() delegate v1 bundles to applybundle1() 2017-06-22 15:00:19 -07:00
Martin von Zweigbergk
eae1a1d9e5 bundle: add a applybundle1() method
This is one step towards removing a bunch of "if isinstance(gen,
unbundle20)" by treating bundle1 and bundle2 more similarly.

The name may sounds ironic for a method in the bundle2 module, but I
didn't think it was worth it yet to create a new 'bundle' module that
depends on the 'bundle2' module. Besides, we'll inline the method
again later.
2017-06-16 10:25:11 -07:00
Yuya Nishihara
7cb7db88bb share: use dict literal instead of dict(key=value)
check-code.py has the rule, but it isn't smart enough to catch this.
2017-06-24 13:20:30 +09:00
Pulkit Goyal
b623e66ff3 py3: use r'' to prevent conversion to bytes by transformer 2017-06-22 03:24:12 +05:30
FUJIWARA Katsunori
ec156d9a8a fetch: remove shorthand of --edit colliding against -e/-ssh in remoteopts (BC)
Before this patch, -e/--edit and -e/--ssh of fetch command collide
against each other. This causes that -e is treated as shorthand of
--edit but doesn't work as same as --edit. Therefore, -e works as
neither --edit nor --ssh, in practice.

This issue was introduced at f54ee4b17f46 (or 1.0), which renamed
-f/--force-editor to -e/--edit. At that point, -e was already used as
shorthand of --ssh.

After this patch, -e is treated as shorthand of --ssh.

This patch is marked as "(BC)", because -e as shorthand of --edit in
existing scripts causes failure (or unexpected result) after this
patch. This impact should be less enough, because --edit mainly
focuses on interactive use.

BTW, test-duplicateoptions.py (since 1f980ef518d2 or 1.9) can't detect
this kind of issues as expected, because direct invocation of
extensions.loadall() doesn't involve registration of commands defined
in extensions (this issue is fixed in subsequent patch).
2017-06-24 02:39:13 +09:00
Rishabh Madan
f74a00edef releasenotes: improve parsing around bullet points
Earlier, on parsing the bullet points from existing release notes the bullet
points after the first one weren't written correctly to the notes file. This
patch makes changes to parsereleasenotesfromfile() function that introduces a new
bullet_points data structure that tracks the bullets and associated subparagraph.
It also makes necessary changes to the tests related to merging of bullets.
2017-06-23 17:15:53 +02:00
Matt Harbison
3a1dae7593 largefiles: avoid a crash when archiving a subrepo with largefiles disabled
This path is also used for extdiff, which is how I crossed paths with it.
Without this, an AttributeError occurs looking for 'lfstatus' on
localrepository.  See also ca0085e432d6.

The other archive method is for the archival.py override, so it doesn't need to
be special cased like this.  (It looks like it is only called for the top level
repo.)  Likewise, the transplant override is also for commands.py.  The other
overrides set lfstatus before examining it.
2017-06-13 22:24:41 -04:00
Augie Fackler
a22823ec45 merge with stable 2017-06-23 15:30:27 -04:00
Jun Wu
52b1076198 shelve: allow unlimited shelved changes per name
Previously, there is a 100 changes limit per name (bookmark or named
branch). And the user will get "too many shelved changes named %s" when they
are trying to shelve the 101th change. I hit that error message today.

This limit was introduced by the shelve extension since the beginning.
The function generating the names was called "gennames", under
"getshelvename".

There is another "gennames" under "backupfilename":

    def backupfilename(self):
        def gennames(base):
            yield base
            base, ext = base.rsplit('.', 1)
            for i in itertools.count(1):
                yield '%s-%d.%s' % (base, i, ext)

"itertools.count" is an endless counter.

Since the other "gennames" generates unlimited number of names, and the
changeset introducing the limit (49d4919d21) does not say why the limit
is useful. It seems safe to just remove the limit.

The format "%02d" was kept intentionally so existing shelved changes won't
break.
2017-06-20 23:39:59 -07:00
Wagner Bruna
8d9192e033 bugzilla: fix typo in help text 2017-05-31 19:24:00 -03:00
FUJIWARA Katsunori
80da112aee win32mbcs: avoid unintentional failure at colorization
Since 1d07d9da84a0, pycompat.bytestr() wrapped by win32mbcs returns
unicode object, if an argument is not byte-str object. And this causes
unexpected failure at colorization.

pycompat.bytestr() is used to convert from color effect "int" value to
byte-str object in color module. Wrapped pycompat.bytestr() returns
unicode object for such "int" value, because it isn't byte-str.

If this returned unicode object is used to colorize non-ASCII byte-str
in cases below, UnicodeDecodeError is raised at an operation between
them.

  - colorization uses "ansi" color mode, or

    Even though this isn't default on Windows, user might use this
    color mode for third party pager.

  - ui.write() is buffered with labeled=True

    Buffering causes "ansi" color mode internally, regardless of
    actual color mode. With "win32" color mode, extra escape sequences
    are omitted at writing data out.

    For example, with "win32" color mode, "hg status" doesn't fail for
    non-ASCII filenames, but "hg log" does for non-ASCII text, because
    the latter implies buffered formatter.

There are many "color effect" value lines in color.py, and making them
byte-str objects isn't suitable for fixing on stable. In addition to
it, pycompat.bytestr will be used to get byte-str object from any
types other than int, too.

To resolve this issue, this patch does:

  - replace pycompat.bytestr in checkwinfilename() with newly added
    hook point util._filenamebytestr, and

  - make win32mbcs reverse-wrap util._filenamebytestr
    (this is a replacement of 1d07d9da84a0)

This patch does two things above at same time, because separately
applying the former change adds broken revision (from point of view of
win32mbcs) to stable branch.

"_" prefix is added to "filenamebytestr", because it is win32mbcs
specific hook point.
2017-05-31 23:44:33 +09:00
Matt Harbison
7dc2c0c995 clonebundles: fix missing newline character
Previously, the line displayed as '( )' instead of '(\n)'.
2017-05-24 22:59:59 -04:00
FUJIWARA Katsunori
231904c8ce win32mbcs: wrap underlying pycompat.bytestr to use checkwinfilename safely
win32mbcs wraps some functions, to prevent them from unintentionally
treating backslash (0x5c), which is used as the second or later byte
of multi bytes characters by problematic encodings, as a path
component delimiter on Windows platform.

This wrapping assumes that wrapped functions can safely accept unicode
string arguments.

Unfortunately, 440868900036 broke this assumption by introducing
pycompat.bytestr() into util.checkwinfilename() for py3 support. After
that, wrapped checkwinfilename() always fails for non-ASCII filename
at pycompat.bytestr() invocation.

This patch wraps underlying pycompat.bytestr() function to use
util.checkwinfilename() safely.

To avoid similar regression in the future, another patch series will
add smoke testing on default branch.
2017-05-12 21:46:14 +09:00
Matt Harbison
99eb2bf008 churn: use the non-deprecated template option in the examples 2017-05-08 23:05:01 -04:00
Yuya Nishihara
6a634dc263 largefiles: make sure debugstate command is populated before wrapping
Copied the hack from 8fe57ad06da4, which seemed the simplest workaround.
Perhaps debugcommands.py should have its own commands table.
2017-05-04 15:23:51 +09:00
Augie Fackler
7bfbf7fa8a merge with stable 2017-06-20 16:33:46 -04:00
Christian Ebert
d05e4bb5d6 keyword: use context manager for rollback locking 2017-06-20 12:51:36 +01:00
Martin von Zweigbergk
560e5ce4f1 changegroup: let callers pass in transaction to apply() (API)
I think passing in the transaction makes it a little clearer and more
consistent with bundle2.
2017-06-15 22:46:38 -07:00
Martin von Zweigbergk
a24c5e2f5e strip: use context manager for locking and transaction in stripcmd() 2017-06-19 11:20:29 -07:00
Martin von Zweigbergk
72fa329bb6 strip: use context manager for locking in strip() 2017-06-19 11:17:31 -07:00
Martin von Zweigbergk
aac8f4879e rebase: use context manager for locking in pullrebase() 2017-06-19 11:18:12 -07:00
Martin von Zweigbergk
042e7bf238 rebase: use context manager for locking in rebase() 2017-06-19 11:18:05 -07:00
Augie Fackler
856bd5ae00 highlight: put pygments import inside demandimport.deactivated
I tripped on some weirdness relating to _thread vs threading way down
in a dep of highlight recently. I'm not really sure why I'm only just
seeing this defect now, but experimentally this fixes the problem, and
shouldn't cause any load-time slowness for people until pygments is
actually about to be used since highlight.highlight is still lazily
loaded in the highlight/__init__.py file.
2017-06-18 23:05:54 -04:00
FUJIWARA Katsunori
6eec3cc46a help: apply bulk fixes for indentation and literal blocking issues
There are some paragraphs, which aren't rendered in online help as
expected because of indentation and literal blocking issues.

- hgext/rebase.py

  - paragraph before example code ends with ":", which treats
    subsequent indented paragraphs as normal block

    => replace ":" with "::" to treat subsequent paragraphs as literal block

- help/pager.txt

  - paragraph before a list of --pager option values ends with "::",
    which treats subsequent indented paragraphs as literal block

    => replace "::" with ":" to treat subsequent paragraphs as normal block

  - the second line of explanation for no/off --pager option value is
    indented incorrectly (this also causes failure of "make" in doc)

    => indent correctly

- help/revisions.txt

  - explanation following example code of "[revsetalias]" section
    isn't suitable for literal block

    => un-indent explanation paragraph to treat it as normal block

  - indentation of "For example" before example of tag() revset
    predicate matching is meaningless

  - descriptive text for tag() revset predicate matching isn't
    suitable for literal block

    => un-indent concatenated two paragraphs to treat them as normal block
2017-05-01 05:52:32 +09:00
FUJIWARA Katsunori
262750cefb rebase: fix incorrect configuration example
This configuration example doesn't make rebase require a destination,
even though help document wants to show such example.
2017-05-01 05:38:52 +09:00
Gregory Szorc
a0449ff50c show: rename "underway" to "work"
Durham and I both like this better than "underway." We can add aliases
and bikeshed on the name during the 4.3 cycle, as this whole extension is
highly experimental.
2017-04-18 10:49:46 -07:00
Siddharth Agarwal
163ca4866c histedit: make check for unresolved conflicts explicit (issue5545)
Previously, we'd rely on the implicit check that `localrepo.commit` did.
The problem is that that check only happened when the working copy was
dirty. With a "clean" working copy but unresolved conflicts we'd get
into a broken state.

To fix that, do what rebase does and check for unresolved conflicts at
the start of histedit --continue.
2017-04-20 17:18:08 -07:00
Ryan McElroy
7959f776d3 show: make template option actually show up in help
Previously, the --template/-T option didn't show up in help because it's marked
as experimental. It's not really experimental for show, and its quite important
for show's funcationality, so let's make sure it always shows up.
2017-04-13 03:17:53 -07:00
Gregory Szorc
6c7c4762ec show: implement underway view
This is the beginning of a wip/smartlog view. It is basically a manually
constructed (read: fast) revset function to collect "relevant"
changesets combined with a custom template and a graph displayer.
It obviously needs a lot of work.

I'd like to get *something* usable in 4.2 so `hg show` has some value
to end-users.

Let the bikeshedding begin.
2017-04-12 20:31:15 -07:00
Gregory Szorc
a7217ac0ec show: fix formatting of multiple commands
Because we're formatting to RST, short lines wrap and there
needs to be an extra line break between paragraphs to prevent
that.

In addition, the indentation in the old code was a bit off.

Refactor the code to a function (so we don't leak variables outside
the module) and modify it so it renders more correctly.
2017-04-12 20:28:44 -07:00
Matt Harbison
e77c1dddf3 largefiles: set the extension as enabled locally after a share requiring it
This has been done for clone since bd19f94d30e9, so it makes sense here for the
same reasons.
2017-04-11 20:54:50 -04:00
Kostia Balytskyi
6ac6050ee7 shelve: rename nodestoprune to nodestoremove
As per feedback from the community.
2017-04-10 15:32:09 -07:00
Martin von Zweigbergk
f173705214 rebase: rewrite "x in y.children()" as "y in x.parents()"
children() is slow
2017-06-17 23:09:47 -07:00
Martin von Zweigbergk
5d53779b23 shelve: rewrite "x in y.children()" as "y in x.parents()"
children() is slow
2017-06-17 23:09:39 -07:00
Pulkit Goyal
43464e00e4 py3: convert keys of kwargs back to bytes using pycompat.byteskwargs() 2017-06-17 15:29:26 +05:30
Martin von Zweigbergk
627dcaad4c bundle2: use "else" instead of checking condition again 2017-06-16 10:36:43 -07:00
Yuya Nishihara
5249aa5b36 cmdutil: pass templatespec tuple directly to changeset_templater (API)
A fewer number of arguments should be better.
2017-04-22 19:02:47 +09:00
Yuya Nishihara
ca018ac743 cmdutil: factor out helper to create changeset_templater with literal template
changeset_templater has lots of arguments, but most callers only need to
specify a literal template 'tmpl'.

"hg debugtemplate" has no diff option, which means 'opts' were effectively {},
so dropped opts.
2017-04-22 18:42:03 +09:00
Augie Fackler
e6a918f63a patchbomb: make getaddrs function easier to work with
Prior to this the return value was potentially None, a string, or a
list of strings. It now always returns a list of strings where each
string is always only one email address
2017-06-13 17:43:33 -04:00
Augie Fackler
1250a2693f patchbomb: look for non-empty publicurl, not a non-None one
Otherwise it's impossible to turn this feature back off, which is
making writing of tests awkward.
2017-06-13 16:30:50 -04:00
Augie Fackler
88445b135f patchbomb: make variable name for publicurl always be publicurl 2017-06-13 16:30:11 -04:00
Ryan McElroy
58b3c5b7fb show: fix corrupt json output with no bookmarks 2017-04-07 10:46:32 -07:00
Ryan McElroy
16fdc0aade show: tweak plain abort language for clarity 2017-04-07 10:26:13 -07:00
Olivier Trempe
5c8f033b93 fsmonitor: match watchman and filesystem encoding
watchman's paths encoding can differ from filesystem encoding. For example,
on Windows, it's always utf-8.

Before this patch, on Windows, mismatch in path comparison between fsmonitor
state and osutil.statfiles would yield a clean status for added/modified files.

In addition to status reporting wrong results, this leads to files being
discarded from changesets while doing history editing operations such as rebase.

Benchmark:

There is a little overhead at module import:
python -m timeit "import hgext.fsmonitor"
Windows before patch: 1000000 loops, best of 3: 0.563 usec per loop
Windows after patch: 1000000 loops, best of 3: 0.583 usec per loop
Linx before patch: 1000000 loops, best of 3: 0.579 usec per loop
Linux after patch: 1000000 loops, best of 3: 0.588 usec per loop

10000 calls to _watchmantofsencoding:
python -m timeit -s "from hgext.fsmonitor import _watchmantofsencoding, _fixencoding" "fname = '/path/to/file'" "for i in range(10000):" "    if _fixencoding: fname = _watchmantofsencoding(fname)"
Windows (_fixencoding is True): 100 loops, best of 3: 19.5 msec per loop
Linux (_fixencoding is False): 100 loops, best of 3: 3.08 msec per loop
2017-03-08 09:03:42 -05:00
Yuya Nishihara
dc941eb2d4 py3: have registrar process docstrings in bytes
Mixing bytes and unicode creates a mess. Do things in bytes as possible.

New sysbytes() helper only takes care of ASCII characters, but avoids raising
nasty unicode exception. This is the same design principle as sysstr().
2017-04-05 00:34:58 +09:00
Yuya Nishihara
1163409660 util: extract pure tolf/tocrlf() functions from eol extension
This can be used for EOL conversion of text files.
2017-03-29 21:28:54 +09:00
Yuya Nishihara
2f682a6206 pycompat: provide bytes os.linesep 2017-03-29 21:23:28 +09:00
Gregory Szorc
62d4252847 show: new extension for displaying various repository data
Currently, Mercurial has a number of commands to show information. And,
there are features coming down the pipe that will introduce more
commands for showing information.

Currently, when introducing a new class of data or a view that we
wish to expose to the user, the strategy is to introduce a new command
or overload an existing command, sometimes both. For example, there is
a desire to formalize the wip/smartlog/underway/mine functionality that
many have devised. There is also a desire to introduce a "topics"
concept. Others would like views of "the current stack." In the
current model, we'd need a new command for wip/smartlog/etc (that
behaves a lot like a pre-defined alias of `hg log`). For topics,
we'd likely overload `hg topic[s]` to both display and manipulate
topics.

Adding new commands for every pre-defined query doesn't scale well
and pollutes `hg help`. Overloading commands to perform read-only and
write operations is arguably an UX anti-pattern: while having all
functionality for a given concept in one command is nice, having a
single command doing multiple discrete operations is not. Furthermore,
a user may be surprised that a command they thought was read-only
actually changes something.

We discussed this at the Mercurial 4.0 Sprint in Paris and decided that
having a single command where we could hang pre-defined views of
various data would be a good idea. Having such a command would:

* Help prevent an explosion of new query-related commands
* Create a clear separation between read and write operations
  (mitigates footguns)
* Avoids overloading the meaning of commands that manipulate data
  (bookmark, tag, branch, etc) (while we can't take away the
  existing behavior for BC reasons, we now won't introduce this
  behavior on new commands)
* Allows users to discover informational views more easily by
  aggregating them in a single location
* Lowers the barrier to creating the new views (since the barrier
  to creating a top-level command is relatively high)

So, this commit introduces the `hg show` command via the "show"
extension. This command accepts a positional argument of the
"view" to show. New views can be registered with a decorator. To
prove it works, we implement the "bookmarks" view, which shows a
table of bookmarks and their associated nodes.

We introduce a new style to hold everything used by `hg show`.

For our initial bookmarks view, the output varies from `hg bookmarks`:

* Padding is performed in the template itself as opposed to Python
* Revision integers are not shown
* shortest() is used to display a 5 character node by default (as
  opposed to static 12 characters)

I chose to implement the "bookmarks" view first because it is simple
and shouldn't invite too much bikeshedding that detracts from the
evaluation of `hg show` itself. But there is an important point
to consider: we now have 2 ways to show a list of bookmarks. I'm not
a fan of introducing multiple ways to do very similar things. So it
might be worth discussing how we wish to tackle this issue for
bookmarks, tags, branches, MQ series, etc.

I also made the choice of explicitly declaring the default show
template not part of the standard BC guarantees. History has shown
that we make mistakes and poor choices with output formatting but
can't fix these mistakes later because random tools are parsing
output and we don't want to break these tools. Optimizing for human
consumption is one of my goals for `hg show`. So, by not covering
the formatting as part of BC, the barrier to future change is much
lower and humans benefit.

There are some improvements that can be made to formatting. For
example, we don't yet use label() in the templates. We obviously
want this for color. But I'm not sure if we should reuse the existing
log.* labels or invent new ones. I figure we can punt that to a
follow-up.

At the aforementioned Sprint, we discussed and discarded various
alternatives to `hg show`.

We considered making `hg log <view>` perform this behavior. The main
reason we can't do this is because a positional argument to `hg log`
can be a file path and if there is a conflict between a path name and
a view name, behavior is ambiguous. We could have introduced
`hg log --view` or similar, but we felt that required too much typing
(we don't want to require a command flag to show a view) and wasn't
very discoverable. Furthermore, `hg log` is optimized for showing
changelog data and there are things that `hg display` could display
that aren't changelog centric.

There were concerns about using "show" as the command name.

Some users already have a "show" alias that is similar to `hg export`.

There were also concerns that Git users adapted to `git show` would
be confused by `hg show`'s different behavior. The main difference
here is `git show` prints an `hg export` like view of the current
commit by default and `hg show` requires an argument. `git show`
can also display any Git object. `git show` does not support
displaying more complex views: just single objects. If we
implemented `hg show <hash>` or `hg show <identifier>`, `hg show`
would be a superset of `git show`. Although, I'm hesitant to do that
at this time because I view `hg show` as a higher-level querying
command and there are namespace collisions between valid identifiers
and registered views.

There is also a prefix collision with `hg showconfig`, which is an
alias of `hg config`.

We also considered `hg view`, but that is already used by the "hgk"
extension.

`hg display` was also proposed at one point. It has a prefix collision
with `hg diff`. General consensus was "show" or "view" are the best
verbs. And since "view" was taken, "show" was chosen.

There are a number of inline TODOs in this patch. Some of these
represent decisions yet to be made. Others represent features
requiring non-trivial complexity. Rather than bloat the patch or
invite additional bikeshedding, I figured I'd document future
enhancements via TODO so we can get a minimal implmentation landed.
Something is better than nothing.
2017-03-24 19:19:00 -07:00
Kostia Balytskyi
85168fc2a2 shelve: move ui.quiet manipulations to configoverride 2017-03-29 05:31:31 -07:00
FUJIWARA Katsunori
89f77ed920 largefiles: use readasstandin() to read hex hash directly from filectx
BTW, C implementation of hexdigest() for SHA-1/256/512 returns hex
hash in lower case, and doctest in Python standard hashlib assumes
that, too. But it isn't explicitly described in API document or so.

Therefore, we can't assume that hexdigest() always returns hex hash in
lower case, for any hash algorithms, on any Python runtimes and
versions.

From point of view of that, it is reasonable for portability that
77f8c025a6ef applies lower() on hex hash in overridefilemerge().

But on the other hand, in largefiles extension, there are still many
code paths comparing between hex hashes or storing hex hash into
standin file, without lower().

Switching to hash algorithm other than SHA-1 may be good chance to
clarify our policy about hexdigest()-ed hash value string.

  - assume that hexdigest() always returns hex hash in lower case, or

  - apply lower() on hex hash in appropriate layers to ensure
    lower-case-ness of it for portability
2017-04-01 02:32:49 +09:00
FUJIWARA Katsunori
ff4c75957b largefiles: remove unused readstandin()
Now, there is no client of readstandin().
2017-04-01 02:32:49 +09:00
FUJIWARA Katsunori
156e7d4f73 largefiles: make copytostore() accept only changectx as the 2nd argument (API)
As the name describes, the 2nd argument 'revorctx' of copytostore()
can accept non-changectx value, for historical reason,

But, since e91ac285f700, copyalltostore(), the only one copytostore()
client in Mercurial source tree, always passes changectx as
'revorctx'.

Therefore, it is reasonable to make copytostore() accept only
changectx as the 2nd argument, now.
2017-04-01 02:32:48 +09:00
FUJIWARA Katsunori
7b2d7893cb largefiles: remove unused keyword argument of copytostore() (API)
AFAIK, 'uploaded' argument of copytostore() (or copytocache(), before
renaming at e2d2a21b7e90) has been never used both on caller and
callee sides, since official release of bundled largefiles extension.
2017-04-01 02:32:48 +09:00
FUJIWARA Katsunori
15d9fae8a1 largefiles: add copytostore() fstandin argument to replace readstandin() (API)
copyalltostore(), only one caller of copytostore(), already knows
standin file name of the target largefile. Therefore, passing it to
copytostore() is more efficient than calculating it in copytostore()
or readstandin().
2017-04-01 02:32:48 +09:00
FUJIWARA Katsunori
35dbbb1699 largefiles: replace readstandin() by readasstandin()
These code paths already (or should, for efficiency at repetition)
know the target changectx and path of standin file.
2017-04-01 02:32:47 +09:00