Commit Graph

30953 Commits

Author SHA1 Message Date
Denis Laxalde
de480b0802 revert: always display hunks reversed when reverting to parent
When reverting to the parent of working directory, operation is "discard" so
we want hunks to be presented in the same order as the diff (i.e. "reversed").
So we do not query the experimental.revertalternateinteractivemode option in
this case and always set "reversehunks" to True.
2017-03-06 14:11:21 +01:00
Pierre-Yves David
a1ad299f67 fileset: add a 'status(...)' predicate to control evaluation context
Same as 'revs', this predicate does not select files but switches the evaluation
context. This allow to match file according arbitrary status call. We can now
express the same query as 'hg status'.

The API (two 'revsingle' class) have been picked instead of a single 'revs'
revset for multiple reasons:

 * it is less confusing to express
 * it allow to express more query (eg: backward status, cross branch status)
2017-03-03 14:08:20 +01:00
Pierre-Yves David
5b29e72b25 fileset: allow to specify a basectx for status
This will be used for a predicates that defines the status range of a match.
2017-03-03 14:08:06 +01:00
Pierre-Yves David
5be5f101f6 fileset: add revs(revs, fileset) to evaluate set in working directory
Unlike other functions, "revs()" does not select files but switches the
evaluation context. This allow to match file with property in another revision
that the one currently evaluated.

This changeset is based on work from Yuya Nishihara.
2017-03-03 12:44:56 +01:00
Yuya Nishihara
123bfcf3e9 fileset: add function to switch revision where fileset will be evaluated
If the subset isn't filtered yet, i.e. if fullmatchctx, the new subset is
recalculated from scratch. Otherwise, it is narrowed by the existing subset.
2015-01-24 19:41:56 +09:00
Yuya Nishihara
19f5256d23 fileset: extract function that builds status tuple only if necessary
This function will be used to recalculate status when mctx.ctx is switched.
2015-01-24 19:13:39 +09:00
Yuya Nishihara
69310d762a fileset: build initial subset in fullmatchctx class 2015-01-24 18:56:02 +09:00
Yuya Nishihara
081bed02eb fileset: extract function that builds initial subset from ctx or status
This function will be used to recalculate subset when mctx.ctx is switched.
2015-03-24 23:10:49 +09:00
Yuya Nishihara
b8e9d7ad88 fileset: add class to host special handling of initial subset
Future patches will add a function to switch mctx.ctx object so that we can
forcibly evaluate a fileset expression in a specified revision. For example,
new "revs()" function will be used to match predicate agains another revision

  $ hg revert 'set:revs(42, added())'

fullmatchctx class is similar to revset.fullreposet. It will allow us to
recalculate the subset only if it is not filtered yet.
2015-01-24 19:55:14 +09:00
Yuya Nishihara
5fab4a9d55 patchbomb: add config knob to generate flags by template (issue5354)
This can be used to flag patches by branch or topic automatically. Flags
optionally given by --flag option are exported as {flags} template keyword,
so you can add --flag V2.
2017-02-25 18:41:00 +09:00
Yuya Nishihara
7697dd4d5b patchbomb: pass around ui and revs that are needed for flag template
See the next patch for why.
2017-02-25 18:35:34 +09:00
Yuya Nishihara
cc7b1af6b2 patchbomb: build patch texts by _getpatchmsgs()
Now _getpatchmsgs() knows revision numbers, which allows us to generate flags
by applying a template to changectx objects.
2017-02-25 18:28:04 +09:00
Yuya Nishihara
2fae5e032d patchbomb: drop internal option for pbranch extension (API)
I want to move _getpatches() to _getpatchmsgs() to make sure each patch text
is tied with the corresponding revision number. This helps adding templater
support.

IIRC, the pbranch extension doesn't work with the recent Mercurial versions,
so the removal of this option wouldn't hurt.
2017-02-25 18:25:17 +09:00
Yuya Nishihara
be15dfae52 patchbomb: factor out function that builds a prefix string to patch subject
I'll add templating support.
2017-02-25 18:16:41 +09:00
Yuya Nishihara
bc9edb1202 formatter: add argument to change output file of non-plain formatter
This allows us to build data not written to the console. That would be
doable by ui.pushbuffer()/popbuffer(), but changing the file object seems
cleaner.
2015-01-18 18:04:44 +09:00
Augie Fackler
3322b24b9d schemes: move re construction to module-level and python3-ify
This makes the schemes extension load correctly in Python 3.
2017-03-03 13:25:30 -05:00
Augie Fackler
601a6ec266 dispatch: cope with sys.version being unicode on Python 3 2017-03-03 13:29:50 -05:00
Augie Fackler
5bdccc39a5 dispatch: allow testedwith to be bytes or str 2017-03-03 13:29:25 -05:00
Augie Fackler
80c3da0d7d ui: fix ui.traceback on Python 3 2017-03-03 14:09:14 -05:00
Augie Fackler
85e23a6604 ui: fix opts labeling on ui.warn et al for Python 3
This is a step towards fixing extension load warnings on Python
3. Note that I suspect there are still some bugs in this area and that
things like color won't work, but the code at least executes and
prints text to the console correctly now.
2017-03-03 14:08:24 -05:00
Augie Fackler
96fc868b4a config: add sanity assert that files are opened as binary
This helps with some debugging in Python 3, and shouldn't hurt
anything in Python 2. The unusual construction using getattr is done
so that StringIO/BytesIO instances can be used as well as real files.
2017-03-03 12:55:11 -05:00
Martin von Zweigbergk
4ad88a61e0 update: for "noconflict" updates, print "conflicting changes" on conflict
With experimental.updatecheck=noconflict, if the update is aborted
because of conlicts, "uncommitted changes" is not quite
accurate. Let's use "conflicting changes" instead. Also fix the hint
to recomment --clean, not --merge, since that's what we do for other
failed updates.
2017-03-06 23:21:27 -08:00
Martin von Zweigbergk
1db93fafc0 tests: fix test-update-branches to remove non-conflicting file
I was clearly very sloppy when I wrote the test case for
experimental.updatecheck=noconflict. The test case that checks that
one can move between commits with a removed file was deleting a file
that was modified between the source and target commits, which
resulted in a "change/delete" conflict. Since that is a conlict, the
update correctly failed. Let's fix the test by removing a file that is
not modified between the two commits.
2017-03-06 23:19:57 -08:00
Yuya Nishihara
7ca440fb7f branches: populate all template keywords in formatter
This is a usage example of fm.context().
2017-02-25 17:08:42 +09:00
Yuya Nishihara
36d684e2c3 formatter: add support for changeset templating
Some formatter-based commands provide fields that are identical to the ones
defined in templatekw, but we had to specify them manually to support all
changeset-based template keywords.

This patch adds fm.context() that populates all templatekw. These keywords
are available only in template output, so we still need to set important
keywords via fm.data() if they should be available in e.g. JSON output.

Currently fm.context() takes only 'ctx' argument. It will eventually be
extended to take 'fctx' to support file-based keywords (e.g. {path}) seen
in hgweb.
2017-02-25 17:00:07 +09:00
Yuya Nishihara
a69b51cf89 templatekw: move defaulttmpl constant from changeset_templater
These templates are used when rendering inner lists of some template keywords,
so it makes sense to define them in templatekw. This allows us to reuse them
to create a templateformatter knowing changectx.
2017-02-25 16:38:26 +09:00
Yuya Nishihara
d9d27f710f formatter: drop filters argument from maketemplater()
It's unused now. I want to keep the high-level API simple.
2017-02-25 22:04:30 +09:00
Yuya Nishihara
e5c5114662 templater: port formatnode filter from changeset_templater
This slightly reduces the difference between changeset_templater and formatter,
and helps extending formatter to support changeset templating.

New formatnode() is not a template filter, but a function since a filter
cannot access to ui. And it's marked as DEPRECATED since I think it exists
only for compatibility reasons.
2017-02-25 16:26:58 +09:00
Martin von Zweigbergk
066bf0dbb3 update: allow setting default update check to "noconflict"
The new value allows update (linear or not) as long as they don't
result in file merges.

I'm hoping that this value can some day become the default.
2017-02-13 00:05:55 -08:00
Martin von Zweigbergk
f4acb206be update: add experimental config for default way of handling dirty wdir
This allows the user to set e.g. experimental.updatecheck=abort to
abort update if the working directory is dirty, but still be able to
override the behavior with e.g. --merge when needed.

I considered adding a --mergelinear option to get back the old
behavior even when experimental.updatecheck=abort is set, but I
couldn't see why anyone would prefer that over --merge.

The default is read in hg.updatetotally(), which means it also applies
to "hg pull -u" and "hg unbundle -u".
2017-02-13 16:03:05 -08:00
Martin von Zweigbergk
5b3eb48725 update: accept --merge to allow merging across topo branches (issue5125) 2017-02-13 12:58:37 -08:00
Martin von Zweigbergk
4904a44779 merge: combine the "merge" cases in docstring table 2017-02-27 15:09:19 -08:00
Martin von Zweigbergk
dbab66ea10 merge: combine "dirty" cases in docstring table 2017-02-27 15:07:01 -08:00
Martin von Zweigbergk
f2dcab33cd merge: clarify non-linear default updates in docstring table
Non-linear updates won't happen by default, regardless of -c/-C.
2017-02-27 15:29:34 -08:00
Martin von Zweigbergk
2230022a53 merge: combine the two "can't happen" cases in docstring table 2017-02-27 15:02:36 -08:00
Martin von Zweigbergk
2b1e4cc1c6 merge: move "incompatible options" case first in docstring table 2017-02-27 15:00:13 -08:00
Martin von Zweigbergk
a3d141c00e merge: make "linear" an input in docstring table
Instead of having two ouputs, it seem simpler to have an addition
input. This will allow further simplification.
2017-02-27 14:58:53 -08:00
Martin von Zweigbergk
1d7591a0e3 merge: drop redundant column in docstring table
The "same" and "cross" columns now have the same values, so let's
combine them into "non-linear".
2017-02-27 14:33:17 -08:00
Martin von Zweigbergk
7fa2f6b954 merge: drop obsolete non-linear cases from docstring table
Since 5a430b57b16e (update: change default destination to tipmost
descendant (issue4673) (BC), 2016-02-02), non-linear updates can no
longer happen if the user doesn't specify a destination, so we can
drop these case from the table in the docstring of merge.update().
2017-02-27 14:27:22 -08:00
Martin von Zweigbergk
ee94a5599f revert: move code dealing with deletions closer together 2016-02-24 14:44:14 -08:00
Augie Fackler
e1ac204a83 ui: fix configlist on Python 3
Since we're working on bytestrings, we have to use [offset:offset+1]
to get consistent behavior on Python 2 and 3. I've only tested the
_parse_plain closure, not the _parse_quote one, but I have no real
reason to expect the latter to be broken since the fixes were fairly
mechanical.
2017-03-03 14:10:06 -05:00
Augie Fackler
96e6b73da5 config: pass some optional args as keywords
This makes it a little more obvious that self.read is being passed as
include, which took me a moment to figure out.
2017-03-03 12:55:49 -05:00
Augie Fackler
4a806db5f5 config: load included config files in binary mode
I guess we've been getting lucky that this works in Python 2. This
fixes loading included config files in Python 3 (it used to fail on
the "somebody set up us the BOM" check.)
2017-03-03 13:28:24 -05:00
Durham Goode
36db5cbc5c manifest: remove _repo from manifestctx objects
We were storing the repo on the manifestctx objects so that they could access
the manifestlog via repo.manifestlog, which would refresh the structure if it
became out of date. This caused probems however when we want to have multiple
manifest logs in memory at once, like when transitioning to tree manifest from
flat manifests, since a tree manifest would try to access sub-trees via
repo.manifestlog[node], which was the flat manifest.

The solution is to just not store the repo, and instead store the manifestlog
that created this context. This removes the invalidation when the in memory
manifestlog becomes out of date, but people should probably not be keeping ctx's
around that long anyway.
2017-03-01 16:39:48 -08:00
Jun Wu
668afd1cbd phases: remove experimental.nativephaseskillswitch
The native code has been used for a long time. Therefore drop the
experimental config option.
2017-03-01 15:50:01 -08:00
Durham Goode
062cc68bf8 manifest: allow specifying the revlog filename
Previously we had hardcoded the manifest filename to be 00manifest.i. In our
external treemanifest extension, we want to allow writing a treemanifest side by
side with a flat manifest, so we need to be able to store the root revisions at
a different location (in our extension we use 00manifesttree.i).

This patches moves the revlog name to a parameter so we can adjust it.
2017-03-01 16:35:57 -08:00
Pulkit Goyal
1da791b8bb py3: drop unrequired code from __init__.py
Once we are using pycompat.open(), we don't need this hack to convert the
second argument to unicodes. So removing this.
2017-03-03 15:30:48 +05:30
Pulkit Goyal
cb0521463d py3: add pycompat.open and replace open() calls
open() requires mode argument as unicodes on Python 3. This patch introduces
pycompat.open() which is inserted to files using transformer and replaces
builtins.open() calls.
2017-03-03 13:04:32 +05:30
Pierre-Yves David
ded2ad613e localrepo: deprecate 'repo.opener' (API)
The "new" 'repo.vfs' attribute have been around for almost 5 years. I think we
can deprecate the old form now ;-)
2016-08-05 13:56:10 +02:00
Pierre-Yves David
2b85891765 statichttp: use 'repo.vfs' as the main attribute
We are about to deprecate the repo.opener attribute, we prepare the static http
code to be ready for this change.
2017-03-02 03:24:58 +01:00