Commit Graph

22787 Commits

Author SHA1 Message Date
Mike Hommey
9962a81363 bundle2: merge return values when bundle contains multiple changegroups
A bundle2 may contain multiple parts adding changegroups, in which case there
are multiple operation records for changegroups, each with its own return
value. Those multiple return values are aggregated in a single cgresult value
for the whole operation.

As can be seen in the associated test case, the situation with hooks is not
really the best, but without deeper thoughts and changes, we can't do much
better. Hopefully, things will be improved before bundle2 is enabled by default.
In the meanwhile, multiple changegroups is not expected to be in widespread
use, and even less expected to be used for pushes. Also, not many clients
cloning or pulling bundle2 with multiple changesets are not expected to have
changegroup hooks anyways.
2014-10-16 16:03:04 +09:00
Mike Hommey
14669879bf changegroup: use a copy of hookargs when invoking the changegroup hook
addchangegroup creates a runhook function that is used to invoke the
changegroup and incoming hooks, but at the time the function is called,
the contents of hookargs associated with the transaction may have been
modified externally. For instance, bundle2 code affects it with
obsolescence markers and bookmarks info.

It also creates problems when a single transaction is used with multiple
changegroups added (as per an upcoming change), whereby the contents
of hookargs are that of after adding a latter changegroup when invoking
the hook for the first changegroup.
2014-10-16 15:54:53 +09:00
Mike Hommey
7dcde933f1 tests: pull common http server setup out of individual tests
There are currently two different tests using roughly the same code to
create temporary scripts acting as HTTP servers. As there is going to
be at least one more in an upcoming change, factor those out in a
standalone dumbhttp.py script.
2014-10-16 13:48:51 +09:00
Mike Hommey
9741dad0cc util: move md5 back next to sha1 and allow to call it without an argument
This effectively backs out changeset 7582042d6cce.

The API change is done so that both util.sha1 and util.md5 can be called the
same way. The function is moved in order to use it for md5 checksumming for
an upcoming bundle2 feature.
2014-09-24 16:00:47 +09:00
Pierre-Yves David
35dd781a8f test-bundle2-exchange: do not drop HG_NODE from the hook output
HG_NODE is precisely something we would like to test.
2014-10-16 03:22:51 -07:00
Durham Goode
34fbe659db obsolete: update test-commit-amend to use obsolete option
This test actually used the obs.py file as part of the test, so we need to fix
up the test a little more than usual to work with the new obsolete option flags.
2014-10-14 13:34:57 -07: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
Durham Goode
73a4415474 obsolete: prevent options from being used without createmarkers
exchange and allowunstable should only be enabled if createmarkers is enabled,
so check for that and raise an exception if that's not the case.
2014-10-14 13:27:00 -07:00
Durham Goode
bbb89aae08 obsolete: add exchange option
This adds an option that enables obsolete marker exchange.
2014-10-14 13:26:01 -07:00
Durham Goode
faa1c33f8b obsolete: add allowunstable option
This option allows the creation of unstable commits. This allows things like
amending in the middle of a stack of commits, etc.
2014-10-14 13:25:13 -07:00
Durham Goode
18f3737f3a obsolete: add createmarkers option
The basic obsolete option is allowing the creation of obsolete markers. This
does not enable other features, such as allowing unstable commits or exchanging
obsolete markers.
2014-10-14 13:23:52 -07:00
Durham Goode
122b7f93b8 obsolete: add readonly flag to obstore constructor
Previously, obstore read the obsolete._enabled flag to determine whether to
allow writes to the obstore. Since obsolete._enabled will be moving into a repo
specific config, we can't read it globally, and therefore must pass the
information into the constructor.
2014-10-14 13:20:31 -07:00
Durham Goode
a10734d5ff obsolete: add isenabled function for option checking
Previously, obsolete used the module level _enabled flag to determine whether it
was on or off. We need a bit more granular control, so we'll be introducing
toggle options. The isenabled() function is how you check if a particular option
is enabled for the given repository.

Future patches will add options such as 'createmarkers', 'allowunstable', and
'exchange' to enable various features of obsolete markers.
2014-10-14 13:17:35 -07:00
Durham Goode
2cf7601f2f obsstore: fix defaultformat option passing
The obsstore format passing was not actually being passed to the obsstore. This
fixes it.
2014-10-15 12:52:10 -07:00
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
Augie Fackler
93ba5c156b checklink: always close the NamedTemporaryFile
This fixes test-patchbomb.t when using pypy with --pure.
2014-10-15 15:13:43 -04:00
Angel Ezquerra
5ba2d3ae3d hgignore: ignore the PyCharm workspace folder 2014-10-13 11:46:04 +02:00
Mads Kiilerich
4353d6acbb revset: better naming of variables containing the value of a single argument
Calling them args is not helpful.
2014-10-15 04:08:06 +02:00
Augie Fackler
351b53f5d8 manifest: add docstring to text() method 2014-10-14 14:42:25 -04:00
Augie Fackler
9afa9a909c manifest: rename ambiguously-named set to setflag
Just makes it a little clearer what this method does.
2014-10-10 14:09:37 -04:00
Pierre-Yves David
2a99e9b2bc bookmarks: inform transaction-related hooks that some bookmarks were moved
We do not have enough information to provide any finer data, but this is still
useful information.
2014-10-12 08:29:31 -07:00
Pierre-Yves David
578b6cd317 phases: inform transaction-related hooks that a phase was moved
We do not have enough information to provide finer data, but this is still
useful information.
2014-10-12 08:03:20 -07:00
Pierre-Yves David
d263d9b9dc test-bundle2: also test the argument of the changegroup hook
We also track execution of the changegroup hook. The important information here
is to make sure the information that the transaction was processing a bundle2 is passed to
hook. This will let most hooks disable themselves while waiting for the hook
concluding bundle2 processing (the one we discovered to be not called for
pull in the previous changesets).
2014-10-13 14:52:38 -07:00
Pierre-Yves David
5f82cb2ba2 test-bundle2: test that we got appropriate hook called with appropriate data
We can notice that this transaction wide hook is only happening during push and
it is missing changegroup-related information. We'll want to fix this but this
is not what this patch is about.
2014-10-13 14:47:36 -07:00
Pierre-Yves David
7e076db46b pull: use stepsdone instead of todosteps
The push process uses a `stepsdone` attribute instead of a `todosteps` one (with
the logic swapped). We unify the two process by picking the `stepsdone` version.
I feel like `stepsdone` better fits extensions that would want to extend the push
exchange process.
2014-10-12 06:40:36 -07:00
Pierre-Yves David
b60194b959 pull: make discovery phase extensible
We apply the same approach as for push and make the discovery extensible. There
is only one user in core right now, but we already know we'll need something
smarter for obsmarkers. In fact the evolve extension could use this to cleanly
extend discovery.

The main motivation for this change is consistency between push and pull.
2014-09-27 00:29:06 -07:00
Yuya Nishihara
187868d5fe sshpeer: forward stdout of remote "hg init" to appropriate output channel
Otherwise, commandserver channel could be corrupted.
2014-10-14 21:59:39 +09:00
Mike Edgar
ba052f742a revlog: support importing censored file revision tombstones
This change allows a revision log to not fail integrity checks when applying a
changegroup delta (eg from a bundle) results in a censored file tombstone. The
tombstone is inserted as-is, so future integrity verification will observe the
tombstone. Deltas based on the tombstone will also remain correct.

The new code path is encountered for *exactly* the cases where _addrevision is
importing a tombstone from a changegroup. When committing a file containing
the "magic" tombstone text, the "text" parameter will be non-empty and the
checkhash call is not executed (and when committing, the node will be computed
to match the "magic" tombstone text).
2014-09-03 16:34:29 -04:00
Mike Edgar
49d296f5b7 verify: report censored nodes if configured policy is abort 2014-10-14 16:16:04 -04:00
Mike Edgar
7403ba126b context: handle censored data in an on-disk file context based on config
Two possible behaviors are defined for handling censored data: abort, and
ignore. When we ignore censored data we return an empty file to callers
requesting the file data.
2014-10-14 15:46:16 -04:00
Augie Fackler
d6a88c8e25 manifest: add fastdelta method to manifestdict
This is another step closer to alternate manifest implementations that
can offer different hashing algorithms.
2014-10-08 15:20:14 -04:00
Augie Fackler
6e25316a67 manifest: move _search to module level and rename to _msearch
The rename is intended to provide a slight hint that it is
manifest-specific.
2014-10-08 15:21:59 -04:00
Augie Fackler
6d53ff9d24 manifest: move manifestdict-to-text encoding to manifest class
A future patch will introduce a new format, with a new class.
2014-10-08 14:47:30 -04:00
Martin von Zweigbergk
7a97abf550 localrepo: access status fields by name rather than index 2014-10-03 13:22:31 -07:00
Martin von Zweigbergk
70f1c6600d subrepo: use separate instances of empty lists in status
We do modify the lists that make up the status in several places, so
it seems risky to use the same instance of a list for several
different status types. Use a separate empty list for each type
instead.
2014-10-11 22:43:14 -07:00
Martin von Zweigbergk
85328e2d45 summary: make status code more readable
In commands.summary(), we currently zip a list of labels with a list
of statuses. This means the order of the status list has to match the
list of the labels, which in turn means the status elements have to be
inserted into specific places in the list. Let's instead group the
labels and status data we want to display in a single list of pairs.
2014-10-03 09:29:48 -07:00
Martin von Zweigbergk
c20daf914f strip: make checklocalchanges() return full status tuple
By making checklocalchanges() return the full instance of the status
class instead of just the first 4 elements of it, we can take
advantage of the field names and not require the caller to remember
the element indices.
2014-10-04 20:53:05 -07:00
Martin von Zweigbergk
05e97c1d55 fileset: access status fields by name rather than index 2014-10-04 21:58:01 -07:00
Martin von Zweigbergk
c8176c1f40 histedit: access status fields by name rather than index 2014-10-04 21:19:44 -07:00
Martin von Zweigbergk
7287633c8c shelve: access status fields by name rather than index 2014-10-03 22:12:43 -07:00
Martin von Zweigbergk
5ea3a9fbd3 record: access status fields by name rather than index
It is safe to pass the full status to patch.diff() since it does its
own slicing.
2014-10-03 10:44:07 -07:00
Martin von Zweigbergk
cb32fc3c29 purge: access status fields by name rather than index 2014-10-03 10:38:43 -07:00
Martin von Zweigbergk
6f453479df largefiles: access status fields by name rather than index 2014-10-03 22:10:08 -07:00
Martin von Zweigbergk
2565ab5473 keyword: access status fields by name rather than index 2014-10-03 10:05:54 -07:00
Martin von Zweigbergk
477ec46ab8 hgcia: access status fields by name rather than index 2014-10-03 09:51:39 -07:00
Martin von Zweigbergk
011cf39cde context: store status class instead of plain tuple in self._status
This improves readability a bit by allowing us to refer to statuses by
name rather than index.
2014-10-04 21:05:41 -07:00
Martin von Zweigbergk
8b968ecfe2 status: update and move documentation of status types to status class
The various status types are currently documented on the
dirstate.status() method. Now that we have a class for the status
types, it makese sense to document the status types there
instead. Only leave the bits related to lookup/unsure in the status()
method documentation.
2014-10-10 10:14:35 -07:00
Martin von Zweigbergk
8961a5a15c status: update various other methods to return new class 2014-10-14 00:52:27 -05:00
Martin von Zweigbergk
41a4138ec7 status: create class for status lists
Callers of various status() methods (on dirstate, context, repo) get a
tuple of 7 elements, where each element is a list of files. This
results in lots of uses of indexes where names would be much more
readable. For example, "status.ignored" seems clearer than "status[4]"
[1]. So, let's introduce a simple named tuple containing the 7 status
fields: modified, added, removed, deleted, unknown, ignored, clean.

This patch introduces the class and updates the status methods to
return instances of it. Later patches will update the callers.

 [1] Did you even notice that it should have been "status[5]"?

(tweaked by mpm to introduce the class in scmutil and only change one user)
2014-10-10 14:32:36 -07:00
Martin von Zweigbergk
0daa605421 lfutil: avoid creating unnecessary copy of status tuple
In lfdirstatestatus(), the status tuple gets deconstructed, the lists
get updated, and then an identical status tuple gets created and
returned. Change it so we simply return the original tuple.
2014-10-03 21:21:20 -07:00