Commit Graph

9 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
851e75b58e context: override _dirstatestatus in workingcommitctx for correct matching
Before this patch, the result of "status()" on "workingcommitctx" may
incorrectly contain files other than ones to be committed, because
"workingctx._dirstatestatus()" returns the result of
"dirstate.status()" directly.

For correct matching, this patch overrides "_dirstatestatus" in
"workingcommitctx" and makes it return matched files only in
"self._status".

This patch uses empty list for "deleted", "unknown" and "ignored" of
status, because status between "changectx"s also makes them empty.
2014-12-31 17:55:43 +09:00
FUJIWARA Katsunori
7b31cd3a28 context: avoid breaking already fixed self._status at ctx.status()
Before this patch, "status()" on "workingcommitctx" with "always
match" object causes breaking "self._status" in
"workingctx._buildstatus()", because "workingctx._buildstatus()"
caches the result of "dirstate.status()" into "self._status" for
efficiency, even though it should be fixed at construction for
committing.

For example, template function "diff()" without any patterns in
"committemplate" implies "status()" on "workingcommitctx" with "always
match" object, via "basectx.diff()" and "patch.diff()".

Then, broken "self._status" causes committing unexpected files.

To avoid breaking already fixed "self._status" at "ctx.status()", this
patch overrides "_buildstatus" in "workingcommitctx".

This patch doesn't write out the result of template function "diff()"
in "committemplate" in "test-commit.t", because matching against files
to be committed still has an issue fixed in subsequent patch.
2014-12-31 17:55:43 +09:00
FUJIWARA Katsunori
c2e92a32b4 context: make unknown/ignored/clean of cached status empty for equivalence
Before this patch, "workingctx.status" caches the result of
"dirstate.status" directly into "self._status".

But "dirstate.status" is invoked with False "list*" arguments in
normal "self._status" accessing route, and this makes
"unknown"/"ignored"/"clean" of status empty.

This may cause unexpected result of code paths internally accessing to
them (accessors for external usage are already removed by previous patch).

This patch makes "unknown"/"ignored"/"clean" of cached status empty
for equivalence. Making them empty is executed only when at least one
of "unknown", "ignored" or "clean" has files, for efficiency.
2014-12-31 17:55:43 +09:00
FUJIWARA Katsunori
797fef3e65 context: cache self._status correctly at workingctx.status
Before this patch, "workingctx.status" always replaces "self._status"
by the recent result, even though:

  - status isn't calculated against the parent of the working directory, or

  - specified "match" isn't "always" one
    (status is only visible partially)

If "workingctx" object is shared between some procedures indirectly
referring "ctx._status", this incorrect caching may cause unexpected
result: for example, "ctx._status" is used via "manifest()", "files()"
and so on.

To cache "self._status" correctly at "workingctx.status", this patch
overwrites "self._status" in "workingctx._buildstatus" only when:

  - status is calculated against the parent of the working directory, and
  - specified "match" is "always" one

This patch can be applied (and effective) only on default branch,
because procedure around "basectx.status" is much different between
stable and default: for example, overwriting "self._status" itself is
executed not in "workingctx._buildstatus" but in
"workingctx._poststatus", on stable branch.
2014-12-31 17:55:43 +09:00
Martin von Zweigbergk
8961a5a15c status: update various other methods to return new class 2014-10-14 00:52:27 -05:00
Sean Farley
e5137b4545 test-context: add test for performing a diff on a memctx
We now see the first result of all that refactoring of memctx: we can now diff
against a memctx.
2014-06-13 15:59:18 -07:00
Sean Farley
49ecf5d144 test-context: add test for memctx status 2014-06-13 15:56:11 -07:00
Martin Geisler
ff9aae8a76 changelog: convert user and desc from local encoding early
Failing to do so makes it impossible to use the memctx API to create a
changeset with a commit message or username outside of the current
encoding.encoding setting.
2011-05-19 18:09:25 +02:00
Thomas Arendsen Hein
c20f16ea94 Fixed workingfilectx.date() (found by Thomas Waldmann) with test. 2007-02-23 17:31:00 +01:00