Commit Graph

51 Commits

Author SHA1 Message Date
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Yuya Nishihara
efaf86bce6 eol: replace "working copy" with "working directory" in extension help 2015-03-17 20:41:52 +09:00
Angel Ezquerra
88cbab7845 localrepo: remove all external users of localrepo.opener
This change touches every module in which repository.opener was being used, and
changes it for the equivalent repository.vfs. This is meant to make it easier
to split the repository.vfs into several separate vfs.

It should now be possible to remove localrepo.opener.
2015-01-15 23:17:12 +01:00
Mads Kiilerich
a195867192 eol: fix crash when handling removed files
ci --amend would in some cases fail after 2eef89bfd70d failed to refactor the
eol extension too.
2014-10-22 16:10:23 +02:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
0eed53de6c i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that format string consists of multiple string
components concatenated implicitly or explicitly,

This patch does below for that regexp pattern to detect "% inside _()"
problems in such case.

  - put "+" into separator part ("[ \t\n]") for explicit concatenation
    ("...." + "...." style)

  - enclose "component and separator" part by "(?:....)+" for
    concatenation itself ("...." "...." or "...." + "....")
2014-04-01 02:46:03 +09:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Simon Heimberg
25ae76fc48 documentation: add an extra newline after note directive
Like this no docutils version interprets any line in the following text as
argument of note.
2013-11-05 08:59:55 +01:00
Bryan O'Sullivan
ffb0e7fc5d eol: don't refer to a random name-captured ui object
Previously, we used a ui object captured at the time of monkeypatching.
2012-11-20 14:21:56 -08:00
timeless@mozdev.org
8d25b9561a spelling: Macintosh 2012-08-17 13:58:18 -07:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Martin Geisler
83e80ac544 eol: remove left-over print statements 2012-03-15 16:57:19 +01:00
Martin Geisler
d25c6987fd eol: document why os.utime doesn't work here
I wanted to use

  os.utime(self.join("eol.cache"), None)

as a cleaner way of touching the cache file -- but this fails when the
cache doesn't exist.
2012-03-15 16:52:22 +01:00
Matt Mackall
4773ae257d merge with stable 2011-07-13 16:29:28 -05:00
Matt Mackall
db0ee5fbeb eol: fix silly test-gendoc breakage by escaping control characters 2011-07-12 16:22:36 -05:00
Nicholas Riley
8b7c28a23b eol: ignore IOError from deleted files in commitctx
A Mercurial repo signals a file is deleted by raising IOError when the
file's data is requested.  This IOError is normally caught by
localrepository.commitctx.  With the eol extension enabled and EOL
mappings in place, the eolrepo subclass should ignore IOError because
a deleted file has no line endings to process.

This issue exhibited itself when performing an incremental hg convert
of a revision with deleted files to a repo with an existing .hgeol
file.
2011-07-12 12:06:11 -04:00
Martin Geisler
caafeeda38 eol: document new eol.fix-trailing-newline setting 2011-07-07 12:13:07 +02:00
Stepan Koltsov
a47a7047c8 eol: fix missing trailing newlines in comitted files
Some text editors (Eclipse, for example) do not add trailing newlines,
so diffs often contain annoying "\ No newline at the end of file".
This patch to eol extension simply adds trailing newline on commit.
2011-07-01 23:12:52 +04:00
Stepan Koltsov
8ad66e155c eol: eol.only-consistent can now be specified in .hgeol 2011-07-01 22:53:58 +04:00
Patrick Mezard
5f254d281f eol: no need to accumulate files when checking all changesets
Just check the files touched by the changesets.
2011-03-14 21:31:54 +01:00
Patrick Mezard
99858baa84 eol: improve hook failure output
Before, only the first failure was reported:

  abort: b.txt should not have CRLF line endings

while now all of them are listed:

  abort: end-of-line check failed:
    d.txt in a7040e68714f should not have CRLF line endings
    b.txt in fbcf9b1025f5 should not have CRLF line endings

As first suggested by Antoine Pitrou <solipsis@pitrou.net>
2011-03-14 21:08:18 +01:00
Steve Borho
af5b09475e merge with stable 2011-03-13 10:09:30 -05:00
Steve Borho
f61b2a6d58 eol: do not abort when win32text is found, only warn
The win32text extension does not break eol or vice-versa, so it is not a fatal
error to have both of them enabled.  It's just folly.  So spewing warnings in
this condition is preferrable to aborting.  When both extensions are enabled,
the user now sees:

% hg st
the eol extension is incompatible with the win32text extension
win32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension
M hgext/eol.py
2011-03-13 10:03:06 -05:00
Patrick Mezard
d52fb5d6ab eol: rename hook into checkheadshook, add checkallhook (issue2665)
"hook" is still an alias for "checkheadshook".
2011-03-13 15:07:44 +01:00
Patrick Mezard
25db85f436 eol: make the hook check all new heads, not only tip (issue2666)
Report and test by Antoine Pitrou <solipsis@pitrou.net>
2011-03-13 15:07:44 +01:00
Patrick Mezard
31042d7b6f eol: the hook no longer requires the extension to be loaded
Reading rules in the hook means we no longer need ui to be filled and do not
need reposetup() to be run anymore.
2011-03-13 15:07:44 +01:00
Patrick Mezard
df3e99aabe eol: extract parsing error handling in parseeol() 2011-03-13 15:07:44 +01:00
Patrick Mezard
6138329fcd eol: separate .hgeol parsing from merge in ui
This will help refactoring the hook.
2011-03-13 15:07:44 +01:00
Patrick Mezard
bd3e6eac01 eol: remove unused argument in readhgeol() 2011-03-13 15:07:44 +01:00
Patrick Mezard
683492a8b0 eol: explain why reading .hgeol from the working dir is special 2011-03-13 15:07:44 +01:00
Martin Geisler
27aa536556 eol: use dirstate methods to clear dirstate
This fixes a race that was observed when status was called before and
after clearing the dirstate.
2011-03-12 12:11:09 +01:00
Martin Geisler
8ccb77ff7e eol: do not abort on parse error
Handle parse errors in the .hgeol similarly to how parse errors in the
.hgtags file are handled: by issuing a warning. This allows the user
to revert the file using 'hg revert' or 'hg update -C'.
2011-02-28 15:46:48 +01:00
Martin Geisler
1d26a9d184 eol: be explicit about how to enable hook (issue2661) 2011-02-28 09:28:18 +01:00
Antoine Pitrou
a5201c7f89 eol: stop after first matched rule in hook (issue2660)
When matching a file against the rules in .hgeol, the eol extension's
hook should stop after the first matching rule is encountered.
Otherwise, if this rule is contradicted by other more general rule
(for example a catch-all at the end of .hgeol), some files are simply
impossible to push. Trivial example:

  **.bat = CRLF
  **     = LF

If all matching rules were applied, a .bat file would be rejected
either because it has LFs (first rule) or because it has CRLFs (second
rule).
2011-02-27 19:50:28 +01:00
Martin Geisler
da42b93613 eol: handle LockUnavailable error (issue2569)
If the repository is not locked when clearing the dirstate, then
running test-eol.t in a loop fails sooner or later with:

  ERROR: /home/mg/src/mercurial-crew/tests/test-eol.t output changed
  --- /home/mg/src/mercurial-crew/tests/test-eol.t
  +++ /home/mg/src/mercurial-crew/tests/test-eol.t.err
  @@ -343,6 +343,7 @@
     % hg status (eol activated)
     M win.txt
     % hg commit
  +  nothing changed
     % hg status
     $ testmixed CRLF

However, if we cannot lock the repository, then we can also not make a
commit and so we can simply ignore a LockUnavailable error.
2011-02-25 12:32:15 +01:00
Martin Geisler
3bd524372d eol: clarify where the .hgeol file is located 2011-02-25 10:52:37 +01:00
Martin Geisler
679f27515a merge with stable 2010-12-13 11:53:17 +01:00
Erik Zielke
cd263d594c eol: improve help on whether EOLs are changed in working copy or repository
Improved help to make it more clear for users which changes are only
changes in the working copy and which changes that will go into the
repository (on the following commit). Futhermore a note on when the
rules will be applied to the working directory.
2010-11-22 14:36:57 +01:00
Martin Geisler
750fe9abd1 eol: mention the hook in the module docstring 2010-11-13 15:57:12 +01:00
Colin Caughie
83d5ec6c25 eol: exclude .hgtags file from eol translation (issue2493) 2010-11-13 15:02:02 +01:00
Martin Geisler
ad31db42bf merge with stable 2010-11-13 15:57:40 +01:00
Martin Geisler
2f43114d9f eol: fix win32text encode/decode filter names 2010-11-13 15:46:51 +01:00
Martin Geisler
d9339ae620 merge with stable 2010-11-13 15:12:09 +01:00
Colin Caughie
b10fcb9768 eol: added filter aliases for backwards compatibility with win32text
This makes it possible to switch most win32text configurations (i.e. those
that use cleverencode and cleverdecode) to hgeol simply by disabling one and
enabling the other. Any rules found in repo-specific .hgeol files will be
appended to the configuration in .hgrc.
2010-11-10 20:26:56 +00:00
Georg Brandl
13bd1daeb5 eol: add missing word in module docstring 2010-10-21 17:02:08 +02:00
Steve Borho
8230ece29c Merge with stable 2010-09-15 17:48:03 -05:00
Steve Borho
6c61bc3690 eol: setup the repo.ui in reposetup()
This fixes problems some have reported using the eol extension
together with TortoiseHg.  It ensures the ui associated with the
repository has the preupdate.eol hook configured.
2010-09-15 17:46:51 -05:00
Brodie Rao
203cf2fbd9 cleanup: remove unused imports 2010-08-27 13:32:38 -04:00