Commit Graph

104 Commits

Author SHA1 Message Date
Mads Kiilerich
056fcbf2bc merge with stable 2012-12-28 11:55:45 +01:00
Mads Kiilerich
96d2cbf93b largefiles revert: update lfdirstate with result from first cleanliness check
Largefiles revert do for some reason have two lfdirstates and lfdirstatestatus
invocations in one function. The result from the first lfdirstate check was
however not written back to the lfdirstate, and some files was thus checked
twice.
2012-12-13 19:19:06 +01:00
Mads Kiilerich
53f5b626ae largefiles: align rm warnings with warnings used in core 2012-12-13 19:19:06 +01:00
FUJIWARA Katsunori
5434449902 i18n: change output of largefiles for summary to distinguish from one for outgoing
Before this patch, largefiles extension uses "largefiles: No remote
repo" message not only for "outgoing" as status report, but also for
"summary" as summarized information.

This sharing prevents message translators from inserting white spaces
between "largefiles:" and "No remote repo" in translated message to
align column position of summarized information.

This patch changes output of largefiles for summary to distinguish
from one for outgoing.

This patch puts "no remote repo" into parentheses, because this is not
summarized information.
2012-10-31 03:59:28 +09:00
FUJIWARA Katsunori
f05ff4243c i18n: add "i18n" comment to column positioning messages of "hg summary"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:28 +09:00
Matt Harbison
eb56660b19 largefiles: don't copy largefiles from working dir to the store while converting
Previously, if one or more largefiles for a repo being converted were not in the
usercache, the convert would abort with a reference to the largefile being
missing (as opposed to the previous patch, where the standin was referenced as
missing).  This is because commitctx() tries to copy all largefiles to the
local store, first from the user cache, and if the file isn't found there, from
the working directory.  No files will exist in the working directory during a
convert, however.  It is not sufficient to force the source repo to be local
before proceeding, because clone and pull do not download largefiles by default.

This is slightly less than ideal because while the conversion will now complete,
it won't be possible to update to revs with missing largefiles unless the user
intervenes manually, because there is no default path pointing back to the
source repo.  Ideally these files would be cached during the conversion.

This check could have been done in reposetup.commitctx() instead, but this
ensures the local store directory is created, which is necessary to enable the
standin matcher.

The rm -> 'rm -f' change in the test is to temporarily suppress an error
clearing the cache- as noted, the cache is is not repopulated during convert.
When that is fixed, this can be changed back and the verification errors will
disappear too.
2012-10-23 21:32:19 -04:00
Pierre-Yves David
afde19de6d largefile: status is buggy on repoproxy, so run unfiltered
For some yet-unkown reason, largefile status does not work on
repoproxy. As status is not affected by filtering, we run it unfiltered.

Na'Tosha Bard's view on this issue:

    "but, well, largefiles status is kind of an unholy piece of code"
2012-10-08 18:11:56 +02:00
Matt Harbison
ff98bafc79 largefiles: use 'default' instead of 'default-push' when pulling (issue3584)
This only applies to downloading largefiles, and only when no source for the
pull is explicitly provided.  The repository itself was properly being pulled
via 'default' previously.

Using --all-largefiles is not necessary on a bare pull to test this (this
existing test is merely a convenience), but it is required to test pulling on
the rebase path.

Note that the errors generated in the --rebase case are because the repo
specified doesn't have the largefiles in its cache (though they are in the user
cache), so the errors are misleading.  Specifying --all-largefiles when cloning
to 'b' fixes this, but instead of errors, it reports caching only 5 largefiles
instead of the 9 that come up missing.  Likely this is because the largefile
download procedure tries to download missing files for each rev, and some of the
files have standins in more than one rev that gets pulled.
2012-10-20 21:43:46 -04:00
FUJIWARA Katsunori
d06e5a0fa2 largefiles: distinguish "no remote repo" from "no files to upload" (issue3651)
Before this patch, when no files to upload, "hg outgoing --large" and
"hg summary --large" show "no remote repo", even though valid remote
repository is specified.

It is because that "getoutgoinglfiles()" returns None, not only if no
valid remote repository is specified, but also if no files to upload.

This patch makes "getoutgoinglfiles()" return empty list when no files
to upload, and makes largefiles show "no files to upload" message at
that time.

This patch doesn't test "if toupload is None" route in
"overrideoutgoing()", because this route is not executed unless remote
repository becomes inaccessible just before largefiles specific
processing: successful execution of "orig()" means that at least one
of "default", "default-push" or dest is valid one, and that
"getoutgoinglfiles()" never returns None in such cases.

At "hg summary --large" invocation, this patch shows message below:

    largefiles: (no files to upload)

This follows the message shown by "hg summary" with MQ:

    mq:     (empty queue)
2012-10-08 23:49:36 +09:00
Matt Harbison
7640adfa45 largefiles: always create the cache and standin directories when cloning
The standin matcher only works if the .hglf directory exists (and it won't exist
if 'clone -U' is used, unless --all-largefiles is also specified).  Since not
even 'update -r null' will get rid of the standin directory, this ensures that
the standin directory always exists if the repo has the 'largefiles'
requirement.  This requirement is only set after a largefile is committed, so
these directories will not be created for repos that have the extension enabled
but have not committed a largefile.

With the standin directory in place, 'lfconvert --to-normal' will now be able to
download the required largefiles when converting a repo that was created with
'clone -U', and whose files are not in the usercache.

The downloadlfiles command could probably be put inside the 'largefiles'
requirement conditional too, but given that the user specified --all-largefiles,
there is likely an expectation to print out the number of largefiles downloaded,
even if it is 0.
2012-10-14 15:10:13 -04:00
Bryan O'Sullivan
3048607d30 Merge with crew-stable 2012-10-02 14:31:25 -07:00
Matt Harbison
ca1372542e largefiles: download missing subrepo revs when archiving
This is something plain hgsubrepos already do.  Previously, an abort message
complained about an unknown revision.
2012-09-23 00:08:13 -04:00
Matt Mackall
8c86a57e7c merge with stable 2012-09-27 15:51:14 -05:00
Matt Mackall
77a75fbd07 merge with stable 2012-09-18 16:19:56 -05:00
Matt Mackall
b0dd832e65 merge with stable 2012-09-17 15:13:17 -05:00
Matt Harbison
fa8ea6e5a3 largefiles: delegate to the wrapped clone command
This allows the wrapped command's validation code to run (which is currently
only to ensure 'noupdate' and 'updaterev' aren't both specified), the
copy/pasted unpacking of hg.clone() args to be removed, and any future changes
to the base command (however unlikely) to be inherited by largefiles.

Unfortunately, the command override can't be swapped entirely for an hg.clone()
override because the extra --all-largefiles arg needs to be injected.  It also
isn't enough to call the wrapped clone command and leave the caching code after
it, because the file caching code needs access to the destination repo, which is
only available from hg.clone().  An alternative would be to use the dest path in
the clone command override to re-obtain a reference to the repo.

A slight deviation from the regular hg.clone() function is that the repo is NOT
deleted if the caching fails, but that was also the previous behavior.  Maybe it
should for consistency?
2012-09-09 12:43:24 -04:00
Matt Harbison
b14b475d95 largefiles: don't convert dest=None to dest=hg.defaultdest() in clone command
A status message is output if hg.clone() determines the default destination
because None was provided.  The previous code never passed None to hg.clone().
2012-09-09 12:09:53 -04:00
Matt Harbison
93f873fbd2 largefiles: restore caching of largefiles with 'clone -U --all-largefiles'
This was broken when restoring normal -u and -U functionality.
2012-09-09 03:37:38 -04:00
Matt Harbison
3eb1617064 largefiles: restore normal 'clone -u' and 'clone -U' functionality
Previously, tip would be checked out regardless of the -u or -U parameter.  I'm
not sure what the 'required for successful walkchangerevs' comment meant, but it
appears to reference code which has since moved to downloadlfiles() in
5c06bddf85b8.  Perhaps it was to force caching when the -U parameter is given?
The price of this change is that -U --all-largefiles won't cache anything.  That
will be fixed next.

Note that X + Y in the 'X largefiles updated, n removed' and 'Y additional
largefiles cached' lines do not add up to the same values in these tests, but
all of the largefiles have been downloaded.  The reason being that several
largefiles have the same content (eb7338044 is pointed to by sub/large2, large3
and sub/large4).  In the 'clone -u 1' operation, this largefile is cached to
populate the working directory, even without --all-largefiles.  That means the
file isn't downloaded again and cached in the rev where large3 and sub/large4
both point to this file.  Downloading that one file in that one rev seems to be
counted twice with 'clone -u 0'.  (Maybe it is also being downloaded twice?)
2012-09-08 13:31:06 -04:00
Matt Harbison
d3a4f5a08b largefiles: preserve the exit status of the forget command
This maintains the exit codes documented in commands.py.
2012-09-05 22:42:23 -04:00
Matt Harbison
0931dc58e6 largefiles: preserve the exit status of the rebase command 2012-09-05 22:31:03 -04:00
Matt Harbison
ac0da61364 largefiles: preserve the exit status of the log command 2012-09-05 22:12:40 -04:00
Matt Harbison
4cda36b611 largefiles: exit from remove with 1 on warnings
This maintains the exit codes documented in commands.py.
2012-09-09 20:18:08 -04:00
Matt Harbison
096f56ab20 largefiles: preserve exit code from outgoing command (issue3611)
This maintains the exit codes documented in commands.py.
2012-09-05 21:26:08 -04:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Matt Harbison
2aaabbf1cc largefiles: handle commit -A properly, after a --large commit (issue3542)
Previous to this, 'commit -A' would add as normal files, files that were already
committed as largefiles, resulting in files being listed twice by 'status -A'.
It also missed when (only) a largefile was deleted, even though status reported
it as '!'.  This also has the side effect of properly reporting the state of the
affected largefiles in the post commit hook after a remove that also affected a
normal file (the largefiles used to be 'R', now are properly absent).

Since scmutil.addremove() is called both by the ui command (after some trivial
argument validation) and during the commit process when -A is specified, it
seems like a more appropriate method to wrap than the addremove command.

Currently, a repo is only enabled to use largefiles after an add that explicitly
identifies some file as large, and a subsequent commit.  Therefore, this patch
only changes behavior after such a largefile enabling commit.

Note that in the test, if the final commit had a '-v', 'removing large8' would
be printed twice.  Both of these originate in removelargefiles().  The first
print is in verbose mode after traversing remove + forget, the second is because
the '_isaddremove' attr is set and 'after' is not.
2012-07-30 20:56:41 -04:00
Mads Kiilerich
688b9e2048 check-code: indent 4 spaces in py files 2012-07-31 03:30:42 +02:00
Simon Heimberg
74b66f52f4 largefiles: use hg.peer instead of hg.remoteui 2012-07-28 22:55:01 +02:00
Matt Harbison
2331fa9fcd largefiles: support revsets for outgoing --large
Previous to this, outgoing with a revset succeeded unless --large was also
specified.
2012-07-20 19:08:26 -04:00
Matt Harbison
944ad7f58e largefiles: support revsets for cat
Previous to this, cat only accepted revsets if the largefiles extension was
disabled.
2012-07-20 19:14:41 -04:00
Matt Harbison
a7de7f0ce5 largefiles: support revsets for revert
Previous to this, revert only accepted revsets if the largefiles extension was
disabled.
2012-07-20 18:13:19 -04:00
Matt Mackall
387f7efad8 largefiles: fix exception hack for i18n (issue3197)
Properly fixing this is quite a bit trickier.
2012-07-27 12:33:48 -05:00
Matt Harbison
8e588880da largefiles: fix path handling for cp/mv (issue3516)
Previously, a copy or a move of a largefile only worked if the cwd was the root
of the repository.  The first issue was that the destination path passed to
os.mkdirs() chopped the absolute path to the standin after '.hglf/', which
essentially created a path relative to the repository root.  Similarly, the
second issue was that the source and dest paths for copyfile() were relative to
the repo root.  This converts these three paths to absolute paths.

Some notable issues, regardless of the directory in which the cp/mv is executed:

1) The copy is not being recorded in lfdirstate, but it is in dirstate for the
standins.  I'm not sure if this is by design (i.e. minimal info in lfdirstate).

2) status -C doesn't behave as expected.  Using the testcase as an example:

  # after mv + ci
  $ hg status -C -v --rev '.^'     # expected to see 'A' and ' ' lines too
  R dira\dirb\largefile

  $ hg status -C -v --rev '.^' foo/largefile
  # no output                      # expected to see 'A' and ' ' lines only

  $ hg status -C -v --rev '.^' foo/
  # no output                      # expected to see 'A', ' ' and 'R' lines

  $ hg status -C -v --rev '.^' ./  # expected to see 'A' and ' ' lines too
  R dirb\largefile

  $ hg status -C -v --rev '.^' ../.hglf/dira/foo/largefile
  A ..\.hglf\dira\foo\largefile
    ..\.hglf\dira\dirb\largefile  # no 'R' expected when new file is specified

  $ hg status -C -v --rev '.^' ../.hglf   # OK
  A ..\.hglf\dira\foo\largefile
    ..\.hglf\dira\dirb\largefile
  R ..\.hglf\dira\dirb\largefile
2012-07-22 23:37:53 -04:00
Matt Harbison
a3f198c97e largefiles: ensure addlargefiles() doesn't add a standin as a largefile
An easy way to force this (and cause a traceback) prior to the fix for 3507 was

  $ touch large
  $ hg add --large large
  $ hg ci -m "add"
  $ hg remove large
  $ touch large
  $ hg addremove --config largefiles.patterns=**large

This patch also detected (and corrected) a previous test where a standin got
added as a largefile (without a traceback).
2012-07-19 23:35:13 -04:00
Matt Harbison
b617460d47 largefiles: fix a traceback when addremove follows a remove (issue3507)
The problem only occurred if a file was removed with 'hg rm' (as opposed to the
OS utilities), and then addremove was run before a commit.  Both normal and
large files were affected.

Ensuring that the file exists prior to an lstat() for size seems like the Right
Thing.  But oddly enough, the missing file that was causing lstat() to blow up
was a standin when a largefile was removed, which seems fishy, because a standin
should never be added as a largefile.  I was then able to get a standin added as
a largefile (whose name is 'large') with

   hg addremove --config largefiles.patterns=**large

which also causes a backtrace.  That will be fixed next.
2012-07-19 11:12:05 -04:00
Matt Harbison
91452ea7b9 largefiles: fix addremove with -R option
If a file was missing, the missing list contained a path relative to the repo.
When building the matcher from that list, the file name ended up concatenated to
cwd, causing the command to abort with '<file> not under root'.  This rebuilds
the missing list with paths relative to cwd.
2012-07-19 06:30:59 -04:00
Sune Foldager
ffe56435bf peer: introduce peer methods to prepare for peer classes
This introduces a peer method into all repository classes, which currently
simply returns self. It also changes hg.repository so it now raises an
exception if the supplied paths does not resolve to a localrepo or descendant.

Finally, all call sites are changed to use the peer and local methods as
appropriate, where peer is used whenever the code is dealing with a remote
repository (even if it's on local disk).
2012-07-13 21:46:53 +02:00
Matt Harbison
63a46b018b subrepo: propagate matcher to subrepos when archiving
Add a match object to subrepo.archive(). This will allow the -X and -I
options to be honored inside subrepos when archiving. They formerly
only affect the top level repo.
2012-06-16 22:34:06 -04:00
Matt Harbison
218655984d largefiles: remove a standin check that could never be true 2012-06-18 22:45:21 -04:00
Matt Harbison
c16332f051 largefiles: fix the directory structure when archiving a subrepo in a subrepo
Previously, a repo consisting of main/sub/subsub archived sub and subsub as
siblings under main.
2012-06-18 23:02:51 -04:00
Matt Harbison
bf6dae387d largefiles: fix a traceback when archiving a subrepo in a subrepo
This regression was introduced in 310edb24b71f.
2012-06-17 21:57:48 -04:00
Na'Tosha Bard
b035ee4c71 largefiles: fix addremove when largefile is missing (issue3227) 2012-05-13 12:11:50 +02:00
Matt Mackall
082c081b22 largefiles: fix default clone destination regression 2012-05-16 11:40:33 -05:00
Levi Bard
c5f81ed918 largefiles: don't attempt to clone all largefiles to non-local destinations 2012-05-13 22:59:22 +02:00
Na'Tosha Bard
18869bf5f2 largefiles: add --all-largefiles flag to pull 2012-05-12 11:45:22 +02:00
Na'Tosha Bard
faa9f04319 largefiles: refactor downloading of all largefiles to generic function 2012-05-12 09:59:01 +02:00
Na'Tosha Bard
0f2fb0db6a largefiles: add --all-largefiles flag to clone (issue3188) 2012-05-11 23:11:43 +02:00
Matt Mackall
48471fd098 merge with stable 2012-05-12 00:06:11 +02:00
Na'Tosha Bard
7899056542 largefiles: fix deletion of multiple missing largefiles (issue3329) 2012-05-11 15:32:22 +02:00
Na'Tosha Bard
d4432c172d largefiles: follow normal codepath for addremove if non-largefiles repo (issue3249) 2012-05-11 14:42:26 +02:00