Commit Graph

3303 Commits

Author SHA1 Message Date
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
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
Matt Mackall
2f72e8b497 largefiles: avoid checking requirements on every command
When largefiles is enabled, commands on large repositories which don't
require largefiles could be slowed down substantially. Disable
checking this for every command.
2011-10-29 17:38:13 -05:00
Na'Tosha Bard
0e6729399b largefiles: fix bad bug where transplanting a changeset with a largefile will result in an old largefile being comitted later on 2011-10-28 18:48:24 +02:00
Matt Mackall
b066b57e3c backout 17bc9a6bb165 (issue3077) (issue3071)
Using util.realpath turns out to create complex issues on both Mac and
Windows. Back this change out for the release.
2011-10-29 11:02:23 -05:00
Martin Geisler
af63514154 largefiles: fix uppercase in abort message 2011-10-28 15:00:21 +02:00
Hao Lian
a546b17ca3 largefiles: remove lfutil.createdir, replace calls with util.makedirs 2011-10-25 11:45:28 -04:00
Eli Carter
fbbaf602df largefiles: bugfix for symlink handling with testcase
The code was using the size of a symlink's target, thus wrongly making symlinks
to large files into largefiles themselves.  This can be demonstrated by
deleting the symlink and then doing an 'hg up' or 'hg up -C' to restore the
symlink.
2011-10-26 13:48:33 -05:00
Thomas Arendsen Hein
a8bcd5c9b6 largfiles: drop unused import 2011-10-24 13:58:01 +02:00
Thomas Arendsen Hein
51c498ead0 consistency: use util.realpath instead of os.path.realpath where useful
exceptions:
  hg: os.path.realpath used before util can be imported
  tests/run-tests.py: may not import mercurial modules
2011-10-24 13:51:24 +02:00
Thomas Arendsen Hein
8d8608054c keyword: use util.realpath instead of os.path.realpath
This makes test-keyword.t pass on Python 2.4.1 (e.g. Debian sarge)
2011-10-24 13:54:59 +02:00
Martin Geisler
2ad46f5487 largefiles: improve markup in module help text 2011-10-24 10:08:58 +02:00
Martin Geisler
9fd08bafd7 largefiles: remove redundant documentation
The extension help text already covered what was in usage.txt and
design.txt is now moved to the wiki:

  http://mercurial.selenic.com/wiki/LargefilesExtension
2011-10-24 09:54:02 +02:00
Greg Ward
1ef2baf38c largefiles: use ui.configpath() where appropriate 2011-10-23 14:25:48 -04:00
Greg Ward
220535eb62 largefiles: drop more unnecessary compatibility checks 2011-10-23 10:23:31 -04:00
Thomas Arendsen Hein
13fb03d281 largefiles: use util.sha1() instead of hashlib.sha1() everywhere 2011-10-23 21:59:15 +02:00
Thomas Arendsen Hein
846f225a93 convert: add missing import of util, needed for svn < 1.6 2011-10-22 23:42:48 +02:00
Greg Ward
04bcf1ecd1 largefiles: rearrange how lfconvert detects non-local repos
Mainly this is so we can test that code; it has the side benefit of not
requiring network I/O to reject non-local repo URLs.
2011-10-22 14:20:17 -04:00
Greg Ward
8c2e55bcd4 largefiles: test lfconvert error handling; remove redundant code 2011-10-22 14:17:19 -04:00
Matt Mackall
be346e0be1 largefiles: py2.4 doesn't have BaseException
..and it's the wrong base class anyway.
2011-10-21 16:52:16 -05:00
Greg Ward
a3607c833a largefiles: rename lfconvert --tonormal option to --to-normal 2011-10-20 21:56:30 -04:00
Christian Ebert
81060c2149 keyword: correct grammar in iskwfile docstring 2011-10-21 12:07:27 +01:00
Benjamin Pollack
2e57592170 largefiles: remove all uses of os.path.relpath for 2.4 compatibility 2011-10-20 17:40:25 -04:00
Patrick Mezard
0a3c1ef904 mq: avoid data loss upon qfold + qmv (issue3058)
When renaming a patch A as B where B was previously qfolded into A and
therefore marked as removed, a versioned MQ would first restore B before
marking it as a copy of A, thus losing A changes. The undelete() call is
probably a left-over, wctx.copy() explicitely handles the case where the
destination is removed.

Also note that status command represents "hg rm b; hg mv a b" as:

  A b
    a
  R a

which explains the first hunk in test-mq-qrename.t.
2011-10-20 16:43:31 +02:00
Benjamin Pollack
8d2d1f2b4b largefiles: use XDG and OS X-specific cache locations by default (issue3067) 2011-10-20 17:05:13 -04:00
Benjamin Pollack
164bde4288 largefiles: remove redundant any_ function 2011-10-19 20:40:55 -04:00
Benjamin Pollack
ec794ad869 largefiles: make the store primary, and the user cache secondary
This uses the now-properly-named functions and methods from the previous
patch to actually deliver the desired behavior
2011-10-20 13:24:11 -04:00
Benjamin Pollack
417391117f largefiles: rename functions and methods to match desired behavior
The original intent was that the largefiles would primarily be in the
repository, with the global cache being only that--a cache.  The naming
conventions and actual intent have both strayed.  In this first patch, the
naming conventions are switched to match the actual intent, as are the
configuration options.
2011-10-20 13:24:09 -04:00
Benjamin Pollack
8e3ea85821 largefiles: fix documentation to match desired behavior 2011-10-20 13:24:08 -04:00
Eli Carter
5a07405554 largefiles: fix newline for lfconverted repos 2011-10-18 17:28:26 -05:00
Eli Carter
d76a96462f largefiles: remove 1.9 compat code 2011-10-19 15:37:03 -05:00
Greg Ward
6e7f580a2b largefiles: fix some badly named function parameters
overrides.py contains several functions that temporarily override
scmutil.match(), which always takes a changectx object as the first
parameter. But these overrides name that parameter either 'repo' or
'ctxorrepo', which is misleading. So rename them to 'ctx' and remove
the special type-sensitive handling of the one called 'ctxorrepo'.
2011-10-16 10:24:45 -04:00
Greg Ward
522fc48c21 largefiles: tidy imports
- no need to defensively import scmutil
- remove duplicate
- unwrap non-long line
2011-10-16 10:29:51 -04:00
Greg Ward
31a67df419 largefiles: rename config setting 'size' to 'minsize' 2011-10-18 20:06:23 -04:00
Eli Carter
2df068a441 largefiles: include 'largefiles' in converted repository requirements 2011-10-18 16:40:59 -05:00
Hao Lian
e500c9817f largefiles: string formatting typo in basestore._openstore where comma is used instead of modulo 2011-10-18 17:09:03 -04:00
Eli Carter
bad1c40c51 convert: fix typo 2011-10-18 10:32:12 -05:00
Eli Carter
728847b43f largefiles: fix typo 2011-10-18 09:59:04 -05:00
Wagner Bruna
2177ac62f8 largefiles: fix typo 2011-10-17 19:10:28 -02:00
Wagner Bruna
663e6b1cd3 largefiles: make parameter more i18n-friendly 2011-10-17 19:10:42 -02:00
Matt Mackall
8268e6a737 largefiles: remove fixme from docs 2011-10-17 14:14:28 -05:00
Wagner Bruna
71a9f13a45 rebase: fix typos 2011-10-17 14:47:36 -02:00
Thomas Arendsen Hein
a33744a24e largefiles: use separate try/except and try/finally as needed for python2.4
7e9e4773f809 introduced a try/except/finally block, which breaks compatibility
with python2.4
2011-10-16 11:28:03 +02:00
Matt Mackall
c8740f2b96 rebase: simplify check for orphaned descendants 2011-10-15 14:19:24 -05:00
Matt Mackall
ceb7deb445 rebase: simplify set generation 2011-10-15 14:19:07 -05:00
Pierre-Yves David
adb2912b0c rebase: add --rev option to rebase
This option allow a strict set of revision to be specified instead of using -s
or -b. Rebase will refuse start if striping  rebased changeset will strip non
rebased changeset. Rebase will refuse to work on set with multiple root.
2011-10-15 20:12:32 +02:00
Matt Mackall
ab3ca664ae rebase: allow revsets for source and base args 2011-10-15 12:57:47 -05:00
Pierre-Yves David
92a70ff8aa rebase: use revset as soon as possible in internal logic
The buildstate function now take a set of revs. Logic related to --source and
--base option have been moved in the main rebase function.

In the process this fixes a bug where the wrong source changeset might be pick.
This explain the changes in hgext/rebase.py
2011-10-15 19:07:51 +02:00
Idan Kamara
68b09c8a1d mq: eliminate explicit checks for file existence 2011-10-14 19:51:46 +02:00
Mads Kiilerich
ab16679cb8 mq: cleanup of lookup - handling of None is not relevant
Patch specifications in mq is passed around as a string or None. None is
generally used when no patch has been specified and there thus is nothing to
lookup and the calling code should do something else. One code path did however
pass None all the way to lookup. That case was handled in lookup, but there was
really need for that, it was undocumented, and it used to cause trouble back
when patches was specified as integers.
2011-10-14 02:50:06 +02:00
Pierre-Yves David
1415969654 phases: prevent mq to qimport immutable change. 2011-12-21 23:47:18 +01:00
Matt Mackall
228f9f6b08 merge with stable 2011-12-21 14:36:08 -06:00
Matt Mackall
7cf4e6eacb merge with stable 2011-12-16 19:05:59 -06:00
Matt Mackall
ee2f119c93 merge with stable 2011-12-15 16:50:21 -06: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
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
Matt Mackall
e0657b708d merge with stable 2011-11-10 15:55:26 -06:00
Matt Mackall
30c1fc3bf2 mq: add a warning about uncommitted changes for qfinish 2011-11-10 15:40:34 -06:00
Matt Mackall
8f2b7260c4 merge with stable 2011-11-10 11:00:27 -06:00
Matt Mackall
d0885370c9 check-code: enable camelcase check, fix up problems 2011-11-09 16:36:54 -06:00
Matt Mackall
c735985351 merge with stable 2011-11-03 12:58:30 -05:00
Matt Mackall
fe45fca7d5 localrepo: convert various repo.set() users to repo.revs() 2011-11-02 13:51:16 -05:00
Mads Kiilerich
9c69ab7b0b mq: fix corner cases for handling of patch 0 in qselect
Most of the code paths in mq would always pass patch specifications as a
string. Patches can be specified by their index, but one code path passed that
(through pop) to lookup as an integer - all other code paths used a string.

Unfortunately pop and lookup (like many other parts of mq) used the boolean
value of the patch specification to see if it was None, and they would thus
incorrectly handle patch 0 as None.

This patch makes the code comply with the actual internal duck typing of patch
specifications: patch indices must be encoded as strings. The (now) unused code
for partial and thus incorrect handling of indices as integers is removed.
2010-10-31 18:29:56 +01:00
Greg Ward
9201e11906 largefiles: cosmetics, whitespace, code style
This is mainly about keeping code under the 80-column limit with as
few backslashes as possible. I am deliberately not making any logic or
behaviour changes here and have restrained myself to a few "peephole"
refactorings.
2011-10-13 21:42:54 -04:00
Greg Ward
f01e46c64d largefiles: more work on cleaning up comments
- always say "largefile", not "lfile"
- cleanup mangled syntax, hopefully correctly
  (punctuation: it's your friend!)
- wrap to 75 columns (where feasible)
2011-10-13 20:45:49 -04:00
Greg Ward
8b7a685468 largefiles: improve error reporting
- tweak wording of some error messages
- use consistent capitalization
- always say 'largefile', not 'lfile'
- fix I18N problems
- only raise Abort for errors the user can do something about
2011-10-13 20:24:29 -04:00
Greg Ward
5f73b6d815 largefiles: improve comments, internal docstrings
- fix some ungrammatical/unclear/incorrect comments/docstrings
- rewrite some really unclear comments/docstrings
- make formatting/style more consistent with the rest of Mercurial
  (lowercase without period unless it's really multiple sentences)
- wrap to 75 columns
- always say "largefile(s)", not "lfile(s)" (or "big files")
- one space between sentences, not two
2011-10-12 20:59:27 -04:00
Na'Tosha Bard
6b1f4db174 largefiles: speed up commit by only rewriting standins for modified largefiles 2011-10-13 12:11:25 +02:00
Greg Ward
45dea8085f largefiles: improve help
Extension help taken from the URL formerly in the text
(https://developers.kilnhg.com/Repo/Kiln/largefiles/largefiles/File/usage.txt)
and improved.
2011-10-11 21:10:03 -04:00
Greg Ward
7c5da0f076 largefiles: use ui.configlist() to split largefiles.patterns 2011-10-11 21:11:01 -04:00
Greg Ward
86647ec1cf largefiles: allow minimum size to be a float
Some old-fashioned people (e.g. me) think that incompressible
binary files >100 kB count as "large".
2011-10-11 21:07:08 -04:00