Commit Graph

22502 Commits

Author SHA1 Message Date
Martin von Zweigbergk
9df9b5260f fetch: use cmdutil.bailifchanged()
Use the existing method cmdutil.bailifchanged() instead of
implementing it again in fetch.py. An effect of this is that the error
messages in case of uncommited changes will be different.
2014-10-01 14:48:42 -07:00
Matt Mackall
6712145426 ui: fix comment about non-interactive prompts
This fixes my earlier in-flight addition to Mads' change.
2014-10-02 18:00:05 -05:00
Yuya Nishihara
f8be8539d4 formatter: convert booleans to json
It will be used in branches output.
2014-10-02 23:20:59 +09:00
Mads Kiilerich
031ab4d02f merge: mute the status message when bid merge kicks in
Bid merge is now the default and it is not necessary to tell the user that an
experimental feature kicked in.

(It could however still be relevant to get a notice that it is one of the rare
criss-cross merge situations so the user is warned that the situation is more
tricky than usual.)
2014-10-01 03:42:00 +02:00
Mads Kiilerich
9ecbab9de8 merge: use bid merge by default (BC)
In most cases merges will work exactly as before.

The only difference is in criss-cross merge situations where there is multiple
ancestors. Instead of picking an more or less arbitrary ancestor, it will
consider both ancestors and pick the best bids.

Bid merge can be disabled with --config merge.preferancestor='!'.
2014-10-01 03:41:11 +02:00
Mads Kiilerich
b4b06de04d changectx: skip all invalid merge.preferancestor values
A better fix for 0e1533a3ded2 that will ignore other kinds of "invalid"
revisions.
2014-10-01 03:40:51 +02:00
Pierre-Yves David
2a8200e655 revset: rely on built in iterator when possible in _generatorset.__iter__
Doing manual iteration is expensible. We rely on built in list iteration
whenever possible. The other case has to become a closure we cannot have a both
yield and return in the same function.
2014-04-30 16:56:23 -07:00
Pierre-Yves David
c6262025ca revset: prefetch an attribute in _generatorset.__iter__
Python's attribute lookup are expensible, lets do less of them.

This gives us a 7% speedup on this revset iteration (from 0.063403 to 0.059032)
2014-09-18 15:52:45 -07:00
Anton Shestakov
ca791cb0ef templater: add count template filter, plus tests
Previously there was no way of telling how much children or bookmarks or tags a
certain changeset has in a template. It was possible to tell if a changeset has
either 0 or not 0 bookmarks, but not to tell if it has 1 or 2 of them, for
example.

This filter, simply named count, makes it possible to count the number of items
in a list or the length of a string (or, anything that python's len can count).
E.g.: {children|count}, {bookmarks|count}, {file_adds|count}.

Testing the filter on node hash and shortened node hash is chosen because they
both have defined length.

As for lists of strings - children, tags and file_adds are used, because they
provide some variety and also prove that what's counted is the number of string
items in the list, and not the list stringified (they are lists of non-empty,
multi-character strings).

Additionally, revset template function is used for testing the filter, since
the combination is very flexible and will possibly be used together a lot.

(The previous version of this patch had an incorrect email subject and was
apparently lost - patchwork says the patch has been accepted, but it's not so.
The changes between that and this patch are minimal: now the filter does not
disturb the alphabetical order of function definitions and dict keys.)
2014-09-09 22:14:13 +09:00
Pierre-Yves David
5b3e8ffd67 push: update bookmarks (on server) within a transaction
A nice side effect is that bookmarks sent through bundle2 are updated within the
same transaction as all other changes.
2014-09-28 17:35:33 -07:00
Pierre-Yves David
6638ea8bec pull: perform bookmark updates in the transaction 2014-09-28 15:21:38 -07:00
Pierre-Yves David
ab55792aad bookmark: add a bmstore.recordupdate to plug bookmarks into the transaction
Instead of manually writing bookmarks when they are updated, we can just record this
update to the transaction and rely on it to update the on-disk file.
2014-09-28 00:41:55 -07:00
Pierre-Yves David
6ae3ea078a bookmarks: split bookmark serialization and file handling
If we want to handle bookmarks in a transaction we need to decouple the file
handling and the actual production of the content. This is similar to how we
handle phases in transaction.
2014-09-27 03:10:33 -07:00
Pierre-Yves David
12b0405a08 transaction: allow generating file outside of store
We allow a vfs argument to `addfilegenerator`. This allows generating files outside
of the store directory like bookmarks. However, this is not really working since
we do not have the infrastructure to backup and restore files outside of store.
By chance, the bookmark file is already backed up by another mechanism so we can
restrict this new feature to bookmarks (which is our only interest here) and
proceed.
2014-09-28 00:36:42 -07:00
Pierre-Yves David
a80cda9824 transaction: work around and document issue with file backup
The backup restoration is actually hard-coded for the main file. And this
hard-coded list is the only one used when repairing an interrupted transaction
from another process.

Solving this problem is out of the scope of this series so we document it and
work around its implications.
2014-10-01 21:40:44 -05:00
Pierre-Yves David
1bbca4d386 bundle2: remove an explicit packing
The final writing of the empty part was done explicitly. We now using proper
pack call using symbolic constant. This open simple change in the bundle2
format.
2014-10-02 00:15:15 -05:00
Pierre-Yves David
ba05aeb114 bundle2: split test in two
We split the test between the one dedicated to the binary format and the one
dedicated to checking the exchange of data using pull and push.
2014-10-01 23:55:22 -05:00
Pierre-Yves David
23ce37ca7e pull: merge bookmark updates and imports
We do all the things in one go now, updating existing bookmark, adding new ones,
and overwriting the ones explicitly specified for --bookmark. This impacts the
tests by removing some duplicated or unnecessary output.
2014-09-28 14:07:56 -07:00
Pierre-Yves David
3cfceb8bab pull: gather explicit bookmark pulls with bookmark updates
There is no reason to make them at different times. So we gather them. This is
the first step toward merging them.
2014-09-28 13:43:31 -07:00
Pierre-Yves David
627aeb8b3f subrepo: stop pulling bookmark manually
Bookmark pulling is now done with all the other pull steps in the
`exchange.pull` function.
2014-09-28 12:47:25 -07:00
Pierre-Yves David
610acb031e pull: retrieve bookmarks through bundle2
We can retrieve any pushkey namespace through bundle2. So we also ask for
bookmark data and use them to update the local repo.
2014-09-27 01:59:56 -07:00
Pierre-Yves David
d09b1b6f90 pull: retrieve bookmarks before obsmarkers
Retrieving bookmarks before obsmarkers will avoid turning some changesets hidden
right before making them visible again if a bookmark keeps them visible.
2014-09-27 01:37:56 -07:00
Pierre-Yves David
81f4fc06a6 pull: move bookmark pulling into its own function
This requires adding an attribute on the pulloperation object. The bookmark
pulling is protected behind a "todostep" as other steps of pull.
2014-09-27 01:31:15 -07:00
Pierre-Yves David
0a11dabe30 pull: perform the todostep inside functions handling old way of pulling
This matches what is done during push.
2014-09-27 01:34:02 -07:00
Pierre-Yves David
c80fa5e562 bookmark: remove now unused pushtoremote function
Everything is unified in the push discovery now.
2014-09-26 23:04:35 -07:00
Pierre-Yves David
f69b4810ae push: gather all bookmark decisions together
The discovery phases for bookmarks now use the list of explicitly pushed bookmarks
to do addition, removal and overwriting.

Tests are impacted because this reduces the amount of listkeys calls issued, removes
some duplicated messages and improves the accuracy of some messages.
2014-09-27 20:51:53 -07:00
Pierre-Yves David
198e8354e8 push: prepare the issue of multiple kinds of messages
To gather all the bookmark pushing actions together, we need code performing
those actions to be ready for them. We need to be able to produce different
messages for different actions.
2014-09-26 18:33:11 -07:00
Pierre-Yves David
61fb24aaa1 push: set bkresult when pushing bookmarks through bundle2 2014-10-02 13:19:49 -05:00
Pierre-Yves David
f84dab4656 clone: remove duplicated bookmark pulling
Now that all clone methods (copy, pull and push) also transport bookmarks, we can
safely drop the manual pulling that was performed during clone.
2014-09-26 13:56:20 -07:00
Pierre-Yves David
c27d2d3986 clone: explicitly push bookmarks when cloning from local to remote
We need to explicitly push all local bookmarks when doing the clone from a local
repo to a remote one through ssh. This will let us remove the manual export of
bookmarks in clone and rely on the official exchange in push and pull instead.
2014-09-26 15:15:49 -07:00
Pierre-Yves David
ef04e1697d clone: copy .hg/bookmarks during copy clone
Now that the standard pull function includes bookmarks, we need to ensure that
a copy clone also copies the bookmarks. This will let us drop the manual bookmark
pulling done independently during a clone.
2014-09-26 13:55:53 -07:00
Pierre-Yves David
627b3886af pull: move bookmark movements inside the exchange.pull
There is no reason for bookmarks to get a special treatment. As a first step we
move the code as is in the `exchange.pull` function. Integration with the rest
of the flow will come later.

Adding bookmarks to pull means that most clone paths are now pulling bookmarks
through pull. We ensure that bookmark-update messages are properly suppressed in
that case.

In test-pull-http.t the 'requesting all changes' message disappear because we
now get the authentication error on the `listkeys`command before such message
is printed.
2014-09-26 17:44:00 -07:00
Pierre-Yves David
3560be20d0 bookmarks: allow updatefromremote to be quiet
This will be useful to use the function during clone (clone is not printing any
bookmark data right now)
2014-10-02 12:16:07 -05:00
Pierre-Yves David
60ead8ca90 util: fix sorteddict.pop
When using `.pop` on such object the list was not cleared of the popped key,
leading to crash.
2014-10-02 12:39:37 -05:00
Pierre-Yves David
f7c8a82ddd localrepo: pass arbitrary kwargs from repo.pull to exchange.pull
We'll add bookmark-related arguments to `repo.pull` so we need to widen the
signature of `repo.pull`. We should probably kill `repo.pull` now that
`repo.push` is dead but this is outside the scope of this series.
2014-09-26 12:51:55 -07:00
Pierre-Yves David
c7f20ea1f1 pull: use other.url() as the source of a bookmark pull
We want to move the bookmarks movement into `exchange.pull`, for this purpose we
need to stop relying on variables from `command.pull`.
2014-09-26 10:59:29 -07:00
Kyle Lippincott
15ea39170d setup: set mode 644 or 755 on installed files 2014-09-30 17:13:54 -07:00
Yuya Nishihara
deb7a2b54f branches: reduce nesting in for loop 2014-10-02 21:58:10 +09:00
Mads Kiilerich
e49fb83975 i18n: use datapath for i18n like for templates and help
To avoid circular module dependencies we initialize i18n from util when
datapath is found.
2014-09-28 16:57:47 +02:00
Mads Kiilerich
634a855966 help: don't search randomly for help data - trust util.datapath
The search was introduced in 73b7669a499c without a convincing explanation why
it should be necessary ... except for consistency with templater handling.

Now, just keep it simple.
2014-09-28 16:57:47 +02:00
Mads Kiilerich
3326c1de0b templater: don't search randomly for templates - trust util.datapath
The search was introduced in 501e9ec9a85d. It might have been necessary back
then when using __file__ directly and frozen-ness wasn't considered. Now we
should know exactly where the templates can be found.
2014-09-28 16:57:37 +02:00
Mads Kiilerich
74b470ec55 templater: inline global 'path' list in templatepaths 2014-09-28 16:57:37 +02:00
Mads Kiilerich
374f35aab5 templater: introduce templatepaths for getting paths searched for templates
Avoid function with different return types depending on parameters.
2014-09-28 16:57:37 +02:00
Mads Kiilerich
e9c0145df2 util: introduce datapath for getting the location of supporting data files
templates, help and locale data is normally stored as sub folders in the
directory containing the source of the mercurial module. In a frozen build they
live as sub folders next to 'hg.exe' and 'library.zip'.

These different kind of data were handled in different ways. Unify that by
introducing util.datapath. The value is computed from the environment and is
always used, so we just calculate the value on module load.
2014-09-28 16:57:06 +02:00
Mads Kiilerich
9b9c077bd6 util: move _hgexecutable a few lines, closer to where it is used 2014-09-28 16:57:06 +02:00
Andrew Shadura
e7903979d4 hgk: define bookmark colour explicitly, as Tk 8.6 has changed their meaning 2014-09-28 13:27:40 +02:00
Martin von Zweigbergk
2b8c50650e largefiles: remove 'forget' list that's always empty 2014-09-30 14:32:49 -07:00
Matt Mackall
667f516d70 bookmarks: fix divergent bookmark path normalization 2014-10-02 16:43:50 -05:00
Matt Mackall
8956f42fc4 exchange: remove a broken i18n abuse 2014-10-02 11:35:20 -05:00
Pierre-Yves David
6d9b081f23 bookmark: make the search for divergent names more robust
We translate the "url we update from" and "the url in the config" into their
canonical representation. This is useful for urls that have multiple equivalent
forms:

  /foo/bar/ == file:/foo/bar/ == file:///foo/bar


eg: hg pull --config path.bar=/foo/bar/ file:/foo/bar
2014-09-26 11:31:15 -07:00