Commit Graph

15 Commits

Author SHA1 Message Date
Yuya Nishihara
532f16e237 discovery: prevent crash caused by prune marker having no parent data
If a marker has no parent information, parents field is set to None, which
caused TypeError. I think this shouldn't normally happen, but somehow
I have such marker in my repo.
2017-04-19 23:10:05 +09:00
Pierre-Yves David
551d0f8ee6 checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:

For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".

To check if a changeset will be obsolete, we simply checks:

* the changeset phase

* the existence of a marker relevant to the "pushed set" that affects the
  changesets..

This fixes two major issues of the previous algorithm:

* branch partially rewritten (eg: head but not root) are no longer detected as
  replaced,

* Prune are now properly handled.

(This implementation was introduction in the evolve extension, version 6.0.0.)

This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.

In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
2017-04-15 02:55:18 +02:00
Jun Wu
3ee7ba0bd8 tests: replace "cp -r" with "cp -R"
The POSIX documentation about "cp" [1] says:

  ....

  RATIONALE
    ....
    Earlier versions of this standard included support for the -r option to
    copy file hierarchies. The -r option is historical practice on BSD and
    BSD-derived systems. This option is no longer specified by POSIX.1-2008
    but may be present in some implementations. The -R option was added as a
    close synonym to the -r option, selected for consistency with all other
    options in this volume of POSIX.1-2008 that do recursive directory
    descent.

    The difference between -R and the removed -r option is in the treatment
    by cp of file types other than regular and directory. It was
    implementation-defined how the - option treated special files to allow
    both historical implementations and those that chose to support -r with
    the same abilities as -R defined by this volume of POSIX.1-2008. The
    original -r flag, for historic reasons, did not handle special files any
    differently from regular files, but always read the file and copied its
    contents. This had obvious problems in the presence of special file
    types; for example, character devices, FIFOs, and sockets.
    ....

  ....

  Issue 6
    The -r option is marked obsolescent.
    ....

  Issue 7
    ....
    The obsolescent -r option is removed.
    ....

  (No "Issue 8" yet)

Therefore it's clear that "cp -R" is strictly better than "cp -r".

The issue was discovered when running tests on OS X after 2e4d149e62aa.

[1]: pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
2016-11-30 19:25:18 +00:00
timeless
129b8093c7 tests: favor single quotes for wrapping hg help ... 2016-09-20 23:49:20 +00:00
timeless
a57e86590a discovery: use single quotes in use warning 2016-09-20 23:47:30 +00:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Mads Kiilerich
98d1245448 test-obsolete-checkheads.t: remove todo comment that was fixed in ed1786de7376 2013-11-16 15:46:29 -05:00
FUJIWARA Katsunori
3198fa3830 push: hide description about "-f" in the hint to prevent from using it easily
"use push -f to force" in the hint at abortion of "hg push" may cause
novice users to execute "push -f" easily without understanding about
problems of multiple branch heads in the repository.

This patch hides description about "-f" in the hint, and leads into
seeing "hg help push" for details about pushing new heads.
2013-10-03 23:16:06 +09:00
Pierre-Yves David
b3155544bd push: refuse to push bumped changeset
This applies the same logic as used for `obsolete` and `unstable` changesets.
Refuse to push them without force.

We'll probably want to factor this logic with two new functions
`pctx.troubled()` and `ctx.troubles()`. But I'm waiting for the third
"trouble" to make it into core.
2012-10-19 00:50:12 +02:00
Patrick Mezard
0d4dcbceb6 test-obsolete-checkheads: fix on windows 2012-09-14 20:40:52 +02:00
Pierre-Yves David
ad749501f8 checkheads: don't warn about unsynced changes that we ill obsolete
We won't be able to pull them after this push.
2012-08-26 00:27:44 +02:00
Pierre-Yves David
653c171718 checkheads: check successors for new heads in both missing and common
A relevant obsolete marker may have been added -after- we previously
exchanged the changeset. We have to search for remote heads that
disappear by the sole fact of pushing obsolescence.

This case will also happen when remote got the new version from a
repository that does not propagate obsolescence markers.
2012-08-26 00:25:33 +02:00
Pierre-Yves David
14699d4d9c checkheads: attend to phases when computing new heads with obsolete
Checkheads was more permissive than expected. When the remote heads
are public we don't need to search for successors. None will make a
public head disappear.
2012-08-24 16:52:45 +02:00
Pierre-Yves David
570443d0f7 test: add testing of checkheads behavior with obsolete
Expected behavior is quite complex. Explicit testing with clear
scenarios is welcome.
2012-08-01 19:35:05 +02:00