Commit Graph

26807 Commits

Author SHA1 Message Date
Matt Mackall
ab46ec3b99 util: drop statmtimesec
We've globablly forced stat to return integer times which agrees with
our extension code, so this is no longer needed.

This speeds up status on mozilla-central substantially:

$ hg perfstatus
! wall 0.190179 comb 0.180000 user 0.120000 sys 0.060000 (best of 53)
$ hg perfstatus
! wall 0.275729 comb 0.270000 user 0.210000 sys 0.060000 (best of 36)
2015-11-19 13:15:17 -06:00
Matt Mackall
62d0fc250b util: disable floating point stat times (issue4836)
Alternate fix for this issue which avoids putting extra function calls
and exception handling in the fast path.

For almost all purposes, integer timestamps are preferable to
Mercurial. It stores integer timestamps in the dirstate and would thus
like to avoid doing any float/int comparisons or conversions. We will
continue to have to deal with 1-second granularity on filesystems for
quite some time, so this won't significantly hinder our capabilities.

This has some impact on our file cache validation code in that it
lowers timestamp resolution. But as we still have to deal with
low-resolution filesystems, we're not relying on this anyway.

An alternate approach is to use stat[ST_MTIME], which is guaranteed to
be an integer. But since this support isn't already in our extension,
we can't depend on it being available without adding a hard Python->C
API dependency that's painful for people like yours truly who have
bisect regularly and people without compilers.
2015-11-19 13:21:24 -06:00
Laurent Charignon
4840174abf rebase: refactoring to avoid repetition of expression
This patch removes the repetition of "(revignored, revprecursor, revpruned)"
and replaces its occurences with the more legible "revskipped".
2015-11-18 15:58:06 -08:00
Laurent Charignon
550f1e2875 rebase: remove an unused todo
Since we handled skipping obsolete revs when it is relevant, this todo is no
longer useful. We replace the comment with two useful comments.
2015-11-18 16:06:00 -08:00
Laurent Charignon
e24d860326 rebase: don't rebase obsolete commits with no successor
This patch avoids unnecessary conflicts to resolve during rebase for the users
of changeset evolution.

This patch modifies rebase to skip obsolete commits with no successor.
It introduces a new rebase state 'revpruned' for these revisions that are
being skipped and a new message to inform the user of what is happening.
This feature is gated behind the config flag experimental.rebaseskipobsolete

When an obsolete commit is skipped, the output is:
note: not rebasing 7:360bbaa7d3ce "O", it has no successor
2015-11-18 13:44:29 -08:00
Laurent Charignon
3bbe7ac5d7 rebase: fix a typo in test-rebase-obsolete
We had left a lonely single quote where it shouldn't be!
2015-11-18 13:46:42 -08:00
Matt Mackall
a20ef0162d merge with stable 2015-11-18 20:59:17 -06:00
liscju
ab17d6f05d rebase: add returning value from pullrebase function
So far pullrebase function has always returned None value, no matter
what orig function returned. This behaviour made impossible for
pull to change returned value from mercurial process (it has always
ended with 0 value by default). This patch makes pullrebase returning
with returned value from orig.
2015-11-15 22:18:48 +01:00
Siddharth Agarwal
4e11ac7ea5 resolve: restore .orig only after merge is fully complete (issue4952)
Previously, we'd restore the .orig file after the premerge is complete but
before the merge was complete. This would lead to the .orig file potentially
containing merge conflict markers in it, as a leftover from the last merge
attempt.
2015-11-13 15:56:02 -08:00
Gregory Szorc
c1d73b49e9 tags: create new sortdict for performance reasons
sortdict internally maintains a list of keys in insertion order. When a
key is replaced via __setitem__, we .remove() from this list. This
involves a linear scan and array adjustment. This is an expensive
operation.

The tags reading code was calling into sortdict.__setitem__ for each tag
in a read .hgtags revision. For repositories with thousands of tags or
thousands of .hgtags revisions, the overhead from list.remove()
noticeable.

This patch creates a new sortdict() so __setitem__ calls don't incur a
list.remove.

This doesn't appear to have any performance impact on my Firefox
repository. But that's only because tags reading doesn't show up in
profiles to begin with. I'm still waiting to hear from a user with over
10,000 tags and hundreds of heads on the impact of this patch.
2015-11-12 13:16:04 -08:00
FUJIWARA Katsunori
3536b81882 share: wrap bmstore._writerepo for transaction sensitivity (issue4940)
4bc805f938a0 made 'bmstore.write()' transaction sensitive, to restore
original bookmarks correctly at failure of a transaction.

For example, shelve and unshelve imply steps below:

  before 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' writes updated ones into .hg/bookmarks
    3. rollback transaction to remove internal commits
    4. restore updated bookmarks manually

  after 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' doesn't write updated ones into .hg/bookmarks
       (these are written into .hg/bookmarks.pending, if external hook
       is spawn)
    3. rollback transaction to remove internal commits
    4. .hg/bookmarks should be clean, because it isn't changed while
       transaction running: see (2) above

But if shelve or unshelve is executed in the repository created with
"shared bookmarks" ("hg share -B"), this doesn't work as expected,
because:

  - share extension makes 'bmstore.write()' write updated bookmarks
    into .hg/bookmarks of shared source repository regardless of
    transaction activity, and

  - intentional transaction failure at the end of shelve/unshelve
    doesn't restore already updated .hg/bookmarks of shared source

This patch makes share extension wrap 'bmstore._writerepo()' instead
of 'bmstore.write()', because the former is used to actually write
bookmark changes out.
2015-11-13 02:36:30 +09:00
Danek Duvall
d23d8113a8 test: test-bundle-type.t needs to work more universally
The cut and head utilities on Solaris have weird differences from the GNU
versions.  The f helper script does a dump more nicely than those tools,
anyway.
2015-11-10 09:58:10 -08:00
Matt Mackall
9b4fd50e2e Added signature for changeset ec7a5e1a55ed 2015-11-09 16:24:13 -06:00
Matt Mackall
2dd39095d7 posix: fix test-permissions regression 2015-11-09 15:53:11 -06:00
Anton Shestakov
169417da80 dockerlib: allow non-unique uid and gid of $DBUILDUSER (issue4657)
There are make targets for building mercurial packages for various
distributions using docker. One of the preparation steps before building is to
create inside the docker image a user with the same uid/gid as the current user
on the host system, so that the resulting files have appropriate
ownership/permissions.

It's possible to run `make docker-<distro>` as a user with uid or gid that is
already present in a vanilla docker container of that distibution. For example,
issue4657 is about failing to build fedora packages as a user with uid=999 and
gid=999 because these ids are already used in fedora, and groupadd fails.
useradd would fail too, if the flow ever got to it (and there was a user with
such uid already).

A straightforward (maybe too much) way to fix this is to allow non-unique uid
and gid for the new user and group that get created inside the image. I'm not
sure of the implications of this, but marmoute encouraged me to try and send
this patch for stable.
2015-11-08 01:10:52 +08:00
Mateusz Kwapich
266a6f869e dirstate: fix filefoldmap incosistency on file delete
The _filefoldmap is not updated in when files are deleted from dirstate. In the
case where the file with the same but differently cased name is added afterwards
it renders _filefoldmap incorrect.  Those steps must occur to for a problem to
reproduce:
 - call status (with listunknown=True),
 - update working rectory to a commit which does a casefolding change (A -> a)
 - call status again (it will show the file "a" as deleted)

Unfortunately I'm unable to write a test for it because I don't know any
core-mercurial command able to reproduce those steps.

The bug was originally spotted when hgwatchman was enabled. It caused the
changeset contents change during hg rebase (one file unrelarted to changeset
was deleted in it after rebase).

The hgwatchman is able to hit it because when hgignore changes the hgwatchmans
overridestatus is calling original status with listunknown=True.
2015-11-09 10:43:23 -08:00
Steve Borho
e04f287b5a wix: style-coal.css has been renamed 2015-11-09 09:41:20 -06:00
Javi Merino
65fb643f36 clonebundles: fix typo s/comand/command/ 2015-11-05 10:31:20 +00:00
Matt Mackall
8b9a3d960f posix: retry on symlink race in checklink
Multiple threads might attempt to check links with the same temporary
name. This would cause one side to get an EEXIST error and wrongly
fail the support check. Here, we simply retry if our temporary name
exists.
2015-11-06 15:23:10 -06:00
Pierre-Yves David
f89772113f changegroup: back code change of b5988e1d3dcb out
The previous changeset is a simpler way of fixing issue4934 without changing the
spirit of the code. We can remove the dual call to 'delayupdate' but we keep the
tests to show that the issue is still fixed.
2015-11-06 13:01:15 -05:00
Pierre-Yves David
dfd6e44ebe changegroup: call 'prechangegroup' hook before setting up write delay
The 'prechangegroup' interfere with 'delayupdate' logic because it trigger the
one time call of 'changelog._writepending' (see issure4934). There is no reason
not to call that hook before setting up 'delayupdate' so we move the call a bit
earlier to avoid interference.
2015-11-06 12:59:09 -05:00
Pierre-Yves David
107254a73d changegroup: fix the scope of a try finally
The try finally is here to ensure we release the just-created transaction.
Therefore we should not do half a dozen operations before actually entry the try
scope.
2015-11-06 12:39:06 -05:00
Yuya Nishihara
44b7401396 demandimport: fix level passed to loader of sub-modules
As the fromlist gives the names of sub-modules, they should be searched in
the parent directory of the package's __init__.py, which is level=1.

I got the following error by rewriting hgweb to use absolute_import, where
the "mercurial" package is referenced as ".." (level=2):

  ValueError: Attempted relative import beyond toplevel package

I know little about the import mechanism, but this change seems correct.
Before this patch, the following code did import the os module with no error:

  from mercurial import demandimport
  demandimport.enable()
  from mercurial import os
  print os.name
2015-11-01 21:19:09 +09:00
Yuya Nishihara
557c963f7b parsers: fix width of datalen variable in fm1readmarkers
Because parsers.c does not define PY_SSIZE_T_CLEAN, "s#" format requires
(const char*, int), not (const char*, Py_ssize_t).

https://docs.python.org/2/c-api/arg.html

This error had no problem before 7d13be5f72c2, where datalen wasn't used.
But now fm1readmarkers() fails with "overflow in obsstore" on Python 2.6.9
(amd64) because upper bits of datalen seem to be filled with 1, making it
a negative integer.

This problem seems not visible on our Python 2.7 environment because upper
bits happen to be filled with 0.
2015-11-07 17:43:20 +09:00
Pierre-Yves David
be4dcab05b hooks: back e7b51de6e8eb out
Changeset e7b51de6e8eb alters the 'HG_PENDING' mechanism to be "always" there.
This change is made under the assumption than we previously did it only when
"writepending() actually wrote something". This assumption was wrong,
'writepending()' informs of pending changes the first time something is written
and for all following calls. We back this change out to restore the former
behavior, which was already correct.
2015-11-06 11:08:11 -05:00
Durham Goode
49c25cc444 hooks: fix hooks not firing if prechangegroup was set (issue4934)
We need to call delayupdate again after writing to the changelog.
Otherwise the prechangegroup hook consumes the delayupdate subscription and
future hooks don't see the pending changes (see issue 4934 for more details).

Adds a test that triggers the prechangegroup hook before the pretxnchangegroup
hook and verifies that the output of pretxnchangegroup doesn't change.
2015-11-03 17:13:27 -08:00
Durham Goode
8bdfd3d55c hooks: always include HG_PENDING
Previously we would only include HG_PENDING in the hook args if the
transaction's writepending() actually wrote something. This is a bad criteria,
since it's possible that a previous call to writepending() wrote stuff and the
hooks want to still see that.

The solution is to always have hooks execute within the scope of the pending
changes by always putting HG_PENDING in the environment.
2015-11-03 16:58:13 -08:00
Gregory Szorc
61b9ffeec8 wireproto: move clonebundles command from extension (issue4931)
The SSH peer class accesses wireproto.commands[cmd] as part of encoding
command arguments. Previously, the wire protocol command was defined in
the clonebundles extension. If the client didn't have this extension
enabled (which it likely doesn't since it is meant as a server-side
extension), then clients attempting to clone via ssh:// would get a
crash due to a KeyError accessing wireproto.commands['clonebundles']
when cloning from a server that is advertising clone bundles.

Moving the definition of the wire protocol command to wireproto.py makes
this problem go away.

A side effect of this code move is servers will always respond to
"clonebundles" wire protocol command requests. This should be fine: the
server will return an empty response unless a clone bundles manifest
file is present and clients shouldn't call the command unless the server
is advertising the capability, which only happens if the clonebundles
extension is enabled and the manifest file exists.
2015-11-03 12:31:33 -08:00
Yuya Nishihara
dda890d7ab templatefilters: try round-trip utf-8 conversion by json filter (issue4933)
As JSON string is known to be a unicode, we should try round-trip conversion
for localstr type. This patch tests localstr type explicitly because
encoding.fromlocal() may raise Abort for undecodable str, which is probably
not what we want. Maybe we can refactor json filter to use encoding module
more later.

Still "{desc|json}" can't round-trip because showdescription() modifies a
localstr object.
2015-11-04 23:48:15 +09:00
Gregory Szorc
9a4b9852b5 exchange: do not attempt clone bundle if local repo is non-empty (issue4932) 2015-11-03 12:16:54 -08:00
Gregory Szorc
c07f0efcbf test-clonebundles.t: add test for incremental pull
This demonstrates issue4932.
2015-11-03 12:15:14 -08:00
Yuya Nishihara
1d7fbf80aa i18n: make sure to include translation of (DEPRECATED)
This patch replaces old "DEPRECATED" msgid by "(DEPRECATED)" if that .po
file does not have "(DEPRECATED)" but have "... (DEPRECATED)".

It is necessary to hide deprecated options correctly.
2015-11-03 22:44:57 +09:00
Yuya Nishihara
1a1642aa7c i18n: do not abuse msgstr of "DEPRECATED" to check for bad translation
Because f94973e0eefb requires the msgstr of "(DEPRECATED)", old *.po files
must be blamed. Using "DEPRECATED" would just hide the error.

For example, "LANG=da_DK.UTF-8 hg help serve" fails to hide deprecated
options right now, but check-translation.py couldn't detect it because
da.po has outdated translation of "DEPRECATED".
2015-11-03 22:39:26 +09:00
Matt Mackall
56dfb9561e Added signature for changeset 6146822a39c0 2015-11-01 13:04:14 -06:00
Yuya Nishihara
8110fbc21f hgweb: unify import style of error classes
It will be enforced by the import checker.
2015-11-01 14:43:25 +09:00
Yuya Nishihara
01e2649d34 hgweb: do not import templatefilters.revescape and websub as symbol
It will be enforced by the import checker.
2015-11-01 14:00:14 +09:00
Yuya Nishihara
ad55f13658 hgweb: alias ui module as uimod
It will be enforced by the import checker.
2015-11-01 13:58:32 +09:00
Siddharth Agarwal
0d7932e904 mergestate.commit: factor out making the list of records
Will aid in testing.
2015-11-17 14:23:26 -08:00
Siddharth Agarwal
9f1990c72b mergestate: move _read() call to read constructor
With this patch, mergestate.clean() will no longer abort when it encounters an
unsupported merge type. However we hold off on testing it until backwards
compatibility is in place.
2015-11-17 14:04:56 -08:00
Siddharth Agarwal
61e8a89dd2 debugmergestate: explain why we create mergestate objects directly
We would normally use the read() constructor, but in this case it's fine
because
- we implement our own reading layer, so the extra parsing done by
   read() is unnecessary
- read() can raise an exception for unsupported merge state records,
   but here we'd like to handle that separately
- debugmergestate needs to be privy to mergestate internals anyway
2015-11-17 14:22:30 -08:00
Christian Delahousse
b71632a839 debugdirstate: convert keyword parameters to **opts
Removes the named arguments and replaces them by accessing opts. This will be
used in the next patch in the series because we'll be adding more flags to
debugdirstate
2015-11-11 13:28:00 -08:00
Christian Delahousse
98bab4b18b convert: changed test's progress output format to ignore estimate
On my machine, whenever I run all test with a high -j value, test-convert-git.t
would consistently fail by displaying an estimate. This patch removes that value
from the output.
2015-11-17 18:01:21 -08:00
Laurent Charignon
f10bca562d mq: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, mq was using repo._bookmarks.write.
This patch replaces this code with the recommended way of saving bookmarks
changes: repo._bookmarks.recordchange.
2015-11-17 13:12:33 -08:00
Laurent Charignon
57a4bf9ef8 mq: indentation change to make the next patch more legible
We put the code to be indented in the next patch in a "if True:" block to make
it easier to review.
2015-11-17 13:12:46 -08:00
Laurent Charignon
7ef3c26089 bookmarks: use repo._bookmarks.recordchange instead of repo._bookmarks.write
We move from the old api repo._bookmarks.write to the new api
repo._bookmarks.recordchange.
2015-11-17 12:49:57 -08:00
Laurent Charignon
85b8e6613d localrepo: put bookmark move following commit in one transaction
Before this patch, making a commit on a local repo could move a bookmark and
both operations would not be grouped as one transaction. This patch makes both
operations part of one transaction. This is necessary to switch to the new api
to save bookmarks repo._bookmarks.recordchange if we don't want to change the
current behavior of rollback.

Dirstate change happening after the commit is done is now part of the
transaction mentioned above. This leads to a change in the expected output of
several tests.

The change to test-fncache happens because both lock are now released in the
same finally clause. The lock release is made explicitly buggy in this test.
Previously releasing lock would crash triggering release of wlock that crashes
too. Now lock release crash does not directly result in the release of wlock.
Instead wlock is released at garbage collection time and the error raised at
that time "confuses" python.
2015-11-18 01:36:58 -08:00
Siddharth Agarwal
dbd338edf0 test-resolve.t: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 15:43:21 -08:00
Siddharth Agarwal
b5cb4f4050 localrepo.commit: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 13:58:50 -08:00
Siddharth Agarwal
178aa21f0d fileset: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 13:57:38 -08:00
Siddharth Agarwal
2204a499bc commands.summary: switch to mergestate.read()
See previous patch for why we're doing this.

We do this with a bit of care -- it would be bad form for 'hg summary' to abort
completely if we encounter an unsupported merge record. Instead just warn about
that and continue with the rest of the summary.
2015-11-17 14:20:55 -08:00