Commit Graph

39 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
51754ba82b context: write dirstate out explicitly after marking files as clean
To detect change of a file without redundant comparison of file
content, dirstate recognizes a file as certainly clean, if:

  (1) it is already known as "normal",
  (2) dirstate entry for it has valid (= not "-1") timestamp, and
  (3) mode, size and timestamp of it on the filesystem are as same as
      ones expected in dirstate

This works as expected in many cases, but doesn't in the corner case
that changing a file keeps mode, size and timestamp of it on the
filesystem.

The timetable below shows steps in one of typical such situations:

  ---- ----------------------------------- ----------------
                                           timestamp of "f"
                                           ----------------
                                           dirstate   file-
  time          action                     mem  file  system
  ---- ----------------------------------- ---- ----- -----
  N                                              -1    ***
       - make file "f" clean                            N

       - execute 'hg foobar'
         - instantiate 'dirstate'           -1   -1
         - 'dirstate.normal("f")'           N    -1
           (e.g. via dirty check)
         - change "f", but keep size                    N
  N+1
         - release wlock
           - 'dirstate.write()'             N    N

       - 'hg status' shows "f" as "clean"   N    N      N
  ---- ----------------------------------- ---- ----- -----

The most important point is that 'dirstate.write()' is executed at N+1
or later. This causes writing dirstate timestamp N of "f" out
successfully. If it is executed at N, 'parsers.pack_dirstate()'
replaces timestamp N with "-1" before actual writing dirstate out.

Occasional test failure for unexpected file status is typical example
of this corner case. Batch execution with small working directory is
finished in no time, and rarely satisfies condition (2) above.

This issue can occur in cases below;

  - 'hg revert --rev REV' for revisions other than the parent
  - failure of 'merge.update()' before 'merge.recordupdates()'

The root cause of this issue is that files are changed without
flushing in-memory dirstate changes via 'repo.commit()' (even though
omitting 'dirstate.normallookup()' on changed files also causes this
issue).

To detect changes of files correctly, this patch writes in-memory
dirstate changes out explicitly after marking files as clean in
'workingctx._checklookup()', which is invoked via 'repo.status()'.

After this change, timetable is changed as below:

  ---- ----------------------------------- ----------------
                                           timestamp of "f"
                                           ----------------
                                           dirstate   file-
  time          action                     mem  file  system
  ---- ----------------------------------- ---- ----- -----
  N                                              -1    ***
       - make file "f" clean                            N

       - execute 'hg foobar'
         - instantiate 'dirstate'           -1   -1
         - 'dirstate.normal("f")'           N    -1
           (e.g. via dirty check)
       ----------------------------------- ---- ----- -----
         - 'dirsttate.write()'              -1   -1
       ----------------------------------- ---- ----- -----
         - change "f", but keep size                    N
  N+1
         - release wlock
           - 'dirstate.write()'             -1   -1

       - 'hg status'                        -1   -1      N
  ---- ----------------------------------- ---- ----- -----

To reproduce this issue in tests certainly, this patch emulates some
timing critical actions as below:

  - timestamp of "f" in '.hg/dirstate' is -1 at the beginning

    'hg debugrebuildstate' before command invocation ensures it.

  - make file "f" clean at N
  - change "f" at N

    'touch -t 200001010000' before and after command invocation
    changes mtime of "f" to "2000-01-01 00:00" (= N).

  - invoke 'dirstate.write()' via 'repo.status()' at N

    'fakedirstatewritetime.py' forces 'pack_dirstate()' to use
    "2000-01-01 00:00" as "now", only if 'pack_dirstate()' is invoked
    via 'workingctx._checklookup()'.

  - invoke 'dirstate.write()' via releasing wlock at N+1 (or "not at N")

    'pack_dirstate()' via releasing wlock uses actual timestamp at
    runtime as "now", and it should be different from the "2000-01-01
    00:00" of "f".

BTW, this patch also changes 'test-largefiles-misc.t', because adding
'dirstate.write()' makes recent dirstate changes visible to external
process.
2015-07-08 17:01:09 +09:00
Matt Mackall
b709208c37 tests: drop DAEMON_PIDS from killdaemons calls 2015-06-08 14:55:40 -05:00
Matt Mackall
3ad28905f6 tests: drop explicit $TESTDIR from executables
$TESTDIR is added to the path, so this is superfluous. Also,
inconsistent use of quotes means we might have broken on tests with
paths containing spaces.
2015-06-08 14:44:30 -05:00
Gilles Moris
c60f7ce967 summary: move the parents phase marker to commit line (issue4688)
The phase of the pending commit depends on the parent of the working directory
and on the phases.newcommit configuration.
First, this information rather depend on the commit line which describe the
pending commit.
Then, we only want to be advertised when the pending phase is going to be higher
than the default new commit phase.

So the format will change from

$ hg summary
parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge)
update: (current)
phases: 1 secret (secret)

to

parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge) (secret)
update: (current)
phases: 1 secret
2015-05-29 22:23:58 +02:00
Pierre-Yves David
281365197e progress: get the extremely verbose output out of default debug
When the progress extension is not enabled, each call to 'ui.progress' used to
issue a debug message. This results is a very verbose output and often redundant
in tests. Dropping it makes tests less volatile to factor they do not meant to
test.

We had to alter the sed trick in 'test-rename-merge2.t'. Sed is used to drop all
output from a certain point and hidding the progress output remove its anchor.
So we anchor on something else.
2015-05-09 23:40:40 -07:00
Gilles Moris
7771de9187 summary: add a phase line (draft, secret) to the output
The number of draft and secret changesets are currently not summarized.
This is an important information because the number of drafts give some rough
idea of the number of outgoing changesets in typical workflows, without needing
to probe a remote repository. And a non-zero number of secrets means that
those changeset will not be pushed.

If the repository is "dirty" - some draft or secret changesets exists - then
summary will display a line like:

phases: X draft, Y secret (public)

The phase in parenthesis corresponds to the highest phase of the parents of
the working directory, i.e. the current phase.

By default, the line is not printed if the repository is "clean" - all
changesets are public - but if verbose is activated, it will display:

phases: (public)

On the other hand, nothing will be printed if quiet is in action.

A few tests have been added in test-phases.t to cover the -v and -q cases.
2015-05-14 17:38:38 +02:00
FUJIWARA Katsunori
e9656a280f rebase: use dirstateguard instead of dirstate.invalidate
Before this patch, "rebase.concludenode()" uses "dirstate.invalidate()"
as a kind of "restore .hg/dirstate to the original status" during a failure.

But it just discards changes in memory, and doesn't actually restore
".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
is executed while processing.

This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
restore ".hg/dirstate" during a failure even if "dirstate.write()" is
executed before a failure.

This patch also removes "beginparentchage()" and "endparentchange()",
because "dirstateguard" makes them useless.

This is a part of preparations to fix the issue that the recent (in
memory) dirstate isn't visible to external processes (e.g. "precommit"
hook).

After this patch, the changed dirstate becomes visible to external
"precommit" hooks during "hg rebase" in "test-largefiles-misc.t",
because "dirstateguard()" writes it out. But this content isn't yet
correct, because:

  - "normal3" should be marked as "A"(dded) at committing

    It is newly added in the changeset being rebased.

  - but it is marked as "M"(odified)

    The result of "repo.setparents()" after "dirstateguard()" isn't
    yet written out before "precommit". So, merging is still in
    progress for "hg status" in it.

    This causes marking the file newly added on "other" branch as "A".

This will be fixed by subsequent patch.
2015-05-07 12:07:11 +09:00
Matt Harbison
4ce249627a largefiles: don't mangle filesets when fixing up the log matcher
The fileset-generated.t test previously failed with this:

  +  hg: parse error: unknown identifier: .hglf/modified
  +  (did you mean 'modified'?)
  +  [255]

Filesets will find the standins on their own, without any help.  While that's
useful for some things like modified(), clean(), etc., it is wrong for things
like size().  Proper fileset support for largefiles is not trivial, but this was
failing with just the extension enabled on a normal repo.
2015-04-18 13:08:41 -04:00
Mads Kiilerich
45a6e1e82f largefiles: for update -C, only update largefiles when necessary
Before, a --clean update with largefiles would use the "optimization" that it
didn't read hashes from standin files before and after the update. Instead of
trusting the content of the standin files, it would rehash all the actual
largefiles that lfdirstate reported clean and update the standins that didn't
have the expected content. It could thus in some "impossible" situations
automatically recover from some "largefile got out sync with its standin"
issues (even there apparently still were weird corner cases where it could
fail). This extra checking is similar to what core --clean intentionally do
not do, and it made update --clean unbearable slow.

Usually in core Mercurial, --clean will rely on the dirstate to find the files
it should update. (It is thus intentionally possible (when trying to trick the
system or if there should be bugs) to end up in situations where --clean not
will restore the working directory content correctly.) Checking every file when
we "know" it is ok is however not an option - that would be too slow.

Instead, trust the content of the standin files. Use the same logic for --clean
as for linear updates and trust the dirstate and that our "logic" will keep
them in sync. It is much cheaper to just rehash the largefiles reported dirty
by a status walk and read all standins than to hash largefiles.

Most of the changes are just a change of indentation now when the different
kinds of updates no longer are handled that differently. Standins for added
files are however only written when doing a normal update, while deleted and
removed files only will be updated for --clean updates.
2015-04-15 15:22:16 -04:00
Yuya Nishihara
1209d3b6f0 largefiles: use common function to build content of .hg_archival.txt
This fixes the missing "changessincelatesttag" field introduced by
7203a55cb648.
2015-04-08 22:42:37 +09:00
Yuya Nishihara
58c060fcfc test-largefiles: verify content of .hg_archival.txt 2015-04-08 22:38:46 +09:00
FUJIWARA Katsunori
d9071e6959 subrepo: add dirtyreason to centralize composing dirty reason message
This patch newly adds "dirtyreason()" to centralize composing dirty
reason message like "uncommitted changes in subrepository 'xxxx'".

There are 3 similar messages below, and this patch is a part of
preparations for unifying them into (1), too.

  1. uncommitted changes in subrepository 'XXXX'
  2. uncommitted changes in subrepository XXXX
  3. uncommitted changes in subrepo XXXX

This patch chooses adding new method "dirtyreason()" instead of making
"dirty()" return "reason string", because:

  - some of existing "dirty()" implementation is too complicated to do
    so simply, and

  - ill-mannered 3rd party subrepo classes, of which "dirty()" doesn't
    return "reason string", cause meaningless message (even though it
    is rare case)
2015-03-25 13:55:32 +09:00
Matt Harbison
fd12e02a30 largefiles: handle logging from outside the repo
It's probably possible to refactor so that the 'if m._cwd' check isn't
necessary, but the False case is the typical case (i.e. run from the root of the
repo), and simpler to read.

An exact path to a largefile from outside the repo was previously ignored.

match.rel('.hglf') will handle figuring out both the correct '../' length to the
standin directory if inside the repo, or path/to/repo from outside, at the cost
of a pconvert() to keep the patterns using '/' on Windows.
2015-03-01 18:35:29 -05:00
Matt Harbison
f9602d9506 largefiles: don't prefix standin patterns with '.hglf' when logging
When logging '.hglf/foo', the pattern list was being transformed from
['.hglf/foo'] into ['.hglf/foo', '.hglf/.hglf/foo'].  Aside from the
pathological case of somebody getting a directory named '.hglf' created inside
the standing directory, the old code shouldn't have had any bad effects.

(amended by mpm to sort patterns for test stability and not upset check-code)
2015-03-01 14:21:54 -05:00
Matt Harbison
7b3baed62d largefiles: teach log to handle patterns
Adding the standin to the patterns list was (possibly) harmless before, but was
wrong, because the pattern list was already updated above that code.  Now that
patterns are handled, it was actually harmful.  For example, in this test:

    $ hg log -G glob:**another*

the adjusted pattern list would have been:

    ['glob:**another*', '.hglf/.', 'glob:.hglf/**another*']

which causes every largefile in the root to be matched.


I'm not sure why 'glob:a*' picks up the rename of a -> b commit in test-log.t,
but a simple 'a' doesn't.  But it doesn't appear to be caused by the largefiles
extension.
2015-02-28 23:42:38 -05:00
Matt Mackall
b907416f7b merge with stable 2015-03-02 01:20:14 -06:00
FUJIWARA Katsunori
d70128b84b largefiles: access to specific fields only if largefiles enabled (issue4547)
Even if largefiles extension is enabled in a repository, "repo"
object, which isn't "largefiles.reposetup()"-ed, is passed to
overridden functions in the cases below unexpectedly, because
extensions are enabled for each repositories strictly.

  (1) clone without -U:
  (2) pull with -U:
  (3) pull with --rebase:

    combination of "enabled@src", "disabled@dst" and
    "not-required@src" cause this situation.

       largefiles     requirement
    @src     @dst     @src            result
    -------- -------- --------------- --------------------
    enabled  disabled not-required    aborted unexpectedly
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------
    enabled  enabled  *               success
    -------- -------- --------------- --------------------
    disabled enabled  *               success (only for "pull")
    -------- -------- --------------- --------------------
    disabled disabled not-required    success
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------

  (4) update/revert with a subrepo disabling largefiles

In these cases, overridden functions cause accessing to largefiles
specific fields of not "largefiles.reposetup()"-ed "repo" object, and
execution is aborted.

  - (1), (2), (4) cause accessing to "_lfstatuswriters" in
    "getstatuswriter()" invoked via "updatelfiles()"

  - (3) causes accessing to "_lfcommithooks" in "overriderebase()"

For safe accessing to these fields, this patch examines whether passed
"repo" object is "largefiles.reposetup()"-ed or not before accessing
to them.

This patch chooses examining existence of newly introduced
"_largefilesenabled" instead of "_lfcommithooks" and
"_lfstatuswriters" directly, because the former is better name for the
generic "largefiles is enabled in this repo" mark than the latter.

In the future, all other overridden functions should avoid largefiles
specific processing for efficiency, and "_largefilesenabled" is better
also for such purpose.

BTW, "lfstatus" can't be used for such purpose, because some code
paths set it forcibly regardless of existence of it in specified
"repo" object.
2015-02-26 06:03:39 +09:00
Matt Harbison
d3f2dde965 largefiles: don't warn when reverting a forgotten largefile
Previously, when a largefile is forgotten and then reverted, a warning was
issued:

   $ hg revert -R subrepo subrepo/large.txt
   file not managed: subrepo/large.txt (glob)

This was purely cosmetic as the file itself actually was reverted.

The problem was even with all of the matcher patching, the largefile pattern
given on the command line wasn't converted to a standin because the standin was
neither in ctx nor wctx.  This causes the named largefile to be added to the
'names' dict in cmdutil.revert() in the repo walk at line 2550.  The warning was
printed out when the 'names' dict is iterated, because the file was specified
exactly.

Since core revert recurses into subrepos and largefiles only overrides the
revert method in commands.py, it doesn't work properly when reverting a subrepo.
However, it still will recurse into the subrepo and call the installed matcher
method, so lfdirstate is reopened for the current repo level to prevent any new
problems.
2015-02-07 19:40:02 -05:00
Mads Kiilerich
f30992016d largefiles: show progress when checking standin hashes in outgoing changesets
This checking can take a huge amount of time and we should give user a hint
that something is going on.
2015-01-16 19:51:25 +01:00
Matt Harbison
2785c0c1da largefiles: enable subrepo support for add
The --large, --normal and --lfsize args couldn't be passed to a subrepo before,
and files in the subrepos would be added silently (if -v wasn't specified) as
normal files.  As an added bonus, 'hg add --dry-run' no longer prints that
largefiles would also be added as normal files as well.
2015-01-12 21:44:43 -05:00
Matt Harbison
efebc89ab9 largefiles: enable subrepo support for remove
Previously, remove failed when operating on a largefile in a subrepo, stating
that the file is untracked.
2014-12-30 21:12:52 -05:00
Matt Harbison
863f720320 largefiles: don't print files as both large and normal in addremove dryruns 2014-12-31 18:39:41 -05:00
Matt Harbison
f54b3d5591 largefiles: align the output messages for an added file with core methods
Core addremove prints the file relative to cwd only if patterns are provided to
the command.  Core add always prints relative to cwd.  Also, both methods print
the subrepo prefix when needed.  The 'already a largefile' doesn't have an
analog in core, but follows the same rules for consistency.
2014-11-28 21:44:41 -05:00
Matt Harbison
fe27be6419 largefiles: align the output messages for a removed file with core methods
Both cmdutil.remove() and scmutil.addremove() require verbose mode or an inexact
match to print the filename.  Core addremove also prints the file relative to
cwd only if patterns are provided to the command.  And finally, both methods
print the subrepo prefix when needed.
2014-11-28 21:03:44 -05:00
Matt Harbison
8f0f0a4fa4 largefiles: pass a matcher instead of a raw file list to removelargefiles()
This is consistent with addlargefiles(), and will make it easier to get the
paths that are printed correct when recursing into subrepos or invoking from
outside the repository.  It also now restricts the path that the addremove is
performed on if a path is given, as is done with normal files.

The repo.status() call needs to exclude clean files when performing an
addremove, because the addremove override method calling this used to pass the
list of files to delete, which caused the matcher to only consider those files
in building the status list.  Now the matcher is restricted only to the extent
that the caller requested- usually directories if at all.  There's no reason for
addremove to care about clean files anyway- we don't want them deleted.
2014-11-28 19:50:52 -05:00
Matt Mackall
1c9cf418be merge with stable 2015-01-05 15:46:14 -06:00
Matt Harbison
b391094100 largefiles: properly sync lfdirstate after removing largefiles
The more aggressive synchronization of lfdirstate that was backed out in
4fe80f20ab06 masked the problem where lfdirstate would hold an 'R' for a
largefile that was added and then removed without a commit between.  We could
just conditionally call lfdirstate.drop() or lfdirstate.remove() here, but this
also properly updates lfdirstate if the standin doesn't exist for the file
somehow (i.e. call drop instead of remove).

Without this change, the precommit status in the commit command immediately
after the test change lists the removed (and never committed) largefile as 'R'.
It can also lead to situations where the status command reports the same, long
after the commit [1].

[1] http://www.selenic.com/pipermail/mercurial-devel/2015-January/065153.html
2015-01-04 15:26:26 -05:00
Matt Harbison
f96d6adc63 largefiles: don't actually remove largefiles in an addremove dry run
The addlargefiles() method already properly handled dry runs.
2014-12-13 13:33:48 -05:00
Matt Mackall
0826b8e884 merge with stable 2014-12-18 16:41:59 -06:00
Matt Harbison
879e974dc7 largefiles: drop the override for 'fetch'
The fetch extension has been calling cmdutil.bailifchanged() since 70b2d52341c9,
so this is redundant.  Add test coverage to prevent regression.  It doesn't look
like there is any testing for fetch with largefiles.
2014-11-30 23:30:31 -05:00
Matt Harbison
d1e1ea0e07 tests: fix globs for Windows
test-largefiles-update.t, test-subrepo.t, test-tag.t, and
test-rename-dir-merge.t still warn about no result returned because of
unnecessary globs that test-check-code-hg.t wants, relating to output for
pushing to, pulling from and moving X to Y.
2014-11-16 16:26:15 -05:00
FUJIWARA Katsunori
b6c93017af largefiles: remove meaningless code path for "hg pull --rebase"
This patch removes "--rebase" specific code path for "hg pull" in
"overridepull", because previous patch makes it meaningless: now,
"rebase.rebase" ("orig" invocation in this patch) can
update/commit largefiles safely without "repo._isrebasing = True".

As a side effect of removing "rebase.rebase" invocation in
"overridepull", this patch removes "nothing to rebase ..." message in
"test-largefiles.t", which is shown only when rebase extension is
enabled AFTER largefiles:

  before this patch:

    1. "dispatch" invokes "pullrebase" of rebase as "hg pull" at
       first, because rebase wraps "hg pull" later

    2. "pullrebase" invokes "overridepull" of largefiles as "orig",
       even though rebase assumes that "orig" is "pull" of commands

    3. "overridepull" executes "pull" and "rebase" directly
      3.1 "pull" pulls changesets and creates new head "X"
      3.2 "rebase" rebases current working parent "Y" on "X"

    4. "overridepull" returns to "pullrebase"

    5. "pullrebase" tries to rebase, but there is nothing to be done,
       because "Y" is already rebased on "X". then, it shows "nothing
       to rebase ..."

  after this patch:

    1. "dispatch" invokes "pullrebase" of rebase as "hg pull"

    2. "pullrebase" invokes "overridepull" of largefiles as "orig"

    3. "overridepull" executes "pull" as "orig"

    4. "overridepull" returns to "pullrebase"

    5. revision "Y" is not yet rebased, so "pullrebase" doesn't shows
       "nothing to rebase ..."

As another side effect of removing "rebase.rebase" invocation, this
patch fixes issue3861, which occurs only when rebase extension is
enabled BEFORE largefiles:

  before this patch:

    1. "dispatch" invokes "overridepull" of largefiles at first,
       because largefiles wrap "hg pull" later

    2. "overridepull" executes "pull" and "rebase" explicitly
      2.1 "pull" pulls changesets and creates new head "X"
      2.2 "rebase" rebases current working parent, but fails because
          no revision is checked out in issue3861 case

    3. "overridepull" returns to "dispatch" with exit code 1 returned
       from "rebase" at (2.2)

    4. "hg pull" terminates with exit code 1 unexpectedly

  after this patch:

    1. "dispatch" invokes "overridepull" of largefiles at first

    2. "overridepull" invokes "pullrebase" of rebase as "orig"

    3. "pullrebase" invokes "pull" as "orig"

    4. "pullrebase" invokes "rebase", and it fails

    5. "pullrebase" returns to "overridepull" with exit code 0
       (because "pullrebase" ignores result of "pull" and "rebase")

    6. "overridepull" returns to "dispatch" with exit code 0 returned
       from "rebase" at (5)

    7. "hg pull" terminates with exit code 0
2014-11-05 23:24:47 +09:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
FUJIWARA Katsunori
da42d55c85 largefiles: update largefiles even if rebase is aborted by conflict
Before this patch, largefiles in the working directory aren't updated
correctly, if rebase is aborted by conflict. This prevents users from
viewing appropriate largefiles while resolving conflicts.

While rebase, largefiles in the working directory are updated only at
successful committing in the special code path of
"lfilesrepo.commit()".

To update largefiles even if rebase is aborted by conflict, this patch
centralizes the logic of updating largefiles in the working directory
into the "mergeupdate" wrapping "merge.update".


This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, largefiles in the
working directory should be updated with other (normal) files
simultaneously while "merge.update" execution: maybe by hooking
"applyupdates".

"Action list based updating" introduced by hooking "applyupdates" will
also improve performance of updating, because it automatically
decreases target files to be checked.


Just after this patch, there are some improper things in "Case 0" code
path of "lfilesrepo.commit()":

  - "updatelfiles" invocation is redundant for rebase
  - detailed comment doesn't meet to rebase behavior

These will be resolved after the subsequent patch for transplant,
because this code path is shared with transplant.


Even though replacing "merge.update" in rebase extension by "hg.merge"
can also avoid this problem, this patch chooses centralizing the logic
into "mergeupdate", because:

  - "merge.update" invocation in rebase extension can't be directly
    replaced by "hg.merge", because:

    - rebase requires some extra arguments, which "hg.merge" doesn't
      take (e.g. "ancestor")

    - rebase doesn't require statistics information forcibly displayed
      in "hg.merge"

  - introducing "mergeupdate" can resolve also problem of some other
    code paths directly using "merge.update"

    largefiles in the working directory aren't updated regardless of
    the result of commands below, before this patch:

    - backout (for revisions other than the parent revision of the
      working directory without "--merge")

    - graft

    - histedit (for revisions other than the parent of the working
      directory


When "partial" is specified, "merge.update" doesn't update dirstate
entries for standins, even though standins themselves are updated.

In this case, "normallookup" should be used to mark largefiles as
"possibly dirty" forcibly, because applying "normal" on lfdirstate
treats them as "clean" unexpectedly.

This is reason why "normallookup=partial" is specified for
"lfcommands.updatelfiles".


This patch doesn't test "hg rebase --continue", because it doesn't
work correctly if largefiles in the working directory are modified
manually while resolving conflicts. This will be fixed in the next
step of refactoring for largefiles.

All changes of tests/*.t files other than test-largefiles-update.t in
this patch come from invoking "updatelfiles" not after but before
statistics output of "hg.update", "hg.clean" and "hg.merge".
2014-08-24 23:47:26 +09:00
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
FUJIWARA Katsunori
3127f4abb3 largefiles: show also how many data entities are outgoing at "hg summary"
Before this patch, "hg summary --large" shows how many largefiles are
changed or added in outgoing revisions only in the point of the view
of filenames.

For example, according to the number of outgoing largefiles shown in
"hg summary" 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
summary" by counting number of unique hash values for outgoing
largefiles.

This patch introduces "_getoutgoings" to centralize the logic
(de-duplication, too) into it for convenience of subsequent patches,
even though it is not required in "hg summary" case.
2014-07-07 18:45:46 +09:00
FUJIWARA Katsunori
5ae1757d3d largefiles: add tests for summary/outgoing improved in subsequent patches
This patch adds tests for summary/outgoing improved in subsequent
patches, to reduce amount of diffs in each patches.

This patch adds new revisions below:

  - revision #2 adds new largefiles, but they contain as same data as
    one already existing

    this causes that multiple standins refer the same data entity

  - revision #3, #4 and #5 change the already existing largefile

    this causes that multiple data entities are outgoing for the standin.
    #5 can be used to check de-duplication of "(hash, filename)" pair.
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