Commit Graph

127 Commits

Author SHA1 Message Date
Martin von Zweigbergk
1f6af49532 strip: include phases in bundle (BC)
Before this patch, unbundling a stripped changeset would make it a
draft (unless the parent was secret). This meant that one would lose
phase information when stripping and unbundling secret changesets. The
same thing was true for public changesets. While stripping public
changesets is generally rare, it's done frequently by e.g. the
narrowhg extension.

We also include the phases in the temporary bundle, just in case
stripping were to fail after that point, so the user can still restore
the repo including phase information. Before this patch, the phases
were left untouched during the bundling and unbundling of the
temporary bundle. Only at the end of the transaction would
phasecache.filterunknown() be called to remove phase roots that were
no longer valid. We now need to call that also after the first
stripping, i.e. before applying the temporary bundle. Otherwise
unbundling the temporary bundle will cause a read of the phase cache
which has stripped changesets in the cache and that fails.

Like with obsmarkers, we unconditionally include the phases in the
bundle when stripping (when using bundle2, such as when generaldelta
is enabled). The reason for doing that for strip but not for bundle is
that strip bundles are not meant to be shared outside the repo, so we
don't care as much about compatibility.
2017-06-15 00:15:52 -07:00
Yuya Nishihara
91bdea4c9e json: pass formatting options recursively
This bug was introduced in 469914605447. It's okay to escape <>, but is
unnecessary for command output.
2017-06-09 21:33:15 +09:00
Yuya Nishihara
9446b4d29d test-obsolete: include <> in user field to check JSON escapes
I found json() filter doesn't pass formatting options recursively. That's
why <> are escaped.
2017-06-09 21:45:22 +09:00
Pierre-Yves David
8d733e89bc strip: strip obsmarkers exclusive to the stripped changeset
This is it, `hg strip --rev X` will now also remove obsolescence markers
exclusive to X. Since a previous changeset, the obsmarkers has been backed up
in the strip backup bundle, so it is possible to restore them.

Note: stripping obsmarkers means the precursors of the stripped changeset might no
longer be obsolete after the strip.

Stripping changeset without obsmarkers can be useful when building test case. So
It is possible to disable the stripping of obsmarkers using the
'devel.strip-obsmarkers' config option.

Test change have been carefully validated.
2017-05-20 16:19:59 +02:00
Pierre-Yves David
66c1fb799c obsolete: add a function to compute "exclusive-markers" for a set of nodes
This set will be used to select the obsmarkers to be stripped alongside the
stripped changesets. See the function docstring for details.

More advanced testing is introduced in the next changesets to keep this one
simpler. That extra testing provides more example.
2017-05-20 15:02:30 +02:00
Pierre-Yves David
e1977b120c strip: also backup obsmarkers
We are about to give 'strip' the ability to remove obsmarkers. Before we start
removing data we must make sure it is preserved somewhere. So the backup bundle
created by 'strip' now contains obsmarkers.
2017-05-20 15:06:10 +02:00
Pierre-Yves David
74dcd06928 hidden: drop the hidden cache logic
The improvement in time complexitty and the speed-up in computation is large
enough that the has little use now. Its update time can even gets in the way. So
we drop it.

This will allow us to unify the static/dynamic blockers logic in the next
changeset.
2017-05-21 15:53:08 +02:00
Boris Feld
527b4d3011 devel: use default-date config field when creating obsmarkers
Also use the default-date when creating obsmarkers. Currently they are created
with the current date and without any option to force their value.

To test the feature, we remove some of the many 'glob' used to match obsmarker
date in the tests.
2017-05-19 12:08:47 +02:00
Pierre-Yves David
b50d7d0364 obsolete: test an important corner case
Receiving markers affecting changeset we'll receives later is legitimate and
not so uncommon case. Working on cache highlighted that this was only testing
in the evolve extension. We add a test for this case in core.
2017-05-21 13:49:48 +02:00
Pierre-Yves David
1d69629fff obsmarker: add an experimental flag controlling "operation" recording
It seems better to introduce the experiment behind a flag for now as there are
multiple concerns around the feature:

 * Storing operation increase the size of obsolescence markers significantly
   (+10-20%).

 * It performs poorly when exchanging markers (cannot combine command names,
   command name might be unknown remotely, etc)
2017-05-20 03:10:23 +02:00
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Durham Goode
77dcefda06 obsolete: add operation metadata to rebase/amend/histedit obsmarkers
By recording what operation created the obsmarker, we can show very intuitive
messages to the user in various UIs. For instance, log output could have
messages like "Amended as XXX" to show why a commit is old and has an 'x' on it.

     @  ac28e3  durham
    /   First commit
   |
   | o  d4afe7 durham
   | |  Second commit
   | |
   | x  8e9a5d (Amended as ac28e3)  durham
   |/   First commit
   |
2017-05-09 16:29:31 -07:00
Denis Laxalde
f25fa2b8d5 summary: display obsolete state of parents
Extend the "parent: " lines in summary to display "(obsolete)" when the parent
is obsolete.
2017-03-25 11:30:08 +01:00
Denis Laxalde
aaf9382123 templates: add "changeset.obsolete" label in command line style
Following respective change in cmdutil.changeset_printer.
2017-03-25 10:40:29 +01:00
Denis Laxalde
5f616436cb templatekw: add an "obsolete" keyword
Definition is the same as the one in evolve extension.
2017-03-25 10:34:11 +01:00
Matt Harbison
30b3d45911 test-obsolete: stabilize output on platforms without 'serve' support
The conditional was updating the repository, which wasn't reflected in
subsequent logs on Windows, so the conditional is narrowed to just the serve
commands.  The serve operation generates log files, so those are deleted to keep
the output of summary consistent.
2017-01-08 14:37:44 -05:00
Denis Laxalde
5e3ca8d1ab summary: add evolution "troubles" information to summary output
Extend the "parent: " lines in summary with the list of evolution "troubles"
in parentheses, when the parent is troubled.
2017-01-06 14:35:22 +01:00
Denis Laxalde
b2aed04403 templates: display evolution "troubles" in command line style 2017-01-06 13:50:52 +01:00
Denis Laxalde
0c89f1cb3e templatekw: add a "troubles" template keyword
The "troubles" template keyword returns a list of evolution troubles.
It is EXPERIMENTAL, as anything else related to changeset evolution.

Test it in test-obsolete.t which has troubled changesets.
2017-01-06 13:50:16 +01:00
Denis Laxalde
1bc2883779 test: test "trouble: " line in log output with multiple troubles
Follow-up on 38b8a4a2230c.
2017-01-06 15:48:22 +01:00
Mads Kiilerich
38cb771268 spelling: fixes of non-dictionary words 2016-10-17 23:16:55 +02:00
Yuya Nishihara
7105924c83 debugobsolete: add formatter support (issue5134)
It appears that computing index isn't cheap if --rev is specified. That's
why "index" field is available only if --index is specified.

I've named marker.flags() as "flag" because "flags" implies a list or dict
in template world.

Thanks to Piotr Listkiewicz for the initial implementation of this patch.
2016-08-15 16:07:55 +09:00
Pierre-Yves David
a8616bb250 tests: remove all remaining usage of experimental.bundle2-exp
The only remaining usage of the experimental config were enforcing bundle2 on.
These are very old remains of when bundle2 was off by default. This was also
useful to highlight the fact that this was a bundle2 run and that a bundle1 one
was nearby. However, we want a future developer working on bundle3 to notice
possible output/behavior change on these tests and take them in account.  So we
do not enforce bundle2 for these runs. We leave a comment around to make sure
dev still notice the bundle1 version.
2016-08-03 15:52:11 +02:00
Pierre-Yves David
4f85aaaa06 tests: remove bundle2 activation from test-obsolete.t
This is an old config that predate bundle2 on by default. This should have been
remove after Mercurail 3.6 got released.
2016-08-02 03:53:17 +02:00
Augie Fackler
5a2af0bc22 bookmarks: properly invalidate volatile sets when writing bookmarks
This corrects a regression introduced during the 3.7 cycle, but which
went undetected due to the surviving-but-deprecated write() method on
bmstore.
2016-05-04 22:44:30 -04:00
Augie Fackler
eb85279af2 test-obsolete: update extension in test to actually work
This hasn't been testing anything since partway through the 3.7 cycle
due to unrelated refactoring. Sadly, the behavior it was trying to
prevent reemerged in the codebase at that time. A fix is in the next
patch, because proving that the fix was actually correct ended up
being trickier than I expected.
2016-05-05 15:41:37 +02:00
Kostia Balytskyi
ab0e2307c2 debugobsolete: style fixes to debugobsolete that slipped from original commit 2016-04-12 03:40:53 -07:00
Kostia Balytskyi
500aca2389 commands: make --rev and --index compatible in debugobsolete 2016-04-04 02:05:10 -07:00
Kostia Balytskyi
379ba461ec commands: allow debugobsolete to delete arbitrary obsmarkers
Sample usage is:
  '$ hg debugobsolete --delete 0 5'

This is a debug feature that will help people working on evolution and
obsolescense.
2016-04-01 15:12:50 -07:00
Kostia Balytskyi
35f0e5c575 debugobsolete: add an option to show marker index
A bigger picture is the ability to be delete an arbitrary marker form the
repo's obsstore. This is a useful debug ability and it needs a way to indentify
the marker one wants to delete. Having a marker's index provides such an
ability.
2016-03-23 10:50:24 -07:00
Jun Wu
ef33508a32 tests: explicitly flush output streams
Some tests fail while running with chg because they do not flush their output
streams. chgserver will make sure ui.flush is called after dispatch, but not
after {ui,repo}setup. For other non-ui streams, it should be explicitly
flushed since the request handler will use os._exit.
This patch adds explicit flushes in test-bundle2-format.t, test-extension.t
and test-obsolete.t. It will fix most test cases of them when running with chg.
2016-03-15 09:51:42 +00:00
Pierre-Yves David
f3fd960eb3 bundlerepo: properly handle hidden linkrev in filelog (issue4945)
The bundlerepository have to do some special magic to handle linkrev of the
bundlerepo filerev. That logic was done from a repoview and obsolescence marker
affecting bundled changeset could lead to a crash. We now ensure we operate on
unfiltered repository.
2016-02-22 18:35:40 +01:00
Matt Harbison
822532f3d1 test-obsolete: conditionalize a test dependent on chmod 2016-01-20 21:56:37 -05:00
Laurent Charignon
7dcb9bf272 repoview: fix corrupted hiddencache crash Mercurial (issue5042)
Before this patch if the hiddencache existed but was empty, it would crash
mercurial. This patch adds exception handling when reading the hiddencache to
avoid the issue.
When encountering a corrupted cache file we print a devel warning. There would
be no point in issuing a normal warning as the user wouldn't be able to do
anything about the situation.

The warning looks like:

devel-warn: corrupted hidden cache, removing it at: /path/to/repoview.py
2016-01-20 13:43:01 -08:00
Matt Harbison
f079641319 summary: print unstable, bumped and divergent as unconditionally plural
This aligns with the unconditional plural output for the update line contents,
as well as the incoming/outgoing bookmarks line.  It also matches the message
in evolve's summary hook as of 4f83b2d2d20d.  (Though I thought this was removed
recently?)
2016-01-11 21:00:29 -05:00
Laurent Charignon
4309e7ad61 summary: add troubles list to the output of hg summary
This patch adds troubles information to the output of hg summary.
Example line displayed in hg summary:
unstable: 1 changeset
2015-12-14 11:19:48 -08:00
Pierre-Yves David
c33f182029 discovery: properly filter changeset in 'peer.known' (issue4982)
The 'peer.known' call (handled at the repository level) was applying its own
manual filtering (looking at phases) instead of relying on the repoview
mechanism. This led to the discovery finding more "common" node that
'getbundle' was willing to recognised. From there, bad things happen, issue4982
is a symptom of it. While situations like described in issue4982 can still
happen because of race conditions, fixing 'peer.known' is important for
consistency in all cases.

We update the code to use 'repoview' filtering. This lead to small changes in
the tests for exchanging obsolescence marker because the discovery yields
different results.

The test affected in 'test-obsolete-changeset-exchange.t' is a test for
issue4982 getting back to its expected state.
2015-12-02 16:12:15 -08:00
Pierre-Yves David
614f88221e test: add an extra base changeset in test-obsolete.t
A fix to issue4982 (not fixed in this patch) will reinforce the filtering
during discovery. This will makes two of our test repositories appear
unrelated (because all common content is properly hidden). To avoid this, we
introduce an extra base changeset that will not get obsoleted. This affects
various test output so we put this addition in its own changeset.
2015-12-09 14:22:57 -08:00
Laurent Charignon
887ad23366 repoview: invalidate 'visible' filtered revisions when bookmarks change
Context: the result of computehidden, used to compute the 'visible' revisions
is cached. Its output can change when:
1) new obsolete commits are created
2) new bookmarks are created or deleted
3) new tags are created or deleted
4) the parents of the working copy change

We currently correctly invalidate the cache only in the case 1).
This patch fixes the second case (bookmarks) by invalidating the cache once
a bookmark is added or removed.
2015-06-13 00:51:43 -07: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
6f02e2ecd7 test: use bundle2 for exchange in test-obsolete
The bundle2 version of obsmarkers exchange is more informative. Switching to
bundle2 by default will change the output of this tests. To reduce the noise
when switching bundle2 to the default protocol, we migrate this tests early.
2015-05-27 04:21:39 -07:00
Laurent Charignon
325752fd5c changelog: fix bug in heads computation
This patch refactors the native computation of heads. It fixes a bug where
filtered heads in the pending index could be returned by the native code
despite their filtering.
2015-05-26 12:09:04 -07:00
Pierre-Yves David
96cf5ab0aa obsolete: sort obsmarkers during exchange
Because bundle2 allows a more precise exchange of obsmarkers during pull, it
sends them in a different order (previously unstable because of sets.)  As
a result, they are added to the repository in a different order. To stabilize
the order and ensure tests are unchanged when moving from bundle1 to bundle2 we
sort markers when exchanging them.

In the long run, the obsstore will probably not use a linear storage.
2015-05-10 06:48:08 -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
Yuya Nishihara
dcadb4da71 bundlerepo: disable filtering of changelog while constructing revision text
This avoids the following error that happened if base revision of bundle file
was hidden. bundlerevlog needs it to construct revision texts from bundle
content as revlog.revision() does.

  File "mercurial/context.py", line 485, in _changeset
    return self._repo.changelog.read(self.rev())
  File "mercurial/changelog.py", line 319, in read
    text = self.revision(node)
  File "mercurial/bundlerepo.py", line 124, in revision
    text = self.baserevision(iterrev)
  File "mercurial/bundlerepo.py", line 160, in baserevision
    return changelog.changelog.revision(self, nodeorrev)
  File "mercurial/revlog.py", line 1041, in revision
    node = self.node(rev)
  File "mercurial/changelog.py", line 211, in node
    raise error.FilteredIndexError(rev)
  mercurial.error.FilteredIndexError: 1
2015-04-29 19:47:37 +09:00
Pierre-Yves David
c24d1f37c9 obsolete: experimental flag to get debug about obsmarkers exchange
The obsolescence markers exchange is still experimental. We (developer) need
more information about what is going on. I'm adding an experimental flag to add
display the amount of data exchanged during bundle2 exchanges.
2015-04-14 11:44:04 -04:00
Yuya Nishihara
7de01412a9 archive: look for first visible revision to build repo identity (issue4591)
No test for the case where all revisions are hidden because "archive" command
aborts if the target revision is null.
2015-04-08 23:30:02 +09:00
Pierre-Yves David
cb0663a537 localrepo: back out changeset 39c37a1a9e2d
Running the tags function filtered will lead to different results with different
filter levels. This seems too dangerous to be done blindly as 39c37a1a9e2d did.
2015-03-05 14:42:25 -08:00