Commit Graph

44 Commits

Author SHA1 Message Date
Matt Mackall
7cae202e57 merge with stable 2011-07-29 17:27:38 -05:00
FUJIWARA Katsunori
a423a1ab9d i18n: use UTF-8 string to lower filename for case collision check
Some character sets, cp932 (known as Shift-JIS for Japanese) for
example, use 0x41('A') - 0x5A('Z') and 0x61('a') - 0x7A('z') as second
or later character.

In such character set, case collision checking recognizes different
files as CASEFOLDED same file, if filenames are treated as byte
sequence.

win32mbcs extension is not appropriate to handle this problem, because
this problem can occur on other than Windows platform only if
problematic character set is used.

Callers of util.checkcase() use known ASCII filenames as last
component of path, and string.lower() is not applied to directory part
of path. So, util.checkcase() is kept intact, even though it applies
string.lower() to filenames.
2011-07-28 14:36:07 +09:00
Steve Borho
bb2fdf8f33 scmutil: add missing import of re
see https://bitbucket.org/tortoisehg/thg/issue/929
2011-07-08 20:24:19 -05:00
Pierre-Yves David
2ebc0660c3 requirements: show all missing features in the error message.
Displaying all missing featureis help people to solve the issue (choosing the
right version, creation the right repo)
2011-06-25 02:30:24 +02:00
Adrian Buehlmann
a6cb8dc613 opener: add self._audit (issue2862) 2011-06-22 10:13:44 +02:00
Matt Mackall
deda228cd7 scmutil: match no longer accepts repo objects 2011-06-18 16:52:51 -05:00
Matt Mackall
5ab97592f7 scmutil: switch match users to supplying contexts
The most appropriate context is not always clearly defined. The obvious cases:

For working directory commands, we use None
For commands (eg annotate) with single revs, we use that revision

The less obvious cases:

For commands (eg status, diff) with a pair of revs, we use the second revision
For commands that take a range (like log), we use None
2011-06-18 16:52:51 -05:00
Matt Mackall
7fe2a75e90 scmutil: match now accepts a context or a repo 2011-06-18 16:52:51 -05:00
Matt Mackall
3ca86d272f context: add a match builder method
This is groundwork for matching against filesets in contexts
2011-06-18 16:52:51 -05:00
Matt Mackall
86143efd7d scmutil: improve path calculation for install-relative RC files (issue2841)
This code was ugly and might do the wrong thing with symlinks.
2011-06-03 15:08:08 -05:00
Matt Mackall
b0048281b5 requires: note apparent corruption 2011-05-31 15:55:23 -05:00
Adrian Buehlmann
cfc4484960 readrequires: provide easier to understand error message
NEW:

  $ hg id
  abort: unknown repository format: requires feature 'foo' (upgrade Mercurial)!

OLD:

  $ hg id
  abort: requirement 'foo' not supported!
2011-05-31 19:16:25 +02:00
Adrian Buehlmann
924c56c606 introduce new function scmutil.readrequires
for reading and parsing the .hg/requires file
2011-05-31 19:16:18 +02:00
Matt Mackall
c6e850b04b context: make forget work like commands.forget
Switch users of wctx.delete(..., False) to forget.
2011-05-26 17:15:35 -05:00
Adrian Buehlmann
60c5ff105b opener: add audit function 2011-05-21 23:13:59 +02:00
Matt Mackall
03aaf3756d scmutil: fold in wdutil 2011-05-13 14:07:16 -05:00
Matt Mackall
cf07129983 scmutil: move revsingle/pair/range from cmdutil
This allows users at levels below the command layer to avoid import loops.
2011-05-13 14:06:28 -05:00
Augie Fackler
7d6e3ac2bb walkrepos: use getattr instead of hasattr for samestat 2011-07-25 15:45:11 -05:00
Idan Kamara
3b6032fdaf scmutil: introduce filecache
The idea is being able to associate a file with a property, and watch
that file stat info for modifications when we decide it's important for it to
be up-to-date. Once it changes, we recreate the object.

On filesystems that can't uniquely identify a file, we always recreate.

As a consequence, localrepo.invalidate() will become much less expensive in the
case where nothing changed on-disk.
2011-07-09 19:06:59 +03:00
Adrian Buehlmann
98828d8530 opener: rename _can_symlink to _cansymlink 2011-05-07 20:22:32 +02:00
Adrian Buehlmann
b84ce08e82 rename util.executable_path to executablepath 2011-05-06 15:36:05 +02:00
Adrian Buehlmann
554b565228 rename util.lookup_reg to lookupreg 2011-05-06 15:16:22 +02:00
Adrian Buehlmann
c451efca8a scmutil: rename local function _add_dir_if_not_there 2011-05-06 15:02:53 +02:00
Adrian Buehlmann
9804b19041 rename scmutil.user_rcpath to userrcpath 2011-05-06 14:58:04 +02:00
Adrian Buehlmann
5b97603cc4 rename scmutil.system_rcpath to systemrcpath 2011-05-06 14:54:05 +02:00
Adrian Buehlmann
761f9b4904 rename scmutil.os_rcpath to osrcpath 2011-05-06 14:52:25 +02:00
Adrian Buehlmann
e981d64ef2 rename path_auditor to pathauditor
The Mercurial 1.9 release is moving a lot of stuff around anyway and we are
already moving path_auditor from util.py to scmutil.py for that release.

So this seems like a good opportunity to do such a rename. It also strengthens
the current project policy to avoid underbars in names.
2011-05-06 09:54:06 +02:00
Dan Villiom Podlaski Christiansen
88e742876f util & scmutil: adapt read/write helpers as request by mpm 2011-05-02 10:11:05 +02:00
Adrian Buehlmann
c14abef27b scmutil: introduce casecollisionauditor
and cleaning up portability functions
2011-04-30 23:27:00 +02:00
Dan Villiom Podlaski Christiansen
e36632966a opener: add read & write utility methods
The two new methods are useful for quickly opening a file for reading
or writing. Unlike 'opener(...).read()', they ensure they the file is
immediately closed without relying on CPython reference counting.
2011-04-30 19:41:53 +02:00
Dan Villiom Podlaski Christiansen
9b9141450f add filteropener abstraction for store openers 2011-04-30 19:37:13 +02:00
Dan Villiom Podlaski Christiansen
30ecd40f14 opener: introduce an abstact superclass of it
Currently, this class doesn't do anything useful.
2011-04-30 19:36:48 +02:00
Kevin Gessner
e0a808198a add: notify when adding a file that would cause a case-folding collision
On a case-sensitive file system, files can be added with names that differ
only in case (a "case collision"). This would cause an error on case-insensitive
filesystems. A warning or error is now given for such collisions, depending on
the value of ui.portablefilenames ('warn', 'abort', or 'ignore'):

    $ touch file File
    $ hg add --config ui.portablefilenames=abort File
    abort: possible case-folding collision for File
    $ hg add File
    warning: possible case-folding collision for File
2011-04-30 12:39:46 +02:00
Kevin Gessner
3eac7995c0 scmutil: refactor ui.portablefilenames processing
The ui.portablefilenames config handling is generally useful for notifying the
user of various portability problems.
2011-04-30 11:08:24 +02:00
Adrian Buehlmann
a928db8b4e move system_rcpath and user_rcpath to scmutil 2011-04-21 21:16:54 +02:00
Adrian Buehlmann
bee8559898 move os_rcpath from util to scmutil 2011-04-21 20:54:45 +02:00
Adrian Buehlmann
9a67b02dba move rcpath from util to scmutil 2011-04-21 20:14:29 +02:00
Adrian Buehlmann
267c80394b move walkrepos from util to scmutil 2011-04-21 16:06:19 +02:00
Adrian Buehlmann
756a1d3529 move checkfilename from util to scmutil
checkfilename is specific to Mercurial, since it contains the knowledege
that Mercurial can't track files with \n or \r in the name.
2011-04-21 13:18:52 +02:00
Adrian Buehlmann
bf5585ac5b scmutil: fix erroneous Abort call
This fixes d26b1348d3f6 (affected Windows only).
2011-04-21 12:10:03 +02:00
Adrian Buehlmann
307196b733 move path_auditor from util to scmutil 2011-04-20 22:43:31 +02:00
Adrian Buehlmann
f3e8eae526 move canonpath from util to scmutil 2011-04-20 21:41:41 +02:00
Adrian Buehlmann
cf126bb7dd move opener from util to scmutil 2011-04-20 19:54:57 +02:00
Adrian Buehlmann
fc7e20743c add: introduce a warning message for non-portable filenames (issue2756) (BC)
On POSIX platforms, the 'add', 'addremove', 'copy' and 'rename' commands now
warn if a file has a name that can't be checked out on Windows.

Example:

  $ hg add con.xml
  warning: filename contains 'con', which is reserved on Windows: 'con.xml'
  $ hg status
  A con.xml

The file is added despite the warning.

The warning is ON by default. It can be suppressed by setting the config option
'portablefilenames' in section 'ui' to 'ignore' or 'false':

  $ hg --config ui.portablefilenames=ignore add con.xml
  $ hg sta
  A con.xml

If ui.portablefilenames is set to 'abort', then the command is aborted:

  $ hg --config ui.portablefilenames=abort add con.xml
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'

On Windows, the ui.portablefilenames config setting is irrelevant and the
command is always aborted if a problematic filename is found.
2011-04-19 12:42:53 +02:00