Commit Graph

80 Commits

Author SHA1 Message Date
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
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
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
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
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
Hao Lian
a546b17ca3 largefiles: remove lfutil.createdir, replace calls with util.makedirs 2011-10-25 11:45:28 -04: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
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
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
Greg Ward
31a67df419 largefiles: rename config setting 'size' to 'minsize' 2011-10-18 20:06:23 -04: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
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
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
Greg Ward
184d4727fd largefiles: factor out lfutil.getminsize() 2011-10-11 21:11:01 -04:00
Na'Tosha Bard
842085d82b largefiles: cleanup import, now that we can assume > 1.9 for bundled extension 2011-10-11 14:01:24 +02:00
Na'Tosha Bard
a090606e6c largefiles: remove pre-1.9 code from extension first bundled with 1.9 2011-10-11 10:42:56 +02:00
Na'Tosha Bard
bc15926c15 largefiles: fix commit of specified file on non-windows 2011-10-06 11:10:06 +02:00
Greg Ward
067c6211ff largefiles: don't break existing tests (syntax error, bad imports) 2011-10-01 16:39:51 -04:00
Matt Mackall
54e711350f largefiles: eliminate naked exceptions 2011-09-29 17:14:47 -05:00
Matt Mackall
26db63c0a5 largefiles: fix over-long lines 2011-09-29 17:04:57 -05:00
Matt Mackall
4a1439d51a largefile: fix up hasattr usage 2011-09-29 16:48:48 -05:00
various
88e172f652 hgext: add largefiles extension
This code has a number of contributors and a complicated history prior to its
introduction that can be seen by visiting:

https://developers.kilnhg.com/Repo/Kiln/largefiles/largefiles
http://hg.gerg.ca/hg-bfiles

and looking at the included copyright notices and contributors list.
2011-09-24 17:35:45 +02:00