Commit Graph

3266 Commits

Author SHA1 Message Date
Matt Mackall
7cf4e6eacb merge with stable 2011-12-16 19:05:59 -06:00
FUJIWARA Katsunori
fe972435d4 i18n: use encoding.lower/upper for encoding aware case folding
this patch uses encoding.lower/upper for case folding, because ones of
str can not fold case of non ascii characters correctly.

to avoid cyclic dependency and to encapsulate logic of normcase in
each platforms, this patch introduces encodinglower/encodingupper in
both posix/windows specific files.

this patch does not change implementation of normcase() in posix.py,
because we do not know the encoding of filenames on POSIX.

some "normcase()" are excluded from function wrap list in
hgext/win32mbcs.py, because they become encoding aware by this patch.
2011-12-16 21:09:41 +09:00
FUJIWARA Katsunori
cfdf6a59f4 windows: use upper() instead of lower() or os.path.normcase()
this patch uses upper() instead of lower() or os.path.normcase() for
case folding on Windows(NTFS), because lower-ing causes problems for
some languages on it.

see below for detail about problem of lower-ing:

    https://blogs.msdn.com/b/michkap/archive/2005/01/16/353873.aspx
2011-12-16 21:09:40 +09:00
Matt Mackall
ee2f119c93 merge with stable 2011-12-15 16:50:21 -06:00
Kevin Gessner
edef96f084 largefiles: don't require a user cache (issue3088) (issue3155)
If the user cache path isn't specified in .hgrc, and it can't be constructed
from the environment, don't try to use that cache.
2011-12-15 13:19:43 -05:00
Nikolaus Schueler
efb688abc6 notify: change behavior of "changegroup" hook
Change the behavior so that the sender (the "From" header in the notification
mail) in case of the "changegroup" hook is the user that did the first commit
in the changegroup.  The option is configurable, if you set "notify.fromauthor"
to "True" in your config, the new behavior is activated.  If you do not set the
option, the behavior is as before.  The commit adds to an existing test to show
various aspects of the changed behavior.
2011-12-15 13:57:54 +01:00
Na'Tosha Bard
112b1abe18 largefiles: optimize status when files are specified (issue3144)
This fixes a performance issue with 'hg status' when files are specified
on the command-line.  Previously, a large amount of largefiles code was
executed, even if files were specified on the command-line and those files
were not largefiles.  This patch fixes the problem by first checking if
non-largefiles were specified on the command-line and, just letting the
normal status function handle the case if they were.

On a brand new machine, the execution time for 'hg status filename' on
a repository with largefiles was:

real    0m0.636s
user    0m0.512s
sys     0m0.120s

versus the following (the same repository, with largefiles disabled):

real    0m0.215s
user    0m0.180s
sys     0m0.032s

After this patch, the performance of 'hg status filename' on the same
repository, with largefiles enabled is:

real    0m0.228s
user    0m0.189s
sys     0m0.036s

This performance boost is also true when patterns (rather than specific
files) are specified on the command-line.

In the case where patterns are specified in addition to a file list, we
just defer to the normal codepath in order to not spend extra time
expanding the patterns to just risk having to expand them again later.
2011-12-15 16:23:26 +01:00
Martin Geisler
19be7012dc largefiles: handle merges between normal files and largefiles (issue3084)
The largefiles extension prevents users from adding a normal file
named 'foo' if there is already a largefile with the same name.
However, there was a loop-hole: when merging, it was possible to bring
in a normal file named 'foo' while also having a '.hglf/foo' file.

This patch fixes this by extending the manifest merge to deal with
these kinds of conflicts. If there is a normal file 'foo' in the
working copy, and the other parent brings in a '.hglf/foo' file, then
the user will be prompted to keep the normal file or the largefile.
Likewise for the symmetric case where a normal file is brought in via
the second parent. The prompt looks like this:

  $ hg merge
  foo has been turned into a largefile
  use (l)argefile or keep as (n)ormal file?

After the merge, either the '.hglf/foo' file or the 'foo' file will
have been deleted. This would cause status to return output like:

  $ hg status
  M foo
  R foo

To fix this, the lfiles_repo.status method is changed so that a
removed normal file isn't shown if there is largefile with the same
name, and vice versa for largefiles.
2011-12-09 17:35:00 +01:00
David Soria Parra
900ed6b9a8 progress: check for ui.quiet and ui.debugflag before we write
ui.quiet and ui.debugflag are not initialized during uisetup and
reposetup.  progressui is always initialized, therefore we have to check
during write() if ui.quiet is set or not.
2011-12-14 15:41:08 +01:00
Martin Geisler
3a9a310829 largefiles: fix 'hg status' abort after merge
If a largefile is introduced on the branch that is merged into the
working copy, then 'hg status' would abort with an error like:

   $ hg status
   abort: .hglf/foo@33fdd332ec: not found in manifest!

The problem was that the largefiles status code only looked in the
first parent for the largefile. Largefiles are now always reported as
modified if they don't exist in the first parent -- this matches the
behavior of localrepo.status for normal files.
2011-12-09 17:34:58 +01:00
Patrick Mezard
3a0effcd7b util: fix url.__str__() for windows file URLs
Before:

  >>> str(url('file:///c:/tmp/foo/bar'))
  'file:c%3C/tmp/foo/bar'

After:

  >>> str(url('file:///c:/tmp/foo/bar'))
  'file:///c%3C/tmp/foo/bar'

The previous behaviour had no effect on mercurial itself (clone command for
instance) because we fortunately called .localpath() on the parsed URL.
hgsubversion was not so lucky and cloning a local subversion repository on
Windows no longer worked on the default branch (it works on stable because
2b62605189dc defeats the hasdriveletter() test in url class).

I do not know if the %3C is correct or not but svn accepts file:// URLs
containing it. Mads fixed it in 2b62605189dc, so we can always backport should
the need arise.
2011-12-04 18:22:25 +01:00
Wagner Bruna
307a2fdf03 convert: tolerate trailing spaces on map files
A convert run with a branchmap made with

echo default namedbranch > branchmap

on Windows fails silently and surprisingly; it actually
adds a space after 'namedbranch', so it ends up mapping
"default namedbranch" to "".

This also affects splicemaps, since the same parser is used
for both.
2011-12-02 21:38:57 -02:00
Patrick Mezard
1d6a6d6bd8 convert/svn: fix URL quoting issue with svn 1.7
As of svn 1.7, many svn calls expect "canonical" paths. In theory, we should
call svn.core.*canonicalize() on all paths before passing them to the API.
Instead, we assume the base url is canonical and copy the behaviour of svn URL
encoding function so we can extend it safely with new components.
2011-12-01 20:42:24 +01:00
Na'Tosha Bard
60040a8402 largefiles: fix rename (issue3093) 2011-11-30 15:11:00 +01:00
Matt Mackall
6e77a4d58a merge with i18n 2011-11-30 17:16:43 -06:00
Mads Kiilerich
2af29b7753 largefiles: avoid use of uinitialized variable in case of errors 2011-11-25 02:09:48 +01:00
Martin Geisler
161f84c84c largefiles: copy files into .hg/largefiles atomically
Copying from the user cache into .hg/largefiles could fail halfway
though with a partially written file.
2011-11-24 18:13:18 +01:00
Martin Geisler
de1d410b06 largefiles: write .hg/largefiles/ files atomically
Before, it was possible to create a

  .hg/largefiles/hash

file with truncated content, i.e., content where

  SHA-1(content) != hash

This breaks the fundamental invariant in largefiles that the file
content for files in .hg/largefiles hash to the filename.
2011-11-24 18:12:13 +01:00
Martin Geisler
ebb23d0eaa largefiles: add comment about non-atomic working directory
When updating the working copy with a normal 'hg update', we also
don't use atomic writes.
2011-11-24 18:11:43 +01:00
FUJIWARA Katsunori
d9039e2664 largefiles: use "ui.configlist()" to get largefiles.patterns configuration
current lfconvert implementation uses combination of "ui.config()" and
"str.split(' ')" to get largefiles.patterns configuration.

but it can not handle multiline configuration in hgrc files correctly.

lfconvert should use "ui.configlist()" instead of it, as same as
override_add does.
2011-11-24 17:54:50 +09:00
Matt Mackall
8fc7c196b4 convert: handle trailing slashes in filemap better (issue3124) 2011-11-23 16:25:44 -06:00
Mads Kiilerich
eb44c968ee largefiles: file storage should be relative to repo, not relative to cwd
Revealed by the test in 43cf449a75e4.
2011-11-22 19:52:23 +01:00
Martin Geisler
28455d6a6b largefiles: fix 'hg clone . ../foo' OSError abort
Operating on a non-existant file can cause both IOError and OSError,
depending on the function used: open raises IOError, os.lstat raises
OSError.

The largefiles code called dirstate.normal, which in turn calls
os.lstat, so OSError is the right exception to catch here.
2011-11-22 17:51:43 +01:00
FUJIWARA Katsunori
970e57770c largefiles: treat status of cache missed largefiles as "missing" correctly
"hg status" may treat cache missed largefiles as "removed" incorrectly.

assumptions for problem case:

  - there is no cache for largefile "L"
  - at first, update working directory to the revision in which "L" is
    not yet added,
  - then, update working directory to the revision in which "L" is
    already added

and now, "hg status" treats "L" as "removed".

current implementation does not allocate entry for cache missed
largefile in ".hg/largefiles/dirstate", but files without
".hg/largefiles/dirstate" entry are treated as "removed" by largefiles
extension.

"hg revert" can not recover from this situation, but "rm -rf
.hg/largefiles", because it causes dirstate rebuilding.

this patch invokes normallookup() for cache missed largefiles to
allocate entry in ".hg/largefiles/dirstate", so "hg status" can treat
it as "missing" correctly.
2011-11-11 02:33:01 +09:00
Stefano Tortarolo
b157d6deb9 rebase: ensure target is not taken as external (issue3085)
This could happen in specific situations in which 'target'
was selected as external and used for p1 _and_ p2.
2011-11-08 17:09:48 +01:00
Stefano Tortarolo
822926675c rebase: treat nullmerge as a special case in rebasestate (issue3046)
When storing/restoring a nullmerge (-2), a 'standard' conversion was made
and an existing changeset was wrongly used.
Nullmerge should instead be treated as a special case.
2011-11-06 23:35:33 +01:00
Patrick Mezard
26d7e04e93 convert/bzr: correctly handle divergent nested renames (issue3089)
With renames like:

  a   -> b
  a/c -> a/c

We were ignoring or duplicating the second one instead of leaving files
unchanged or moving them to their proper destination only.

To avoid this, we process the files in reverse lexicographic order, from most
to least specific change, and ignore files already processed.

v2:
- Add a test
- Change "reverse=1" into "reverse=True"
2011-11-08 17:08:58 +01:00
Hao Lian
e92210d64e largefiles: ensure destination directory exists before findfile links to there
When (1) findfile links a largefile from the user cache to the store
and (2) the store directory doesn't exist yet, findfile errors out. A
simple call to util.makedirs fixes it.
2011-11-03 10:59:32 -04:00
Matt Mackall
9580de9b45 util: add a doctest for empty sha() calls 2011-10-31 15:41:39 -05:00
Martin Geisler
f89c093d08 merge with stable 2011-12-09 17:58:12 +01:00
Martin Geisler
1fbdd9520a largefiles: use lfutil functions
Using regular expressions to cut off a (fixed) string prefix is overly
complicated and wasteful.
2011-12-09 17:34:57 +01:00
Martin Geisler
313aade451 largefiles: fix indentation 2011-12-09 17:34:56 +01:00
Martin Geisler
9b8776da45 largefiles: remove pre-1.7 compatibility code
Mercurial 1.7 added the --subrepos flag to status and archive and the
largefiles code was still compatible with the old method signatures.
2011-12-07 16:25:51 +01:00
Na'Tosha Bard
15aa924ecd largefiles: optimize performance of status on largefiles repos (issue3136) 2011-12-07 12:56:44 +01:00
Matt Mackall
e82c2e671f merge with stable 2011-12-05 17:48:40 -06:00
Patrick Mezard
08f16028b0 convert: simplify getargmax() with propertycache 2011-12-02 18:36:32 +01:00
Patrick Mezard
17dd79d671 convert/svn: update svn working copy only when necessary
I have not tried to produce the bug but here is idea: b2b0622d9e96 stopped
passing the modified files list to commit. This makes commit more fragile since
we better not touch unrelated files by mistake. But putcommit() still applies
file changes before exiting upon ignored revisions. So in theory, we could
apply changes from a skipped branch then commit them as part of another
revision.

This patch makes the sink apply the changes after possibly skipping the
revision. The real fix would be to use svn commit --targets option to pass the
file names in an argument file. Unfortunately, it seems to be bugged in svn
1.7.1:

  http://svn.haxx.se/dev/archive-2011-11/0211.shtml
2011-12-02 17:38:07 +01:00
Matt Mackall
9e27ec8fc4 merge with stable 2011-12-01 15:57:10 -06:00
Matt Mackall
3d60dfdd1c merge with stable 2011-11-30 17:15:39 -06:00
Mads Kiilerich
ae8c3f9869 merge with stable 2011-11-25 02:11:12 +01:00
Martin Geisler
b8431ebcdb largefiles: simplify lfutil.writehash
This was unnecessarily verbose: there is no need to unlink the file
when we open it for write anyway, and there is no need to check if the
file exists after we created it.
2011-11-24 18:22:45 +01:00
Martin Geisler
af430ebf31 merge with stable 2011-11-24 18:22:44 +01:00
Matt Mackall
bd2719486e merge with stable 2011-11-23 16:35:17 -06:00
Mads Kiilerich
ae4bd7a809 notify: add option for writing to mbox
This makes it possible to test how the mails that are sent _really_ look like.
2011-11-23 02:36:33 +01:00
Mads Kiilerich
c30004d07d mail: mbox handling as a part of mail handling, refactored from patchbomb 2011-11-23 02:11:24 +01:00
Mads Kiilerich
6127ae9b6d patchbomb: minor refactoring of mbox functionality, preparing for move
This allows reuse of the mbox functionality but causes minor changes in the
patchbomb console output when writing to a mbox.
2011-11-23 02:09:38 +01:00
Matt Mackall
5bbf1ec751 merge with stable 2011-11-22 17:34:22 -06:00
Martin Geisler
7ea03decd6 merge with stable 2011-11-22 18:16:59 +01:00
Hao Lian
1705e29378 largefiles: replace tempfile.NamedTemporaryFile with tempfile.mkstemp
This is consistent with the rest of Mercurial's code, mirroring the
try-finally-unlink structure elsewhere. Furthermore, it fixes the case where
largefiles throws an IOError on Windows when the temporary file is opened a
second time by copytocacheabsolute.

This patch creates the temporary file in the repo's largefiles store rather than
/tmp, which might be a different filesystem.
2011-10-20 17:24:59 -04:00
Matt Mackall
2988d59e97 keyword: backout realpath change (issue3071) 2011-10-30 12:10:11 -05:00