Commit Graph

218 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
ea6fcbf330 largefiles: confirm existence of outgoing largefile entities in remote store
Before this patch, "hg summary" and "hg outgoing" show and count up
all largefiles changed/added in outgoing revisions, even though some
of them are already uploaded into remote store.

This patch confirms existence of outgoing largefile entities in remote
store, to show and count up only really outgoing largefile entities at
"hg summary" and "hg outgoing".
2014-07-07 18:45:46 +09:00
FUJIWARA Katsunori
86a5211ac9 largefiles: show also how many data entities are outgoing at "hg outgoing"
Before this patch, "hg outgoing --large" shows which largefiles are
changed or added in outgoing revisions only in the point of the view
of filenames.

For example, according to the list of outgoing largefiles shown in "hg
outgoing" output, users should expect that the former below costs much
more to upload outgoing largefiles than the latter.

  - outgoing revisions add a hundred largefiles, but all of them refer
    the same data entity

    in this case, only one data entity is outgoing, even though "hg
    summary" says that a hundred largefiles are outgoing.

  - a hundred outgoing revisions change only one largefile with
    distinct data

    in this case, a hundred data entities are outgoing, even though
    "hg summary" says that only one largefile is outgoing.

But the latter costs much more than the former, in fact.

This patch shows also how many data entities are outgoing at "hg
outgoing" by counting number of unique hash values for outgoing
largefiles.

When "--debug" is specified, this patch also shows what entities (in
hash) are outgoing for each largefiles listed up, for debug purpose.

In "ui.debugflag" route, "addfunc()" can append given "lfhash" to the
list "toupload[fn]" always without duplication check, because
de-duplication is already done in "_getoutgoings()".
2014-07-07 18:45:46 +09:00
Pierre-Yves David
c84e682681 test: split test-largefile.t in multiple file
The `test-largefiles.t` unified test is significantly longer (about 30%) than
any other tests in the mercurial test suite. As a result, its is alway the last
test my test runner is waiting for at the end of a run.

In practice, this means that `test-largefile.t` is wasting half a minute of my
life every times I'm running the mercurial test suites. This probably mean more
a few cumulated day by now.

I've finally decided to split it up in multiple smaller tests to bring it back in
reasonable length.

This changeset extracts independent test cases in two files. One dedicated to
wire protocole testing, and another one dedicated to all other tests that could
be independently extracted.

No test case were haltered in the making of this changeset.

Various timing available below. All timing have been done on a with 90 jobs on a
64 cores machine. Similar result are shown on firefly (20 jobs on 12 core).

General timing of the whole run
--------------------------------

We see a 25% real time improvement for no significant cpu time impact.

Before split:

    real   2m1.149s
    user  58m4.662s
    sys   11m28.563s

After split:

    real   1m31.977s
    user  57m45.993s
    sys   11m33.634s


Last test to finish (using run-test.py --time)
----------------------------------------------

test-largefile.t is now finishing at the same time than other slow tests.

Before split:

    Time      Test
    119.280   test-largefiles.t
     93.995   test-mq.t
     89.897   test-subrepo.t
     86.920   test-glog.t
     85.508   test-rename-merge2.t
     83.594   test-revset.t
     79.824   test-keyword.t
     78.077   test-mq-header-date.t

After split:

    Time      Test
    90.414   test-mq.t
    88.594   test-largefiles.t
    85.363   test-subrepo.t
    81.059   test-glog.t
    78.927   test-rename-merge2.t
    78.021   test-revset.t
    77.777   test-command-template.t



Timing of largefile test themself
-----------------------------------

Running only tests prefixed with "test-largefiles".
No significant change in cumulated time.

Before:

    Time     Test
    58.673   test-largefiles.t
     2.931   test-largefiles-cache.t
     0.583   test-largefiles-small-disk.t

After:

    Time     Test
    31.754   test-largefiles.t
    17.460   test-largefiles-misc.t
     8.888   test-largefiles-wireproto.t
     2.864   test-largefiles-cache.t
     0.580   test-largefiles-small-disk.t
2014-05-16 13:18:57 -07:00
Mads Kiilerich
a3fadc528f largefiles: include largefiles when doing log on a directory (issue4241)
The matchers _files had to include both the real root and the standin version
of the root.
2014-05-08 19:45:22 +02:00
Mads Kiilerich
9a144bfa2e largefiles: better handling of log from other working directory (issue4236)
When invoked from another directory, the matchers m._cwd will be the absolute
path. The code for calculating relative path to .hglf did not consider that and
log would fail with weird errors and paths.

For now, just don't do any largefile magic when invoked from other directories.
2014-05-01 15:12:49 +02:00
Matt Harbison
66d98ca80b largefiles: remove directories emptied after their files are moved (issue3515) 2014-04-25 22:34:09 -04:00
Lucas Moscovicz
097fe28381 largefiles: changed overridelog to work with graphlog
Log for largefiles was failing for graph log since it was overriding match
instead of matchandpats.

[Mads Kiilerich modified this patch to address his review comments and ended up
rewriting/removing most of it.]
2014-03-05 15:55:09 -08:00
Lucas Moscovicz
b7ef7e0c3b largefiles: added test coverage for graph log
[Mads Kiilerich placed this patch before the patch that makes graphlog actually
work correctly for largefiles. As it is introduced here it just adds test
coverage and the actual bugfix patch will show the actual change.]
2014-03-06 14:52:07 -08:00
Mads Kiilerich
368894e240 largefiles: full debugdirstate functionality for largefiles
- just reusing the original command with a mockup repo.

This makes it possible to see dates in the lfdirstate and gives less code
duplication.
2013-04-27 23:19:52 +02:00
Mads Kiilerich
4d1cd6d065 largefiles: make cat on standins do something
cat of a standin would silently fail.

The use of standins is mostly an implementation detail, but it is already a bit
leaking. Being able to see the content of standins might be convenient for
debugging.
2013-04-27 23:19:52 +02:00
Mads Kiilerich
fc84595707 largefiles: update should only create a .orig backup of a largefile once
A .orig of a standin after the update do that a .orig of the actual largefile
is created. The .orig standin was however never removed again and the largefile
.orig was thus overwritten again and again.

The fix: remove the standin .orig when it is used.
2013-04-18 18:56:18 +02:00
FUJIWARA Katsunori
0c85153450 largefiles: use "outgoinghooks" to avoid redundant outgoing check
Before this patch, "hg outgoing" invokes "findcommonoutgoing()" not
only in "commands.outgoing()" but also in
"overrides.overrideoutgoing()" (via "getoutgoinglfiles()"), when
largefiles is enabled. The latter is redundant.

This patch uses "outgoinghooks" to avoid redundant outgoing check.

Newly introduced function "overrides.outgoinghook()" is registered
into "outgoinghooks" to get the result of outgoing check in
"commands.outgoing()".

It invokes "lfutil.getlfilestoupload()" directly with the result of
outgoing check to avoid redundant outgoing check in
"getoutgoinglfiles()": "sort()" is needed, because
"lfutil.getlfilestoupload()" doesn't sort the result of it.

This patch also omits "if toupload is None" ("No remote repo") case,
because failure of looking remote repository up should raise exception
in "commands.outgoing()" before invocation of "outgoinghooks".

Newly added "hg outgoing --large --graph" tests examine
"outgoinghooks" invocations in "hg outgoing --graph" code path.
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
22be41c2e5 largefiles: use "summaryremotehooks" to avoid redundant outgoing check
Before this patch, "hg summary --remote --large" invokes
"findcommonoutgoing()" not only in "commands.summary()" but also in
"overrides.overridesummary()" (via "getoutgoinglfiles()"). The latter
is redundant.

This patch uses "summaryremotehooks" to avoid redundant outgoing check.

Newly introduced function "overrides.summaryremotehook()" is
registered into "summaryremotehooks" to get the result of outgoing
check in "commands.summary()".

It invokes "lfutil.getlfilestoupload()" directly with the result of
outgoing check to avoid redundant outgoing check in
"getoutgoinglfiles()".
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
3da856bfcc largefiles: reuse "findcommonoutgoing()" result at "hg push"
Before this patch, "hg push" invokes "findcommonoutgoing()" not only
in "exchange.push()" but also in "lfilesrepo.push()", when largefiles
is enabled. The latter is redundant.

This patch registers own "prepushoutgoinghook" function into
"prepushoutgoinghooks" of "localrepository" to reuse
"findcommonoutgoing()" result.

"prepushoutgoinghook" omits "changelog.nodesbetween()" invocation,
because "findcommonoutgoing()" invocation in "exchange.push()" takes
"onlyheads" argument and it considers "nodesbetween()".
2014-04-16 00:37:24 +09:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Mads Kiilerich
a723522899 largefiles: don't prompt when one side of merge was changed but didn't change
This can happen after backout or grafts or criss cross merges. We already do
the same (but slightly different) thing in manifestmerge and filemerge.
2014-04-07 23:10:20 +02:00
Kevin Bullock
c63d1fcf68 merge with stable
This should correct an earlier couple of bad merges (5433856b2558 and
596960a4ad0d, now pruned) that accidentally brought in a change that had
been marked obsolete (244ac996a821).
2014-03-31 10:12:07 -05:00
FUJIWARA Katsunori
920a8f861c hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)
Since changeset a8955c4d9ef5, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions
2014-03-29 01:20:07 +09:00
Mads Kiilerich
914cc822c9 repo: rephrase the "missing requirement" error message
Unknown requirements will now be reported as:
  abort: repository requires features unknown to this Mercurial: largefiles!
  (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)

Some features of this phrasing:
* avoid double ':' in abort message
* make it more clear who requires and knows what
* don't quote the requirement names - it is not something the user entered or
  need the exact spelling of ... and it is "identifiers" that are unambiguous
  anyway
* remove double hint by removing "(upgrade Mercurial)" comment
* don't mention upgrading Mercurial without mentioning enabling the feature -
  instead, just refer to wiki page for both
* don't just talk about "details", talk about "more information"
2014-03-19 00:18:30 +01:00
Mads Kiilerich
19967e8476 largefiles: show hashes before prompting for conflict resolution
The largefile hashes are mostly an implementation detail, but they are "leaked"
in several places anyway, and showing the hashes is better than not giving the
user any information about the options in the prompt.

The hashes are long, but it is largefile hashes and it would thus be confusing
to shorten them.
2013-11-16 15:46:29 -05:00
Mads Kiilerich
d6cfe18be7 largefiles: don't try to explain rename history before prompt for conflicts
Before it tried to explain the exact situation when merging moved largefiles.
That do not happen for normal merges and is not more relevant for largefiles
than for normal files. It is unneeded complexity - remove it.
2013-11-16 15:46:29 -05:00
Mads Kiilerich
3b3d94dbd6 rebase: improve error message for --base being empty or causing emptiness
Before it just said 'nothing to rebase'.

Now 'if "base" is an empty set:
  abort: empty "base" revision set - can't compute rebase set

If the set of changesets to rebase can't be found from "base", it will fail as
before but with more explanation of what the problem was.

The name of the "base" option is not obvious - it is more like "samples
identifying the branch to rebase". The error messages for problems with the
specified "base" value will use that term and might thus also not be obvious,
but at least they are consistent with the option name. The name "base" will not
be used if the base only was specified implicitly as the working directory
parent.
2013-11-17 18:21:58 -05:00
Matt Mackall
4223982ebe merge with stable 2013-12-01 14:10:53 -06:00
Mads Kiilerich
f2255e8146 largefiles: don't crash on 'local renamed directory' actions
a8386b4c47b1 introduced splitstandin on all action filenames. It would however
crash on 'd' actions where the filename is None.

Fix that and add test coverage for that case.
2013-11-26 15:38:33 +01:00
Simon Heimberg
765aac2e8e tests: add missing glob 2013-11-17 15:43:46 +01:00
Mads Kiilerich
63e01aeb0a largefiles: hide passwords in URLs in ui messages 2013-10-17 16:13:15 +08:00
Mads Kiilerich
59f7203fee largefiles: don't add extra \n when displaying remote messages in putlfile 2013-10-24 01:49:56 +08:00
Mads Kiilerich
46512da6c4 largefiles: add missing \n in ui.warn messages 2013-10-21 11:22:54 +08:00
Siddharth Agarwal
663145e3f0 update: standardize error message for dirty update --check
This and following patches will standardize the error message for dirty working
directories to "uncommitted changes".
2013-09-23 20:33:02 -07:00
FUJIWARA Katsunori
0b216b06c5 largefiles: setup "largefiles" feature in each repositories individually
Before this patch, if largefiles extension is enabled once in any of
target repositories, commands handling multiple repositories at a time
like below misunderstand that "largefiles" feature is supported also
in all other local repositories:

  - clone/pull from or push to localhost
  - recursive execution in subrepo tree

This patch registers "featuresetup()" into "featuresetupfuncs" of
"localrepository" to support "largefiles" features only in
repositories enabling largefiles extension, instead of adding
"largefiles" feature to class variable "_basesupported" of
"localrepository".

This patch also adds checking below to the largefiles specific class
derived from "localrepository":

  - push to localhost: whether features supported in the local(= dst)
    repository satisfies ones required in the remote(= src)

This can prevent useless looking up in the remote repository, when
supported and required features are mismatched: "push()" of
"localrepository" also checks it, but it is executed after looking up
in the remote.
2013-09-21 21:33:29 +09:00
Wei, Elson
8a3265a449 largefiles: overridematch() should replace the file path instead of extending (issue3934) 2013-07-24 13:20:44 +08:00
Brendan Cully
5fda2ba23f tests: sprinkle globs over largefiles/subrepo tests for Windows 2013-05-02 11:26:43 -07:00
Mads Kiilerich
2f9545c92c largefiles: drop repo wrapping detection
After 08202d1ef738 I see:

  $ hg id -q
  largefiles: repo method 'commit' appears to have already been wrapped by another extension: largefiles may behave incorrectly
  largefiles: repo method 'push' appears to have already been wrapped by another extension: largefiles may behave incorrectly
  3bd0c95ec1bf

The warning is bad:

* The message gives no hint what the problem is and how it can be resolved.
  The message is useless.

* Largefiles do have its share of problems, but I don't think I ever have seen
  a problem where this warning would have helped. The 'may' in the warning
  seems like an exaggeration of the risk. Having largefiles enabled in
  combination with for instance mq, hggit and hgsubversion causes a warning
  (depending on the configuration order) but do not cause problems. Extensions
  might of course be incompatible, but they can be that in many other ways.
  The check and the message are incorrect.

It would thus be better to remove the check and the warning completely.

Before 08202d1ef738 the check always failed. That change made the check work
more like intended ... but the intention was wrong. This change will thus also
back that change out.
2013-04-26 19:04:01 +02:00
Mads Kiilerich
208aa05eca largefiles: stat all largefiles in one batch before downloading
This avoids a lot of expensive roundtrips to remote repositories ... but might
be slightly slower for local operations.

This will also change some aborts on missing files to warnings. That will in
some situations make it possible to continue working on a repository with
missing largefiles.
2013-04-15 23:37:43 +02:00
Mads Kiilerich
f03134c0a8 largefiles: implement pull --all-largefiles as a special case of --lfrev 2013-04-15 01:59:11 +02:00
Mads Kiilerich
fa7d021ee4 largefiles: drop --cache-largefiles again
This goes a step further than 974959d637b7 and backs out the unreleased
--cache-largefiles option. The same can be achieved with --lfrev heads(pulled()) and
we shouldn't introduce unnecessary command line options.
2013-04-15 01:59:11 +02:00
Mads Kiilerich
7e0e7a8927 largefiles: introduce pulled() revset expression for use in --lfrev
This provides a general way to do what already can be done with
--all-largefiles and --cache-largefiles.
2013-04-15 01:59:04 +02:00
Mads Kiilerich
a81c3f8371 largefiles: introduce pull --lfrev option
The revset will be evaluated after the changesets has been pulled, and missing
largefiles from matching revisions will be pulled to the local caches.

This in combination with revsets will make it possible to specify different
strategies for pulling largefiles.

The revset expressions used for this option might be quite complex and will
probably be most useful from scripts or an alias ... but less complicated than
configuring hooks.
2013-04-15 01:57:16 +02:00
Mads Kiilerich
8db31ff332 largefiles: introduce lfpull command for pulling missing largefiles 2013-04-15 01:53:37 +02:00
Mads Kiilerich
2e2ad4f35e largefiles: fix cat of non-largefiles from subdirectory
We were calling back to the original commands.cat from inside the walk loop
that handled and filtered out largefiles. That did however happen with file
paths relative to repo root and the original cat would fail when it applied its
own walk and match on top of that.

Instead we now duplicate and modify the code from commands.cat and patch it to
handle both normal and largefiles.

A change in test output shows that this also makes the exit code with
largefiles consistent with the normal one in the case where one of several
specified files are missing.

This also fixes the combination of --output and largefiles.
2013-04-15 01:43:31 +02:00
FUJIWARA Katsunori
b8042ee37a largefiles: improve repo wrapping detection
Before this patch, repo wrapping detection in "reposetup()" of
largefiles can detect only limited repo wrapping: replacing target
functions by another one named as "wrap".

So, it can't detect repo wrapping even in recommended style: replacing
"__class__" of repo by derived class.

This patch can detect repo wrapping in both styles below:

  - replacing "__class__" of repo by derived class (recommended style):

        class derived(repo.__class__):
            def push(self, *args, **kwargs):
                return super(derived, self).push(*args, **kwargs)
        repo.__class__ = derived

  - replacing function of repo by another one (not recommended style):

        orgpush = repo.push
        def push(*args, **kwargs):
            return orgpush(*args, **kwargs)
        repo.push = push
2013-04-10 02:27:35 +09:00
Simon Heimberg
6321f3dc40 tests: append missing glob to filename output and check-code it 2013-03-01 00:03:51 +01:00
Mads Kiilerich
00a100f5a5 merge with stable 2013-02-28 14:51:59 +01:00
Mads Kiilerich
335985feed largefiles: updatelfiles should use working dir standins, not standins from p1
This makes a difference when working directory is dirty, especially when
merging with a revision for which we don't have largefiles.
2013-02-28 13:45:18 +01:00
Mads Kiilerich
68d046f103 largefiles: missing largefiles should not be committed as removed
Largefiles can easily become missing - for example if it simply isn't available
or the download fail. It might even be convenient to be able to work that way
in some cases.

But commiting missing largefiles as if they had been 'hg remove'd is plain wrong.
2013-02-28 13:45:18 +01:00
Mads Kiilerich
d00a3f9b96 largefiles: fix download of largefiles from an empty list of changesets
The empty list was interpreted as all revisions - just like None is.

The empty list is now handled explicitly.
2013-02-28 13:44:24 +01:00
Mads Kiilerich
6e16465965 largefiles: fix off-by-one error on pull --all-largefiles
Test output is changed in a case where one revision was pulled, but because of
the off-by-one error it thought that 0 revisions were pulled ... and because of
another bug it thus (tried to) fetch largefiles for all revisions.

After this change it no longer reports failure when it failed while trying to
fetch largefiles it shouldn't fetch.  Largefiles that it shouldn't fetch but
managed to fetch anyway will now correctly be missing later on.

This change thus resolves some of unexplained test output introduced in
8664d9900884.
2013-02-28 13:44:22 +01:00
Na'Tosha Bard
f1bd9d017e largefiles: don't cache largefiles for pulled heads by default
After discussion, we've agreed that largefiles for newly pulled heads should
not be cached by default.  The use case for this is using largefiles repos
with multiple remote servers (and therefore multiple remote largefiles caches),
where users will be pulling from non-default locations on a regular basis.  We
think this use case will be significantly less common than the use case where
all largefiles are stored on the same central server, so the default should be
no caching.

The old behavior can be obtained by passing the --cache-largefiles flag to
pull.
2013-02-09 21:07:42 +00:00
Mads Kiilerich
b80d68316e largefiles: don't crash when trying to find default dest for url without path
79f69be29aed introduced a crash when cloning a url without path - where
util.url().path would be None.

This None will now be handled as ''. clone will thus abort with 'repository /
not found' as before.
2013-02-04 23:26:44 +01:00
Mads Kiilerich
4f2a779466 tests: fix for windows - slashes and no serve 2013-01-30 19:40:07 +01:00