Commit Graph

27196 Commits

Author SHA1 Message Date
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
FUJIWARA Katsunori
6881eb2c6f i18n: look translation of both "DEPRECATED" and "(DEPRECATED)" up
Since f94973e0eefb, deprecated commands, options and so on are
detected by "(DEPRECATED)" instead of "DEPRECATED".

"hg.pot" generated from recent source files doesn't contain msgid
"DEPRECATED", and looking the translation of "DEPRECATED" up in
up-to-date *.po files works incorrectly.

But on the other hand, there are still old *.po files, which contain
msgid "DEPRECATED" but not "(DEPRECATED)". Looking the translation of
"(DEPRECATED)" up in such old *.po files also works incorrectly.

This patch resolves this problem by looking translation of both
"DEPRECATED" and "(DEPRECATED)" up.

This should work correctly, because previous patch makes "deprecated"
checker be applied only on translations, of which msgid contains exact
"(DEPRECATED)" string.

'p.msgstr' examination in 'deprecatedsetup()' is needed to ignore
untranslated entries. This also makes 'deprecatedpe.msgstr'
examination in 'deprecated()' meaningless.
2015-11-01 08:38:56 +09:00
FUJIWARA Katsunori
7c484b491b i18n: fix regexp pattern to detect translation for DEPRECATED
Since f94973e0eefb, deprecated commands, options and so on are
detected by "(DEPRECATED)" instead of "DEPRECATED".

Therefore, 'deprecated' checker in i18n/check-translation.py should
check translation, of which msgid contains "(DEPRECATED)" instead of
"DEPRECATED".

At glance, it seems to do so, but it actually doesn't, because Python
regexp treats "()" as grouping of patterns and "(DEPRECATED)" matches
only against "DEPRECATED".
2015-11-01 08:38:56 +09:00
Matt Harbison
de09629866 scmutil: abort if an empty revision is given to revpair()
When using 'extdiff --patch' to check the changes in a rebase, 'precursors(x)'
evaluated to an empty set because I forgot the --hidden flag, so the other
revision was used as the replacement for the empty set.  The result was the
patch for the other revision was diffed against itself, and the tool saying
there were no differences.  That's misleading since the expected diff args were
silently changed, so it's better to bail out.

The other uses of scmutil.revpair() are commands.diff and commands.status, and
it doesn't make sense to allow an empty revision there either.  The code here
was suggested by Yuya Nishihara.
2015-10-31 21:45:46 -04:00
Wagner Bruna
d32d84ab4a i18n-pt_BR: synchronized with 9258975676a4 2015-11-01 15:24:57 -02:00
FUJIWARA Katsunori
66cb39338f i18n-ja: synchronized with 284326a73bff 2015-11-01 05:34:27 +09:00
Augie Fackler
75a732a6ac packaging: rework version detection and declaration (issue4912)
Previously the -rc in our rc tags got dropped, meaning that those
packages looked newer to the packaging system than the later release
build. This rectifies the issue, though some damage may already have
been done on 3.6-rc builds.

I'm mostly cargo-culting the RPM version format - there don't appear
to be rules for RPM about how to handle this. Hopefully an RPM
enthusiast can fix up what I've done as a followup.
2015-10-26 14:19:37 -04:00
Anton Shestakov
04c432b846 hgweb: escape class keyword when used as a js object property (issue4913) 2015-10-27 12:34:05 +08:00
FUJIWARA Katsunori
f850c84e84 localrepo: discard objects in _filecache at transaction failure (issue4876)
'repo.invalidate()' deletes 'filecache'-ed properties by
'filecache.__delete__()' below via 'delattr(unfiltered, k)'. But
cached objects are still kept in 'repo._filecache'.

    def __delete__(self, obj):
        try:
            del obj.__dict__[self.name]
        except KeyError:
            raise AttributeError(self.name)

If 'repo' object is reused even after failure of command execution,
referring 'filecache'-ed property may reuse one kept in
'repo._filecache', even if reloading from a file is expected.

Executing command sequence on command server is a typical case of this
situation (e0a0f9ad3e4c also tried to fix this issue). For example:

  1. start a command execution

  2. 'changelog.delayupdate()' is invoked in a transaction scope

     This replaces own 'opener' by '_divertopener()' for additional
     accessing to '00changelog.i.a' (aka "pending file").

  3. transaction is aborted, and command (1) execution is ended

     After 'repo.invalidate()' at releasing store lock, changelog
     object above (= 'opener' of it is still replaced) is deleted from
     'repo.__dict__', but still kept in 'repo._filecache'.

  4. start next command execution with same 'repo'

  5. referring 'repo.changelog' may reuse changelog object kept in
     'repo._filecache' according to timestamp of '00changelog.i'

     '00changelog.i' is truncated at transaction failure (even though
     this truncation is unintentional one, as described later), and
     'st_mtime' of it is changed. But 'st_mtime' doesn't have enough
     resolution to always detect this truncation, and invalid
     changelog object kept in 'repo._filecache' is reused
     occasionally.

     Then, "No such file or directory" error occurs for
     '00changelog.i.a', which is already removed at (3).

This patch discards objects in '_filecache' other than dirstate at
transaction failure.

Changes in 'invalidate()' can't be simplified by 'self._filecache =
{}', because 'invalidate()' should keep dirstate in 'self._filecache'

'repo.invalidate()' at "hg qpush" failure is removed in this patch,
because now it is redundant.

This patch doesn't make 'repo.invalidate()' always discard objects in
'_filecache', because 'repo.invalidate()' is invoked also at unlocking
store lock.

  - "always discard objects in filecache at unlocking" may cause
    serious performance problem for subsequent procedures at normal
    execution

  - but it is impossible to "discard objects in filecache at unlocking
    only at failure", because 'releasefn' of lock can't know whether a
    lock scope is terminated normally or not

    BTW, using "with" statement described in PEP343 for lock may
    resolve this ?

After this patch, truncation of '00changelog.i' still occurs at
transaction failure, even though newly added revisions exist only in
'00changelog.i.a' and size of '00changelog.i' isn't changed by this
truncation.

Updating 'st_mtime' of '00changelog.i' implied by this redundant
truncation also affects cache behavior as described above.

This will be fixed by dropping '00changelog.i' at aborting from the
list of files to be truncated in transaction.
2015-10-24 18:58:57 +09:00
Gábor Stefanik
9c2ffda81c demandimport: fix TypeError when importing Python regex library (issue4920) 2015-10-28 16:27:09 +01:00
Gregory Szorc
059667a51c bundle2: attribute remote failures to remote (issue4788)
Before bundle2, hook output from hook failures was prefixed with
"remote: ". Up to this point with bundle2, the output was converted to
the message to print in an Abort exception. This had 2 implications:

1) It was unclear whether an error message came from the local repo
   or the remote
2) The exit code changed from 1 to 255

This patch changes the handling of error:abort bundle2 parts during push
to prefix the error message with "remote: ". This restores the old
behavior.

We still preserve the behavior of raising an Abort during bundle2
application failure. This is a regression from pre-bundle2 because the
exit code changed.

Because we no longer raise an Abort with the remote's message, we needed
to insert a message for the new Abort. So, I invented a new error
message for that. This is another change from pre-bundle2. However, I
like the new error message because it states unambiguously who aborted
the push failed, which I think is important for users so they can decide
what's next.
2015-10-24 00:39:22 +01:00
Gregory Szorc
34a39c5786 tests: add tests for remote hook output (issue4788)
The added tests don't agree in their output. This demonstrates a
difference in `hg push` behavior between pre-bundle2 and bundle2.
A subsequent patch will attempt to restore some of the pre-bundle2
behavior to bundle2.
2015-10-24 00:39:26 +01:00
Yuya Nishihara
0ef9d443e7 help: mention alias and revsetalias in description of HGPLAINEXCEPT 2015-10-24 06:59:26 +01:00
Augie Fackler
8501cbfa05 debugrevlog: cope with empty revlog files
I have no idea where it came from, but my clone of Mercurial has an
empty filelog for `contrib/hgfixes/__init__.py` - it's *valid*, just
contains no nodes. Without this change, debugrevlog crashes with a
zero division error.
2015-10-23 11:04:53 -04:00
Mads Kiilerich
f3cdae8f42 largefiles: don't mute and obfuscate http errors when putlfile fails
'unexpected putlfile response: None' when an http error occurs is not very
helpful.

Instead, leave the handling of urllib2.HTTPError exceptions to other layers.
2015-10-23 21:27:29 +02:00
Mads Kiilerich
d6bc0b0c94 largefiles: test coverage of error handling from putlfile
This reveals a wrong and unhelpful 'unexpected putlfile response'.
2015-10-23 21:27:29 +02:00
Mads Kiilerich
24ee58b9f9 largefiles: check hash of files in the store before copying to working dir
If the store somehow got corrupted, users could end up in weird situations that
were very hard to recover from or lead to propagation of the corruption.

Instead, spend the extra time checking the hash when copying to the working
directory. If it doesn't match, emit a warning, and don't put wrong content in
the working directory.
2015-10-23 21:27:29 +02:00
Mads Kiilerich
d9326efafd largefiles: test coverage of handling of store corruption
This reveals that update might put a corrupted largefile in the working
directory where it will show up as modified and ready for commit.
2015-10-23 21:27:29 +02:00
Augie Fackler
86f88ad861 merge: improve clarity of table in update docstring 2015-10-23 06:06:22 -04:00
Gregory Szorc
51ee0dd173 ui: support paths.default-push without paths.default set (issue4914)
This behavior regressed as part of the paths API refactoring. Previous
behavior was to accept "default-push" without "default" defined. Current
behavior aborts with "default repository not configured!." This patch
restores the old behavior and adds test coverage for the scenario, which
was absent before.
2015-10-22 18:59:03 +00:00
Matt Mackall
afeb6dfab1 bookmarks: don't allow pushing new head for existing mark with -B (issue4400) 2015-10-21 16:21:27 -05:00
timeless
ca55452b0c commands: fix help for debugobsolete 2015-10-20 18:46:00 -04:00
Mads Kiilerich
602d83e7e6 largefiles: fix explicit commit of normal/largefile switch
Commit of corresponding normal/largefiles pairs would only commit the standin.
That is usually fine, except if either the normal file or the standin is a
remove while the other is an add. In that case it would either give duplicate
colliding entries or lose the file.

Instead, commit both filenames if one of them is a remove.
2015-10-21 00:18:11 +02:00
Mads Kiilerich
9ee2da06e7 largefiles: test coverage of explicit commit of normal/largefile switch
This reveals that a switch from normal to largefile violates the normal
largefile invariant and gives a manifest with both a normal and standin file
in the repository, while a switch from largefile to normal gives nothing.
Not good.
2015-10-21 00:10:46 +02:00
Matt Mackall
6424ee1cc3 Added signature for changeset d09fb31255d0 2015-10-20 16:00:02 -05:00
Mads Kiilerich
84f1b9864b convert: fix Python syntax in 'splice in' message
Instead of reporting
  spliced in ['82544090e14fe18091e04f1fb0f0d7991cbe6e7e'] as parents of 369fd983d9e13330e9f12d9fce820deae84ea223
report
  spliced in 82544090e14fe18091e04f1fb0f0d7991cbe6e7e as parents of 369fd983d9e13330e9f12d9fce820deae84ea223
2015-10-19 16:49:54 +02:00
Mads Kiilerich
58681faacf rebase: fix wrong 'no changes to commit' when using --collapse
--collapse will do that rebase doesn't commit until the final commit. The lack
of a new commit would make it look like the rebase didn't contribute any
changes.

Instead, only warn about no commits when not using --collapse.
2015-10-19 16:29:35 +02:00
Sean Farley
68f4554f78 pull: all pass along extra opargs
Wihtout this patch, commands.pull silently drops opargs defeating the whole
purpose of the argument.
2015-10-19 15:47:40 -07:00
Sean Farley
4c9db86a8b push: all pass along opargs
Wihtout this patch, commands.push silently drops opargs defeating the whole
purpose of the argument.
2015-10-19 15:43:35 -07:00
timeless
f10778ca64 check-code: allow argument passing py2.6ism
this backs out dead48a12ce0, because Python2.5 support was dropped
2015-10-15 17:28:26 -04:00
timeless
d454b6c02e mail: drop python 2.5 self.sock.read workaround 2015-10-15 17:24:42 -04:00
timeless
803e780536 url: drop support for python2.5 2015-10-15 17:21:08 -04:00
timeless
ed8b59f668 win32: drop reference to python2.5 2015-10-15 17:19:11 -04:00
Ryan McElroy
20c45a5f3d editmerge: dequote other use of $ED
We want to support editors with parameters, eg EDITOR="vim -O" or whatever.
So remove the quotes from around $ED and assume that the editor variable is
properly escaped already.
2015-10-19 21:36:12 -07:00
Pierre-Yves David
c5425dd70d bundlerepo: properly extract compressed changegroup from bundle2
Before this bundle repository were unable to work with compressed
bundle2. We use the same approach as with bundle1, we extract the
changegroup in uncompressed form into a temporary file.
2015-10-19 16:01:55 +02:00
Pierre-Yves David
2468be2e78 bundle2: make unbundle.compressed return True when compressed
We were returning 'False' in all cases, even when the bundle2 was actually
compressed.
2015-10-02 23:21:39 -07:00
Pierre-Yves David
a23eeef4af bundlerepo: uncompress changegroup in bundle1 case only
Uncompressing bundle2 needs to be handled differently.
2015-10-19 18:04:08 +02:00
Pierre-Yves David
d47e68c4cf bundlerepo: move temp-bundle writing logic into a closure
We will reuse this logic for bundle2
2015-10-19 17:58:04 +02:00
Pierre-Yves David
a5218017f2 shelve: properly process bundle2 bundle 2015-10-19 15:42:50 +02:00
Pierre-Yves David
eaea148fdb histedit: properly apply bundle2 backups
If the histedit fails, we restore a backup. We make sure this backup bundle can
be in bundle2 format as general delta will require.
2015-10-20 03:07:23 +02:00
Pierre-Yves David
0089eccb8e strip: pass source and url to bundle2 processing
Restoring from a 'bundle2' was missing this data.
2015-10-20 16:01:33 +02:00