Commit Graph

22008 Commits

Author SHA1 Message Date
Pierre-Yves David
4c3d1d5f78 check-code: allow an escape pattern to be specified for testpattern
Before this patch it was impossible to introduce a #no-xxx comment to disable a
test pattern warning.
2014-08-02 17:04:53 -07:00
Pierre-Yves David
1a25f452db check-code: capture "wc" as a word
Otherwise entries such as "wcchange" give false negative
2014-08-02 17:01:55 -07:00
Pierre-Yves David
5681b6942f test-revert: improve comment
We highlight the behavior tested by each sections. (This is a gratuitous
improvement before significant upgrade of the test and massive refactoring of
the revert code)
2014-06-25 15:58:05 +01: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
fa4741e97b largefiles: factor out synchronization of lfdirstate for future use 2014-08-11 22:29:43 +09:00
FUJIWARA Katsunori
26c1da5c46 largefiles: put whole rollback-ing process into the same "wlock" scope
Before this patch, there are three distinct "wlock" scopes in
"overriderollback":

  1. "localrepository.rollback" via original "rollback" command,
  2. "merge.update" for reverting standin files only, and
  3. "overriderollback" specific "wlock" scope (to synchronize
     largefile dirstate)

But these should be executed in the same "wlock" scope for
consistency.
2014-08-11 22:29:43 +09:00
Matt Mackall
74cb506481 tests: use a decorator for hghave checks 2014-08-11 09:35:24 -05:00
Matt Mackall
e82fc40f9c hg-test-mode: colorize HGFOO and TESTFOO environment variables 2014-08-10 23:13:12 -05:00
Matt Mackall
db1bb65a94 merge with stable 2014-08-10 15:26:33 -05:00
Matt Mackall
93db32d337 merge with stable 2014-08-10 14:30:30 -05:00
Matt Mackall
f2f76a2aa6 merge with stable 2014-08-09 16:06:01 -05:00
Matt Mackall
d5b665f1bb contrib: add emacs mode for *.t files 2014-08-08 17:45:36 -05:00
Pierre-Yves David
db81cffcdc phase: attach phase to the transaction instead of the lock
The phase cache file is no longer written on lock release, it is now handled by
the transaction (as changesets and obsolescence markers are).

(Hooray)

As we stop relying on the lock to write phase, repos with no existing phase
information will need to wait for a phase move or a strip to happen in order to
get the first write in the `phaseroots` file. This explain the change in
test-inherit-mode.t.

This should not have any side effects but in very obscure cases where
people interact with pre-2.1 and post-2.1 versions of Mercurial on the
same repo while having MQ patches applied but the MQ extension
disabled from time to time. A case unlikely enough to not be worth
preserving the old behavior with awful hacks.
2014-08-07 14:11:36 -07:00
Pierre-Yves David
60e760ea53 phase: extract the phaseroots serialization in a dedicated method
In most case, the file creation logic will be handled by the
transaction itself. The write method has to stay around for the case
where the repository is modified outside a transaction (strip).
2014-08-07 14:41:00 -07:00
Pierre-Yves David
3f8b890149 transaction: add a file generation mechanism
A new `transaction.addfilegenerator` function is added. It allows external code
to register files to be generated. See inline documentation for details.

It is important to gather all file creation logic on the transaction
as at some point we'll want to mimic the "pre-transaction-commit"
logic that we use for revlog. I'm refering to the logic that lets
hooks see the result of the transaction before it actually gets
committed.
2014-08-07 14:40:02 -07:00
Pierre-Yves David
98693f71e9 transaction: backup file in a dedicated "namespace"
File backup may conflict with other "journal.*" file. We add a fixed part in the
backup name file to prevent it.
2014-08-07 10:54:17 -07:00
Pierre-Yves David
c81f99d5f9 transaction: use self.journal to create backup file
Transaction journal name is "journal" in most case, but it can be something else.
We use the appropriate attribute to create the file.
2014-08-07 11:56:32 -07:00
Sean Farley
2c7a940b62 memctx: add note about p2 2014-06-17 20:55:06 -07:00
Sean Farley
f810468c76 memfilectx: add remove and write methods
Similar to the previous patch for workingfilectx, this patch will allow
abstracting localrepo.remove / write method to refactor working directory code
but instead operate on files in memory.
2014-07-25 20:20:26 -05:00
Sean Farley
a94ef7041a workingfilectx: add remove and write methods
This patch will allow abstracting localrepo.remove / write method to refactor
working directory code.
2014-07-02 14:01:01 -05:00
Sean Farley
2909941bb0 memctx: create a filectxfn if it is not callable
This will allow future patches to construct a memctx based on another context
or any other store-type object.
2014-07-25 19:36:01 -05:00
Augie Fackler
4cfa282888 test-patchbomb.t: work around Python change d579866d6419 (issue4188)
Python 2.7.7 and later (as well as some ubuntu/debian packages of
2.7.6) include a fix that makes the email module more pedantically
correct for MIME boundaries, but this breaks our tests. We work around
this by filtering the output of any 'hg email' invocations in the test
that produce MIME messages.
2014-08-07 11:39:19 -04:00
Pierre-Yves David
5f2b50474c phase: add a transaction argument to retractboundary
We now pass a transaction option to this phase movement function. The
object is currently not used by the function, but it will be in the
future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.
2014-08-05 23:52:21 -07:00
Pierre-Yves David
a9275323db phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.

The retractboundary function remains to be upgraded.
2014-08-06 01:54:19 -07:00
Pierre-Yves David
aaed9a0813 pull: pre-filter remote phases before moving local ones
We were relying on the phase internals to filter out redundant phase
information from remove. However as we plan to integrate phase
movement inside the transaction, we want to avoid useless transaction
creation on no-op pulls.

Therefore we filter out all the information that already matches the current
repository state. This will let us create a transaction only when there is
actual phase movement needed.
2014-08-06 00:54:37 -07:00
Pierre-Yves David
3a3f88b337 test-check-commit-hg.t: automatically test all 'draft() and ::.' changesets
We introduce a test-check-commit-hg.t file that will happily run the
check-commit file on all draft changeset under the working directory.

This should help newcomers to catch up with the rules. (And will helps old timer
from time to time).
2014-08-06 01:40:51 -07:00
Matt Mackall
7cba48bf37 whitespace: nuke triple blank lines in **.py 2014-08-07 14:58:12 -05:00
Matt Mackall
c16790ef08 check-commit: spot growing whitespace
We discourage PEP-8-style double blank lines, spot them creeping in.
2014-08-07 14:57:20 -05:00
Jordi Gutiérrez Hermoso
465e05be10 strip: remove -b/--backup codepaths
cset 21b4faf3787e has removed this option. This commit just tidies the
code that was associated to it. It also fixes the internal calls to
the strip() function.

Before this change, any function that thought it would want as a final
safety to keep a partial backup bundle (bundling changes not linearly
related to the current change being stripped), had to explicitly pass
a backup="strip" option. With this change, these backups are always
kept in case of an exception and always removed if there is no
exception. Only full backups can be specified with backup=True or no
full backups with backup=False.
2014-07-24 15:06:08 -04:00
Jordi Gutiérrez Hermoso
0ee68cc094 simplemerge: remove dead code
The following functions in simplemerge are dead code. I reran "make
test-merge*" after this change, and it passed. Looks like cruft that
we've been carrying since we nabbed this code from bzr.
2014-08-07 12:51:45 -04:00
Sean Farley
a9b7ae9555 basectx: add missing, merge, and branch args to dirty method
This fixes a discrepency for basectx and classes that inherit from it. Now
callers can pass these arguments to any context without an exception being
raised.
2014-06-17 20:26:51 -07:00
Sean Farley
760faddb4c basefilectx: move isexec and islink from memfilectx
This will be used in the future for creating memctx objects from other
store-type objects, such as a patch store or even another context.
2014-07-25 20:11:47 -05:00
Matt Mackall
a2b42e253a tests: fix pyflakes test whitespace breakage 2014-08-06 12:16:58 -05:00
Pierre-Yves David
4d38b093fd pushkey: wrap pushkey phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:58 -07:00
Pierre-Yves David
322ec1b757 push: wrap local phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:15 -07:00
Pierre-Yves David
f2b6946a89 phase: wrap hg phases phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:50:53 -07:00
Pierre-Yves David
7a1c469474 mq: wrap qimport phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:50:07 -07:00
Pierre-Yves David
6f74d76989 mq: wrap qfinish phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:48:51 -07:00
Matt Mackall
241d2dc08e tests: change some #ifs to #requires 2014-08-06 11:53:08 -05:00
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05:00
Matt Mackall
99b86fb9bf run-tests: add #require to abort full test
This allows nuking a bunch of ugly hghave || exit 80 lines.
2014-08-06 10:34:54 -05:00
Augie Fackler
00009ae554 run-tests: add support for xunit test reports
The Jenkins CI system understands xunit reports natively, so this will
be helpful for anyone that wants to use Jenkins for testing hg or
extensions that use run-tests.py for their testing.
2014-08-05 21:17:11 -04:00
Matt Mackall
aeec96d347 contrib: add check-commit hook script to sanity-check commits 2014-08-06 02:45:55 -05:00
Pierre-Yves David
6dbd91e861 shelve: use targetphase while unbundling
This removes the last manual phase movement in shelve.
2014-08-05 13:51:13 -07:00
Pierre-Yves David
8102dcd0f7 changegroup: add a targetphase argument to addchangegroup
This argument controls the phase used for the added changesets. This can be
useful to unbundle in "secret" phase as required by shelve.

This change aims at helping high-level code get rid of manual phase
movement. An important milestone for having phases part of the transaction.
2014-08-05 13:49:38 -07:00
Pierre-Yves David
5f1a5fce7f shelve: do not retract phase boundary by hand
We rely on the internal mechanism to commit the changeset in the right state.
This is similar to what the mq extension is doing.

This is an important change as we plan to move phase movement with the
transaction. Avoiding phase movement from high level code will avoid them the
burden of transaction handling. It is also important to limit the need for
transaction handling as this limits the odds of people messing up. Most common
expected mess-up is to use a different transaction for changesets creation and
phase adjustment.
2014-08-05 14:37:45 -07:00
Pierre-Yves David
7e05742434 commit: update the --secret code to use backupconfig and restoreconfig
Those dedicated methods also preserve all associated data (eg:
sources, lack of value).
2014-08-05 18:53:05 -07:00
Pierre-Yves David
2268a3034c rebase: do not retract phase boundary by hand
We rely on the internal mechanism to commit the changeset in the right phase.
This similar to what the mq extension is doing.

This is an important change as we plan to includes phase movement within the
transaction. Avoiding phase movement from high-level code will avoid the
burden of transaction handling. It is also important to limit the need for
transaction handling as this limits the odds of people messing up. Most common
expected mess-up is code using a different transaction for changeset creation
and phase adjustment.
2014-08-05 13:22:44 -07:00