Commit Graph

36 Commits

Author SHA1 Message Date
Siddharth Agarwal
a6dc53e738 simplemerge: move conflict warning message to filemerge
The current output for a failed merge with conflict markers looks something like:

  merging foo
  warning: conflicts during merge.
  merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
  merging bar
  warning: conflicts during merge.
  merging bar incomplete! (edit conflicts, then use 'hg resolve --mark')

We're going to change the way merges are done to perform all premerges before
all merges, so that the output above would look like:

  merging foo
  merging bar
  warning: conflicts during merge.
  merging foo incomplete! (edit conflicts, then use 'hg resolve --mark')
  warning: conflicts during merge.
  merging bar incomplete! (edit conflicts, then use 'hg resolve --mark')

The 'warning: conflicts during merge' line has no context, so is pretty
confusing.

This patch will change the future output to:

  merging foo
  merging bar
  warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging bar! (edit, then use 'hg resolve --mark')

The hint on how to resolve the conflicts makes this a bit unwieldy, but solving
that is tricky because we already hint that people run 'hg resolve' to retry
unresolved merges. The 'hg resolve --mark' mostly applies to conflict marker
based resolution.
2015-10-09 13:54:52 -07:00
Matt Harbison
6579c8c6d9 extdiff: use archiver to take snapshots of committed revisions
This is the last step before supporting extdiff -S.  It maintains the existing
behavior of diffing the largefile standins instead of the largefiles themselves.
Note however that the standins are not updated immediately upon modification, so
uncommitted largefile changes are ignored, as they previously were, even with
the diff command.
2012-07-11 20:48:51 -04:00
Mads Kiilerich
f01f6edb81 largefiles: make linear update set unsure largefiles normal if unchanged
'hg update' would hash all 'unsure' largefiles before performing the merge. It
would update the standins but not detect the very common case where the
largefile never had been changed by the user but just had been marked with an
invalid dirstate mtime to make sure any changes done by the user in the same
second would be detected. The largefile would remain in that state and would
have to be hashed again next time even though it still not had been changed.
Sad trombone.

Instead, for largefiles listed as 'unsure' or 'modified', after updating the
standin with the actual hash, mark the largefile as normal if it turns out to
not be modified relative to the revision in the parent revision. That will
prevent it from being hashed again next time.
2015-01-09 18:38:02 +01:00
Mads Kiilerich
ec0ae429ed debugdirstate: don't hide date field with --nodate, just show 'set'/'unset'
The value of the dirstate date field cannot be used in tests and we thus have
to use debugdirstate with --nodate. It is however still very helpful to be able
to see whether the date field has been set or still is unset. The absence of
that information made it hard to debug some largefile dirstate issues.

This change _could_ make the test suite more unstable ... but that would be
places where the test suite or the code should be made more stable. (Note:
'unset' with the magic negative sizes is reliable. 'unset' for normal sizes
would probably not be reliable, but there is no such occurrences in the test
suite and it should thus be reliable.)

This output wastes more horizontal space in the --nodate output, but it also
makes things simpler that the output format always is the same. It is just a
debug command so let's keep it simple.
2015-01-09 18:38:02 +01:00
Durham Goode
2591767a70 bundles: do not overwrite existing backup bundles (BC)
Previously, a backup bundle could overwrite an existing bundle and cause user
data loss. For instance, if you have A<-B<-C and strip B, it produces backup
bundle B-backup.hg. If you then hg pull -r B B-backup.hg and strip it again, it
overwrites the existing B-backup.hg and C is lost.

The fix is to add a hash of all the nodes inside that bundle to the filename.
Fixed up existing tests and added a new test in test-strip.t
2015-01-09 10:52:14 -08:00
Matt Mackall
00a6d1affb merge with stable 2015-01-01 16:47:14 -06:00
Mads Kiilerich
b438c7467e largefiles: backout d20af8be6a14 - linear updates handle m -> a differently
d20af8be6a14 introduced a significant performance regression: All largefiles
were marked 'normallookup' by linear (or noop) updates and had to be rehashed
by the next command.

The previous change introduced a different solution to the problem d20af8be6a14
solved and we can thus back it out again.
2014-12-31 14:46:03 +01:00
Mads Kiilerich
d0a915efcf tests: add test coverage for lfdirstate invalidation of linear update
d20af8be6a14 introduced a significant performance regression: All largefiles
are marked 'normallookup' in lfdirstate by linear (or noop) updates and has to
be rehashed by the next command.

To avoid such regressions, keep an eye on the dirstate content after a plain
'hg up'.
2014-12-31 14:45:02 +01:00
FUJIWARA Katsunori
4359f5ec2d largefiles: avoid exec-bit examination on the platform being unaware of it
Changeset 5b64e22ecd8e introduced the examination of exec bit of
largefiles in "hg status --rev REV" case, but it doesn't avoid it on
the platform being unaware of exec-bit (e.g. on NTFS of Windows).
2014-11-25 18:37:28 +09:00
Martin von Zweigbergk
1932d029e7 merge: move cd/dc prompts after largefiles prompts
By moving the cd/dc prompts out of calculateupdates(), we let
largefiles' overridecalculateupdates() so the unresolved values
(i.e. 'cd' or 'dc' rather than 'g', 'r', 'a' and missing). This allows
overridecalculateupdates() to ask the user whether to keep the normal
file or the largefile before the user gets the cd/dc prompt. Whichever
answer the user gives, we make overridecalculateupdates() replace 'cd'
or 'dc' action, saving the user one annoying (and less clear)
question.
2014-12-11 21:21:21 -08:00
Mads Kiilerich
0419ad5c23 rebase: show more useful status information while rebasing
Show status messages while rebasing, similar to what graft do:
  rebasing 12:2647734878ef "fork" (tip)

This gives more context for the user when resolving conflicts.
2014-12-09 03:45:26 +01:00
Matt Mackall
e73fb86802 merge with stable 2014-11-25 17:30:05 -06:00
FUJIWARA Katsunori
3f4cab3fa5 largefiles: move "copyalltostore" invocation into "markcommitted"
Before this patch, while "hg convert", largefiles avoids copying
largefiles in the working directory into the store area by combination
of setting "repo._isconverting" in "mercurialsink{before|after}" and
checking it in "copytostoreabsolute".

This avoiding is needed while "hg convert", because converting doesn't
update largefiles in the working directory.

But this implementation is not efficient, because:

  - invocation in "markcommitted" can easily ensure updating
    largefiles in the working directory

    "markcommitted" is invoked only when new revision is committed via
    "commit" of "localrepository" (= with files in the working
    directory). On the other hand, "commitctx" may be invoked directly
    for in-memory committing.

  - committing without updating the working directory (e.g. "import
    --bypass") also needs this kind of avoiding

For efficiency of this kind of avoiding, this patch does:

  - move "copyalltostore" invocation into "markcommitted"
  - remove meaningless procedures below:
    - hooking "mercurialsink{before|after}" to (un)set "repo._isconverting"
    - checking "repo._isconverting" in "copytostoreabsolute"

This patch invokes "copyalltostore" also in "_commitcontext", because
"_commitcontext" expects that largefiles in the working directory are
copied into store area after "commitctx". In this case, the working
directory is used as a kind of temporary area to write largefiles out,
even though converted revisions are committed via "commitctx" (without
updating normal files).
2014-11-08 00:48:41 +09:00
FUJIWARA Katsunori
ba0a7a0792 largefiles: update standins only at the 1st commit of "transplant --continue"
Before this patch, "hg transplant --continue" may record incorrect
standins, because largefiles extension always avoid updating standins
while transplanting, even though largefiles in the working directory
may be modified manually at the 1st commit of "hg transplant --continue".

But, on the other hand, updating standins should be avoided at
subsequent commits for efficiency reason.

To update standins only at the 1st commit of "hg transplant
--continue", this patch uses "automatedcommithook", which updates
standins by "lfutil.updatestandinsbymatch()" only at the 1st commit of
resuming.

Even after this patch, "repo._istransplanting = True" is still needed
to avoid some status report while updating largefiles in
"lfcommands.updatelfiles()".

This is reason why this patch omits not "repo._istransplanting = True"
in "overriderebase" but examination of "getattr(repo,
"_istransplanting", False)" in "updatestandinsbymatch".
2014-11-08 00:48:41 +09:00
FUJIWARA Katsunori
381dc2e6b0 largefiles: update standins only at the 1st commit of "hg rebase --continue"
Before this patch, "hg rebase --continue" may record incorrect
standins, because largefiles extension always avoid updating standins
while rebasing, even though largefiles in the working directory may be
modified manually at the 1st commit of "hg rebase --continue".

But, on the other hand, updating standins should be avoided at
subsequent commits for efficiency reason.

To update standins only at the 1st commit of "hg rebase --continue",
this patch introduces state-full callable object
"automatedcommithook", which updates standins by
"lfutil.updatestandinsbymatch()" only at the 1st commit of resuming.

Even after this patch, "repo._isrebasing = True" is still needed to
avoid some status report while updating largefiles in
"lfcommands.updatelfiles()".

This is reason why this patch omits not "repo._isrebasing = True" in
"overriderebase" but examination of "getattr(repo, "_isrebasing",
False)" in "updatestandinsbymatch".
2014-11-05 23:24:47 +09:00
FUJIWARA Katsunori
f6257de7a8 largefiles: add examination of exec bit in "hg status --rev REV" case
Before this patch, "hg status --rev REV" doesn't list largefiles up
with "M" mark, even if exec bit of them is changed, because
"lfilesrepo.status" doesn't examine exec bit in such case.
2014-10-28 01:14:12 +09:00
FUJIWARA Katsunori
6a795d6783 largefiles: ignore removal status of files not managed in the target context
Before this patch, "hg status --rev REV" listed largefiles removed in
the working directory up with "R" mark, even if they aren't managed in
the REV. Normal files aren't listed up in such case.

When "lfilesrepo.status" is invoked for "hg status --rev REV", it
treats files on conditions below as "removed" (to avoid manifest full
scan in "ctx.status" ?):

  - marked as "R" in lfdirstate, or

  - files managed in the target revision but unknown in the manifest
    of the working context (= not including "R" files)

But the former can include files not managed in the target context.

To ignore removal status of files not managed in the target context,
this patch drops files unknown in the target revision from "removed"
list.
2014-10-28 01:14:11 +09:00
FUJIWARA Katsunori
7b2b4035f5 tests: add "(glob)" for l10n messages in test-largefiles-update.t for Windows
This patch follows the style of other tests avoiding same kind of issue.
2014-10-20 22:08:08 +09:00
Mads Kiilerich
3a64b6d7ed subrepo: remove superfluous newline from subrepo prompt 2014-10-01 01:08:17 +02:00
Mads Kiilerich
29285eb86d ui: show prompt choice if input is not a tty but is forced to be interactive
The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.

Instead, if the input not is a tty, write the selection and a newline.
2014-10-01 01:04:18 +02:00
FUJIWARA Katsunori
b72ba540fe largefiles: update largefiles even if transplant is aborted by conflict
Before this patch, largefiles in the working directory aren't updated
correctly, if transplant is aborted by conflict. This prevents users
from viewing appropriate largefiles while resolving conflicts.

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

To update largefiles even if transplant is aborted by conflict, this
patch wraps "scmutil.marktouched", which is invoked from "patch.patch"
with "files" list of added/modified/deleted files.

This patch invokes "updatelfiles" with:

  - "printmessage=False", to suppress "getting changed largefiles ..."
    messages while automated committing by transplant

  - "normallookup=True", because "patch.patch" doesn't update dirstate
    for modified files

    in such case, "normallookup=False" may cause marking modified
    largefiles as "clean" unexpectedly
2014-08-24 23:47:26 +09: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
0c1f44d597 largefiles: move "updatestandin" invocation to "hg.updaterepo" wrapper
Code paths below expect "hg.updaterepo" (or "hg.update" using it) to
execute linear merging:

  - "update" in commands
  - "postincoming" in commands, used for:
    - "hg pull --update"
    - "hg unbundle --update"
  - "hgsubrepo.get" in subrepo

For linear merging with largefiles, standins should be updated
according to (possibly dirty) largefiles before "merge.update"
invocation to detect conflicts correctly.

Before this patch, only the "update" command can execute linear merging
correctly, because largefiles extension takes care of only it.

This patch moves "updatestandin" invocation from "overrideupdate" ("hg
update" wrapper) to "_hgupdaterepo" ("hg.updaterepo" wrapper) to
execute linear merging in "hg.updaterepo" correctly.

This is also a preparation to centralize the logic of updating
largefiles in the working directory into the function wrapping
"merge.update" in the subsequent patch.
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
1e10153104 largefiles: unlink standins not known to the restored dirstate at rollback
Before this patch, standinds not known to the restored dirstate at
rollback still exist after rollback of the parent of the working
directory, and they become orphans unexpectedly.

This patch unlinks standins not known to the restored dirstate.

This patch saves names of standins matched against not
"repo.dirstate[f] == 'a'" but "repo.dirstate[f] != 'r'" before
rollback, because branch merging marks files newly added to
dirstate as not "a" but "n".

Such standins will also become orphan after rollback, because they are
not known to the restored dirstate.
2014-08-24 23:47:26 +09:00
FUJIWARA Katsunori
4bfc24bc88 largefiles: restore standins according to restored dirstate
Before this patch, standins are restored from the NEW parent of the
working directory at "hg rollback", and this causes:

  - standins removed in the rollback-ed revision are restored, and
    become orphan, because they are already marked as "R" in the
    restored dirstate and expected to be unlinked

  - standins added in the rollback-ed revision are left as they were
    before rollback, because they are not included in the new parent
    (this may not be so serious)

This patch replaces the "merge.update" invocation with a specific
implementation to restore standins according to restored dirstate.

This is also the preparation to centralize the logic of updating
largefiles into the function wrapping "merge.update" in the subsequent
patch.

After that patch, "merge.update" will also update largefiles in the
working directory and be redundant for restoring standins only.
2014-08-24 23:47:25 +09:00
FUJIWARA Katsunori
1b49e33c21 largefiles: restore standins from non branch-tip parent at rollback correctly
Before this patch, "hg rollback" can't restore standins correclty, if:

  - old parent of the working directory is rollback-ed, and
  - new parent of the working directory is not branch-tip

"overriderollback" uses "merge.update" as a kind of "revert" utility
to restore only standins with "node=None", and this makes
"merge.update" choose "branch-tip" revision as the updating target
unexpectedly.

Then, "merge.update" restores standins from the branch-tip revision
regardless of the parent of the working directory after rollback and
this may cause unexpected behavior.

This patch invokes "merge.update" with "node='.'" to restore standins
from the parent revision of the working directory.

In fact, this "merge.update" invocation will be replaced in the
subsequent patch to fix another problem, but this change is usefull to
inform reason why such complicated case should be tested.
2014-08-24 23:47:25 +09:00
FUJIWARA Katsunori
9bb4aa1522 largefiles: omit restoring standins if working parent is not rollbacked
For efficiency, this patch omits restoring standins and updating
lfdirstate, if the parent of the working directory is not rollbacked.

This patch adds the test not to confirm whether restoring is skipped
or not, but to detect unexpected regression in the future: it is
difficult to distinguish between skipping and perfectly restoring.
2014-08-24 23:47:25 +09:00
FUJIWARA Katsunori
3288a3b80d largefiles: update lfdirstate for unchanged largefiles during linear merging
Before this patch, linear merging of modified largefiles causes
an unexpected result, if (1) largefile collides with same-name normal one
in the target revision and (2) "local" largefile is chosen, even
though branch merging between such revisions works correctly.

Expected result of such linear merging is marking the largefile as
(re-)"added", but the actual result is marking it as "modified".

The standin of modified "local largefile" is not changed by linear
merging, and updating/merging update lfdirstate entries only for
largefiles of which standins are changed.

This patch adds the code path to update lfdirstate only for largefiles
of which standins are not changed.

In this case, "synclfdirstate" should be invoked with True as
"normallookup" argument always to force using "normallookup" on
dirstate for "n" files, because "normal" may mark target files as
"clean" unexpectedly.

To reduce cost of "lfile not in filelist", this patch converts
"filelist" to a "set" object: "filelist" is used only in (1) the newly
added code path and (2) the next line of "filelist = set(filelist)".

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously during "merge.update"
execution: maybe by hooking "recordupdates" (+ total refactoring
around lfdirstate handling)
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
582af6221b largefiles: keep largefiles from colliding with normal one during linear merge
Before this patch, linear merging of modified or newly added largefile
causes unexpected result, if (1) largefile collides with same name
normal one in the target revision and (2) "local" largefile is chosen,
even though branch merging between such revisions doesn't.

Expected result of such linear merging is:

  (1) (not yet recorded) largefile is kept in the working directory
  (2) largefile is marked as (re-)"added"
  (3) colliding normal file is marked as "removed"

But actual result is:

  (1) largefile in the working directory is unlinked
  (2) largefile is marked as "normal" (so treated as "missing")
  (3) the dirstate entry for colliding normal file is just dropped

(1) is very serious, because there is no way to restore temporarily
modified largefiles.

(3) prevents the next commit from adding the manifest with correct
"removal of (normal) file" information for newly created changeset.

The root cause of this problem is putting "lfile" into "actions['r']"
in linear-merging case. At liner merging, "actions['r']" causes:

  - unlinking "target file" in the working directory, but "lfile" as
    "target file" is also largefile itself in this case

  - dropping the dirstate entry for target file

"actions['f']" (= "forget") does only the latter, and this is reason
why this patch doesn't choose putting "lfile" into it instead of
"actions['r']".

This patch newly introduces action "lfmr" (LargeFiles: Mark as
Removed) to mark colliding normal file as "removed" without unlinking
it.

This patch uses "hg debugdirstate" instead of "hg status" in test,
because:

  - choosing "local largefile" hides "removed" status of "remote
    normal file" in "hg status" output, and

  - "hg status" for "large2" in this case has another problem fixed in
    the subsequent patch
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
df8394d920 largefiles: add test for large/normal conflict at linear merging
Before this patch, there is no explicit test for it: test-issue3084.t
seems to test such conflict only at branch merging.

This patch uses "[debug] dirstate.delaywrite" feature for the tests
expecting "M" status of largefiles, to confirm certainly whether files
are marked unexpectedly as "clean".
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
d98ab37761 largefiles: synchronize lfdirstate with dirstate after automated committing
Before this patch, after successful "hg rebase" of the revision
removing largefiles, "hg status" may still show ""R" for such
largefiles unexpectedly.

"lfilesrepo.commit" executes the special code path for automated
committing while rebase/transplant, and lfdirstate entries for removed
files aren't updated in this code path, even after successful
committing.

Then, "R" entries still existing in lfdirstate cause unexpected "hg
status" output.

This patch synchronizes lfdirstate with dirstate after automated
committing.

This patch passes False as "normallookup" to "synclfdirstate", because
modified files in "files()" of the recent (= just committed) context
should be "normal"-ed.

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, lfdirstate should
be updated with dirstate simultaneously. Hooking "markcommitted" of
ctx in "localrepository.commitctx" may achieve this.

This problem occurs, only when (1) the parent of the working directory
is rebased and (2) it removes largefiles, because:

  - if the parent of the working directory isn't rebased, returning to
    the initial revision (= update) after rebase hides this problem

  - files added on "other" branch (= rebase target) are treated not as
    "added" but as "modified" (= "normal" status and "unset"
    timestamp) at merging

This patch tests also the status of added largefile, but it is only
for avoiding regression.

In addition to conditions above, "hg status" must not take existing
files to reproduce this problem, because existing files make
"match._files" not empty in "lfilesrepo.status" code path below:

    def sfindirstate(f):
        sf = lfutil.standin(f)
        dirstate = self.dirstate
        return sf in dirstate or sf in dirstate.dirs()

    match._files = [f for f in match._files
                    if sfindirstate(f)]

Not empty "match._files" prevents "status" on lfdirstate from
returning the result containing problematic "R" files.

This is reason why "large1" (removed) and "largeX" (added) are checked
separately in this patch.

Problematic code path in "lfilesrepo.commit" is used also by "hg
transplant", but this problem doesn't occur at "hg transplant",
because invocation of "updatelfiles" after transplant-ing in
"overridetransplant" causes cleaning lfdirstate up.

This patch tests also "hg transplant" as same as "hg rebase", but it
is only for avoiding regression.
2014-08-11 22:29:43 +09:00
FUJIWARA Katsunori
3e60912936 largefiles: drop orphan entries from lfdristat at "hg rollback"
Before this patch, newly added (but not yet committed) largefiles
aren't treated as unknown ("?") after "hg rollback".

After "hg rollback", lfdirstate still contains "A" status entries for
such largefiles, even though corresponding entries for standins are
already dropped from dirstate.

Such "orphan" entries in lfdirstate prevent unknown (large)files in
the working directory from being listed up in "unknown" list. The code
path in "if working" route of "lfilesrepo.status" below drops
largefiles tracked in lfdirstate from "unknown" list:

    lfiles = set(lfdirstate._map)
    # Unknown files
    result[4] = set(result[4]).difference(lfiles)

This patch drops orphan entries from lfdristate at "hg rollback".

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, lfdirstate should
be rollback-ed as a part of transaction, as same as dirstate.
2014-08-11 22:29:43 +09:00
FUJIWARA Katsunori
06dc24b169 largefiles: restore R status of removed largefiles correctly at "hg rollback"
Before this patch, removed or forgotten largefiles aren't treated as
removed ("R") after "hg rollback". Removed ones are treated as missing
("!") and forgotten ones are treated as clean ("C") unexpectedly.

"overriderollback" uses "normallookup" to restore status in lfdirstate
for largefiles other than ones not added in rollback-ed revision, but
this isn't correct for removed (or forgotten) largefiles.

This patch uses "lfutil.synclfdirstate" to restore "R" status of
removed (or forgotten) largefiles correctly at "hg rollback".

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, lfdirstate should
be rollback-ed as a part of transaction, as same as dirstate.
2014-08-11 22:29:43 +09:00
FUJIWARA Katsunori
8c6b77e441 largefiles: use "normallookup" on "lfdirstate" while reverting
Before this patch, largefiles gotten from revisions other than the
parent of the working directory at "hg revert" become "clean"
unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before reverting)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
     (1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed)

    2. "cmdutil.revert()" is invoked
      2-1 standinfile SF is updated in the working directory
      2-2 "dirstate" entry for SF is NOT updated

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.overriderevert()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "n" and valid timestamp for SF (by 1-1 and 2-2)
      3-3 "lfdirstate" entry for LF is "normal"-ed
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 3-3)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 3-3 and 3-4) as "clean".

When largefiles are reverted, they should be "normallookup"-ed
forcibly.

This patch uses "normallookup" on "lfdirstate" while reverting, by
passing "True" to newly added argument "normallookup".

Forcible "normallookup"-ing is not so expensive, because list of
target largefiles is explicitly specified in this case.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate" (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
f5a07da3f0 largefiles: invoke "normallookup" on "lfdirstate" for merged files
Before this patch, largefiles gotten from "other" revision (with
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before merging)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
      1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed

    2. "merge.update()" is invoked
      2-1 SF is updated in the working directory
          (ASSUMPTION: user choice "other" at conflict)
      2-2 "dirstate" entry for SF is "merge"-ed

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "m" for SF (by 2-2)
      3-3 "lfdirstate" entry for LF is left as it is
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 1-2)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 1-2 and 3-4) as "clean".

When state of standinfile in "dirstate" is "m", largefile should be
"normallookup"-ed.

This patch invokes "normallookup" on "lfdirstate" for merged files.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
c24b717f3e largefiles: use "normallookup", if "mtime" of standin is unset
Before this patch, largefiles gotten from "other" revision (without
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "merge.update()" is invoked
      1-1 standinfile SF is updated in the working directory
      1-2 "dirstate" entry for SF is "normallookup"-ed

    2. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      2-1 largefile LF (for SF) is updated in the working directory
      2-2 "dirstate" returns "n" for SF (by 1-2)
      2-3 "lfdirstate" entry for LF is "normal"-ed
      2-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 2-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 2-3 and 2-4) as "clean".

When timestamp is not set (= negative value) for standinfile in
"dirstate", largefile should be "normallookup"-ed regardless of
rebasing or not, because "n" state in "dirstate" doesn't ensure
"clean"-ness of a standinfile at that time.

This patch uses "normallookup" instead of "normal", if "mtime" of
standin is unset

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously while "merge.update"
execution: maybe by hooking "recordupdates"

It is also why this patch (temporarily) uses internal field "_map" of
"dirstate" directly.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 2-4)

This patch newly adds "test-largefiles-update.t", to avoid increasing
cost to run other tests for largefiles by subsequent patches
(especially, "[debug] dirstate.delaywrite" causes so).
2014-07-22 23:59:34 +09:00