Commit Graph

13695 Commits

Author SHA1 Message Date
Siddharth Agarwal
222edc51db help: also hide options marked EXPERIMENTAL
Similar to DEPRECATED, add a way to indicate that options are EXPERIMENTAL.
2015-04-27 15:12:41 -07:00
Wagner Bruna
7e4e6c79af webcommands: fix description of manifest default behavior 2015-04-27 19:13:55 -03:00
Wagner Bruna
c39301bfdc webcommands: fix typo in changelog documentation 2015-04-27 19:09:54 -03:00
Laurent Charignon
a76105b65c record: fix adding new file with record from within a subdir (issue4626)
In my latest change on record (edit newly added file), I forgot the
repo.wjoin() so that record was not computing the paths properly to delete
the backups and was crashing.
2015-04-27 14:02:49 -07:00
FUJIWARA Katsunori
801f00488c cmdutil: avoid wrapping ctx.phasestr() by _()
This wrapping seems meaningless, because:

  - there is no "_()" invocation to prepare for extracting phase names
    to be translated

    "make update-pot" doesn't extract msgids for phase names

  - phase names are kine of reserved keywords like as branch name "default"
2015-04-25 23:44:53 +09:00
FUJIWARA Katsunori
79a47e0eeb repair: avoid string concatenation by + operator
String concatenation by "+" operator causes failure of extracting
messages to be translated.

Python automatically concatenates strings separated by whitespaces
into one string.
2015-04-25 23:44:53 +09:00
Yuya Nishihara
d99ad9e9b8 annotate: always adjust linkrev before walking down to parents (issue4623)
This should avoid the bad performance in the following scenario. Before this
patch, on "hg annotate -r10000", p.rev() would walk changelog from 10000 to 3
because _descendantrev was 10000. With this patch, it walks from 5 to 3.

  1 -- 2 -- 4 -- 5 -- ... -- 10000
    \      'p'  'f'
     - 3   (grafted 3 to 4)
      'p'

repo:    https://hg.mozilla.org/releases/mozilla-beta/#4f80fecda802
command: hg annotate -r b0a57152fd14 browser/app/profile/firefox.js
before:  83.120 secs
after:    3.820 secs

This patch involves extra calls of narrow _adjustlinkrev(), but the cost of
them seems relatively small compared to wide _adjustlinkrev() calls eliminated
by this patch.

repo:    http://selenic.com/repo/hg/#d668bc5b9a06
command: hg annotate mercurial/commands.py
before:  7.380 secs
after:   7.320 secs

repo:    https://hg.mozilla.org/mozilla-central/#f214df6ac75f
command: hg annotate layout/generic/nsTextFrame.cpp
before:  5.070 secs
after:   5.050 secs

repo:    https://hg.mozilla.org/releases/mozilla-beta/#4f80fecda802
command: hg annotate -r 4954faa47dd0 gfx/thebes/gfxWindowsPlatform.cpp
before:  1.600 secs
after:   1.620 secs
2015-04-25 15:38:06 +09:00
FUJIWARA Katsunori
6d60352ea0 i18n: extract doc string of each web commands as translatable one
Before this patch, doc string of each web commands isn't extracted as
translatable one, even though web commands are listed up in "hg help
hgweb".

This patch adds "mercurial/hgweb/webcommands.py" on to arguments of
"i18n/hggettext". "i18nfunctions" added into "webcommands.py" is used
by "i18n/hggettext" to get the list of functions having translatable
doc string.
2015-04-28 00:38:16 +09:00
Matt Harbison
8ed0a9ea81 subrepo: don't write .hgsubstate lines with empty subrepo state (issue4622)
The '' that is used to represent the state of a not-yet-committed
subrepo cannot be written to the file, because the code that parses
the file splits on ' ' and expects two parts.

Given that the .hgsubstate file is automatically rewritten on commit, it seems
a little strange that the file is written out during a merge.
2015-04-24 23:23:55 -04:00
Matt Harbison
83f972bb8d revert: restore the ability to revert across case only renames (issue4481)
This regressed in 39be809de631, in what looks like an unrelated change.

It seems sufficient to pass 'ignoremissing=True', but the restored try/except
has been there for six years since 3f24f7324cd8, so this seems safer for now.
Note that renaming directories in the filename doesn't appear to work- not sure
if this would end up throwing a different type of error when that is fixed.
2015-04-25 23:54:31 -04:00
Jordi Gutiérrez Hermoso
772b5e72a2 template-phases: do not show description or summary if empty
This is a copy of 942d64e0a1ee, but applied to the phases template,
which is itself almost a copy of the default template.

Perhaps we should rewrite these templates to use the %include syntax
afforded by config files. This change seems a bit too big for stable,
though.
2015-04-24 14:52:12 -04:00
Pierre-Yves David
1dc90191f8 bundle2: also save output when error happens during part processing
Until this changeset, we were only able to save output if an error happened
during the 'transaction.close()' phase. If the 'processbundle' call raised an
exception, the 'bundleoperation' object was never returned, so the reply bundle
was never accessible and no output could be salvaged. We introduce a quick (but
not very elegant) fix to gain access to any reply created during the processing.

This conclude this output related series. We should hopefully be able client-side to see the
whole server output, in a proper order.

The code is now complex enough that a refactoring of it would make sense on
default.
2015-04-23 16:36:18 +01:00
Pierre-Yves David
ae773fc61e bundle2: capture output issue during transaction close
We were capturing all output issue during bundle2 processing, and all output
issue during transaction rollback in case of failure. However, the output issue
during transaction commit was still roaming the land freely. It is now put back
in line.

This let the user see output from 'pretxnclose' and 'txnclose' (and related) in
the right order.
2015-04-23 14:54:45 +01:00
Pierre-Yves David
1e8ec29191 bundle2: also capture hook output during processing
External hook used to directly write on stdout and stderr. As a result their
output was not captured by the bundle2 processing. This resulted in confusing
out of order output on the client side. We are now capturing hooks output in
this context.
2015-04-23 17:03:58 +01:00
Pierre-Yves David
3ecff4d3f6 ui: allow capture of subprocess output
We want to capture hooks output during bundle2 processing. For this purpose we
introduce a new 'subproc' argument to 'ui.pushbuffer'. When set, the output of
sub process created through 'ui.system' will be captured in the buffer too.

This will be used in the next changeset.
2015-04-23 14:57:39 +01:00
Pierre-Yves David
47985fc815 bundle2: capture transaction rollback message output (issue4614)
The output from the transaction rollback was not included into the reply bundle.
It was eventually caught by the usual 'unbundle' output capture and sent to the
client but the result was out of order on the client side. We now capture the
output for the transaction release and transmit it the same way as all other
output.

We should probably rethink the whole output capture things but this would not be
appropriate for stable.

The is still multiple cases were output failed to be properly capture, they will
be fixed in later changesets.
2015-04-23 14:20:36 +01:00
Pierre-Yves David
dcc9ae4956 bundle2: issue remote output as "status" (issue4612)
Remote output should be silenced by --quiet. The issue was found while running
`test-largefiles-cache.t` so it will get tested once we switch bundle2 by
default.
2015-04-24 00:46:48 +01:00
Laurent Charignon
6fc9e8be66 record: edit patch of newly added files (issue4304)
I tried to fix this issue in the past and had to revert the fix. This is a
second attempt without the regression we found with the first one.

record defines special headers (of file) as headers whose hunk are not shown
to the user for editing, they are used to represent deleted, moved and new
files. Since we want to authorize editing the patch of newly added file we
make the newly added file with some content not special anymore. This entails
that we have to save their content before applying the backup to be able to
revert it if the patch does not apply properly.
We reintroduce the test showing that newly added files can be edited and that
their content is shown to the user.
2015-04-23 14:27:26 -07:00
FUJIWARA Katsunori
2a4f646cd6 revert: apply normallookup on reverted file if size isn't changed (issue4583)
Before this patch, reverting a file to the revision other than the
parent doesn't update dirstate. This seems to expect that timestamp
and/or size will be changed by reverting.

But if (1) dirstate of file "f" is filled with timestamp before
reverting and (2) size and timestamp of file "f" isn't changed at
reverting, file "f" is recognized as CLEAN unexpectedly.

This patch applies "dirstate.normallookup()" on reverted file, if size
isn't changed.

Making "localrepository.wwrite()" return length of written data is
needed to avoid additional (and redundant) "lstat(2)" on the reverted
file. "filectx.size()" can't be used to know it, because data may be
decoded at being written out.

BTW, interactive reverting may cause similar problem, too. But this
patch doesn't focus on fixing it, because (1) interactive (maybe slow)
reverting changes one (or both) of size/timestamp of reverted files in
many usecases, and (2) changes to fix it seems not suitable for stable
branch.
2015-04-24 23:52:41 +09:00
Martin von Zweigbergk
f1e241ceae revert: accept just -I/-X without paths or -a/-i (issue4592)
'hg revert -I foo' currently fails with

  abort: no files or directories specified
  (use --all to revert all files, or 'hg update 1' to update)

It doesn't seem intentional that -I/-X without other paths or
--all/--interactive should fail, and it doesn't seem that harmful to
allow it either, so let's just do that.
2015-04-22 16:38:36 -07:00
Laurent Charignon
7e6cda9955 record: change wording for record curses interface
We are using record and crecord in different context, not just for commiting
changes but also reverting and shelving changes. This diff changes the wording
from commiting to confirming changes to avoid confusing the users with what
they are doing.
2015-04-21 16:20:43 -07:00
Laurent Charignon
4fc3c4c465 record: fix record with change on moved file crashes (issue4619)
reverting fe807064739c, add a test to prevent the issue from coming back.
2015-04-22 13:56:30 -07:00
FUJIWARA Katsunori
29b6ee5ded unionrepo: use pathutil.normasprefix to ensure os.sep at the end of cwd
Since Python 2.7.9, "os.path.join(path, '')" doesn't add "os.sep" at
the end of UNC path (see issue4557 for detail).

This makes unionrepo incorrectly work, if:

  1. cwd is the root of UNC share (e.g. "\host\share"), and
  2. mainreporoot is near cwd (e.g. "\host\sharefoo\repo")
     - host of UNC path is same as one of cwd
     - share of UNC path starts with one of cwd
  3. "repopath" isn't specified in URI (e.g. "union:path/to/repo2")

For example:

  $ hg --cwd \host\share -R \host\sharefoo\repo incoming union:path\to\repo2

In this case:

  - os.path.join(r"\host\share", "") returns r"\host\share",
  - r"\host\sharefoo\repo".startswith(r"\host\share") returns True, then
  - r"foo\repo" is treated as repopath of unionrepo instead of
    r"\host\sharefoo\repo"

This causes failure of combining "\host\sharefoo\repo" and another
repository: in addition to it, "\host\share\foo\repo" may be combined
with another repository, if it accidentally exists.

This patch uses "pathutil.normasprefix()" to ensure "os.sep" at the
end of cwd safely, even with some problematic encodings, which use
0x5c (= "os.sep" on Windows) as the tail byte of some multi-byte
characters.

BTW, normalization before "pathutil.normasprefix()" isn't needed in
this case, because "os.getcwd()" always returns normalized one.
2015-04-22 23:38:55 +09:00
FUJIWARA Katsunori
8019b19ea2 bundlerepo: use pathutil.normasprefix to ensure os.sep at the end of cwd
Since Python 2.7.9, "os.path.join(path, '')" doesn't add "os.sep" at
the end of UNC path (see issue4557 for detail).

This makes bundlerepo incorrectly work, if:

  1. cwd is the root of UNC share (e.g. "\host\share"), and
  2. mainreporoot is near cwd (e.g. "\host\sharefoo\repo")
     - host of UNC path is same as one of cwd
     - share of UNC path starts with one of cwd
  3. "repopath" isn't specified in bundle URI
     (e.g. "bundle:bundlefile" or just "bundlefile")

For example:

  $ hg --cwd \host\share -R \host\sharefoo\repo incoming bundle

In this case:

  - os.path.join(r"\host\share", "") returns r"\host\share",
  - r"\host\sharefoo\repo".startswith(r"\host\share") returns True, then
  - r"foo\repo" is treated as repopath of bundlerepo instead of
    r"\host\sharefoo\repo"

This causes failure of combining "\host\sharefoo\repo" and bundle
file: in addition to it, "\host\share\foo\repo" may be combined with
bundle file, if it accidentally exists.

This patch uses "pathutil.normasprefix()" to ensure "os.sep" at the
end of cwd safely, even with some problematic encodings, which use
0x5c (= "os.sep" on Windows) as the tail byte of some multi-byte
characters.

BTW, normalization before "pathutil.normasprefix()" isn't needed in
this case, because "os.getcwd()" always returns normalized one.
2015-04-22 23:38:55 +09:00
FUJIWARA Katsunori
e36077823b dirstate: use pathutil.normasprefix to ensure os.sep at the end of root
419498227287 replaced "os.path.join(root, '')" by
"root.endswith(os.sep)" examination, because Python 2.7.9 changes
behavior of "os.path.join(path, '')" on UNC path.

But some problematic encodings use 0x5c (= "os.sep" on Windows) as the
tail byte of some multi-byte characters, and replacement above
prevents Mercurial from working on the repository, of which root path
ends with such multi-byte character, regardless of enabling win32mbcs.

This patch uses "pathutil.normasprefix()" instead of
"root.endswith(os.sep)" examination, to ensure "os.sep" at the end of
"dirstate._rootdir" even with problematic encodings.

"root" of dirstate can be passed to "pathutil.normasprefix()" without
normalization, because it is always given from "repo.root" =
"repo.wvfs.base", which is normalized by "os.path.realpath()".

Using "util.endswithsep()" instead of "str.endswith(os.sep)" also
fixes this problem, but this patch chooses "pathutil.normasprefix()"
to centralize "adding os.sep if endswith(os.sep)" logic into it.
2015-04-22 23:38:52 +09:00
Wagner Bruna
7e2d119543 bookmarks: add i18n hints to bookmark sync states 2015-04-21 21:02:08 -03:00
Wagner Bruna
a6d1f7d563 help: fix typos in txnclose and txnabort documentation 2015-04-21 21:01:05 -03:00
Kevin Bullock
6d5f979ecc util: fix the check for non-C99 compilers (issue4605) 2015-04-20 22:21:57 -05:00
Pierre-Yves David
e67e928ad2 pushkey: flush pending data before running a pre-pushkey hook (issue4607)
The pre-pushkey hook will likely validate the pushkey based on element
previously changed in the same transaction. We need to make theses data
available for the hook.
2015-04-20 17:16:05 +02:00
Pierre-Yves David
a8e00e4978 pushkey: use hook arguments from transaction when one exists
When pushkey is called during a transaction, we include its 'hookargs' when
running the pre-pushkey hooks. Having more data cannot hurt, especially the
transaction ID.
2015-04-20 17:15:50 +02:00
Augie Fackler
cffde55a69 util.h: also sniff for C99 before trying to use stdbool.h (issue4605)
stdbool.h isn't required until C99. Sigh.
2015-04-20 14:47:51 -04:00
Pierre-Yves David
bf28a4a61f changelog: fix readpending if no pending data exist (issue4609)
Since transaction are used for more than just changesets, it is possible
to have a transaction without new changesets at all. In this case no
''00changelog.i.a' are written. In all cases the 'changelog.readpending'
method is called if the repository has any pending data. The 'revlog' logic
provides empty content if the file is missing, so the whole operation
resulted in an empty changelog.

We now skip reading the pending file if it is missing.
2015-04-20 17:16:22 +02:00
Pierre-Yves David
cb2e913723 afterlock: add the callback to the top level lock (issue4608)
If 'wlock' is taken, we should add 'afterlock' callback to the 'wlock' instead.
Otherwise, running post transaction hook after 'lock' is release but 'wlock' is
still taken lead to a deadlock (eg: 'hg update' during a hook).

This situation is much more common since: b7067abc16c0

  push: acquire local 'wlock' if "pushback" is expected (BC) (issue4596)
2015-04-20 15:27:55 +02:00
Pierre-Yves David
a7c2f06189 debuglock: access the lock file using the proper vfs
Before this fix, 'wlock' was always reported as "free" because '.hg/store/wlock'
have never been a thing.
2015-04-20 16:05:32 +02:00
Martin von Zweigbergk
1b5dc3517b status: pass matcher to pathcopies()
Just like 111a38b83cb8 (diff: pass the diff matcher to the copy logic,
2015-04-16) sped up 'hg diff --git $path', let's speed up 'hg st -C
$path'. On the Firefox repo, this speeds up

  hg st --rev tip~40000 --rev tip -C python

from 16s to 1.8s. Those two revisions differ in 100k files, out of
which 1k is in python/.
2015-04-19 21:43:53 -07:00
Yuya Nishihara
0a37922d8d annotate: prepare ancestry context of workingfilectx
_ancestrycontext is necessary for fast lookup of _changeid. Because we can't
compute the ancestors from wctx, we skip to its parents. 'None' is not needed
to be included in _ancestrycontext because it is used for a membership test
of filelog revisions.

repo:    https://hg.mozilla.org/releases/mozilla-beta/#062e49bcb2da
command: hg annotate -r 'wdir()' gfx/thebes/gfxWindowsPlatform.cpp
before:  51.520 sec
after:    1.780 sec
2015-04-18 15:27:03 +09:00
Yuya Nishihara
5b51ae23c8 committablefilectx: propagate ancestry info to parent to fix annotation
Before this patch, annotating working directory could include wrong revisions
that were hidden or belonged to different branches. This fixes wfctx.parents()
to set _descendantrev so that all ancestors can take advantage of the linkrev
adjustment introduced at a5aaaeedd6cb. _adjustlinkrev() can handle 'None'
revision thanks to bb19d597bbcd.
2015-04-18 14:10:55 +09:00
Yuya Nishihara
d32c454372 filectx: extract function to create parent fctx keeping ancestry info
committablefilectx.parents() should use this to take advantage of the linkrev
adjustment.
2015-04-18 14:03:41 +09:00
Yuya Nishihara
921251cb12 filectx: factor out creation of parent fctx
This series tries to fix wrong ancestry information on annotating working
directory. This change should slightly improves the readability of the next
patch.
2015-04-18 13:46:24 +09:00
Javi Merino
865602fca3 help: fix typo commited -> committed 2015-04-19 11:37:29 +01:00
Yuya Nishihara
230c1c62ef tags: do not abort if failed to write lock file to save cache
LockHeld wasn't enough to suppress error during acquiring lock. If .hg directory
is read-only, LockUnavailable will be raised.

  $ chmod ugo-w .hg
  $ hg identify
  abort: could not lock working directory of ...: Permission denied
2015-04-17 23:22:58 +09:00
Pierre-Yves David
fe42feb68e bundle2-localpeer: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle need to be
processed for outputting their content. This concludes our quest for fixing
issue4594.
2015-04-16 04:01:51 -04:00
Pierre-Yves David
28bc9e7079 bundle2: add on more layer of exception catching in localrepo.unbundle
We are going to add output related logic in this function. We do the
indentation first to help next changeset readability. We need a new try except
because we want to handle output on any exception, including PushRaced ones.
2015-04-16 05:09:37 -04:00
Pierre-Yves David
0bbcf25859 bundle2-wireproto: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle are re-injected
into the bundle carrying the exception.

We still need to fix the situation for non-wireprotocol push.
2015-04-16 03:17:37 -04:00
Pierre-Yves David
e97e706e0f bundle2: refactor error bundle creation for the wireprotocol
We want to add output information to the error bundle. Before doing this, we
rework the code to have a single bundler creation and return statement. This
will make the update with the output simpler as only one place will have to be
touched.
2015-04-16 03:56:50 -04:00
Pierre-Yves David
2d01ad7c2e bundle2: store the salvaged output on the exception object
The re-handling of output is happening in some 'unbundle' callers. We have to
transmit the output information to this place so we stick it on the exception.

This is the third step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output part from the aborted reply
into the exception bundle.
2015-04-16 03:17:01 -04:00
Pierre-Yves David
9291c81ebf bundle2: add a 'salvageoutput' method on bundle20
This method returns a copy of all 'output' parts added to the bundler.

This is the second step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output parts from the aborted reply
into the exception bundle.

The function will be used in a later patch.
2015-04-16 03:16:04 -04:00
Pierre-Yves David
ff72f63d50 bundle2: add a 'copy' method on parts
This is the first step in our quest for preserving the server output on error
(issue4594). We want to be able to copy the output parts from the aborted reply
into the exception bundle.

The function will be used in a later patch.
2015-04-16 03:15:28 -04:00
Pierre-Yves David
bfdd8d2ada hooks: add a 'txnabort' hook
This hook will be called whenever a transaction is aborted. This will make it
easy for people to clean up temporary content they may have created during a
transaction.
2015-04-16 05:36:49 -04:00
Pierre-Yves David
ce7797818b help: document the ''HG_TXNID'' environment variable during hooks
We forgot to document the new "transaction ID" mechanism.
2015-04-16 05:41:07 -04:00