Commit Graph

3278 Commits

Author SHA1 Message Date
Pierre-Yves David
6777304ca7 bundle: introduce an higher level function to write bundle on disk
The current function ('writebundle') is focussing on getting an existing
changegroup to disk. It is no easy ways to includes more part in the generated
bundle2. So we introduce a slightly higher level function that is fed the
'outgoing' object (that defines the bundled spec) and the bundlespec parameters
(to control the changegroup generation and inclusion of other parts).

This is creating the third logic dedicated to create a consistent bundle2 (the
other 2 are the push code and the getbundle code). We should probably reconcile
them at some points but they all takes different types of input. So we need to
introduce an intermediate "object" that each different input could be converted
to. Such unified "bundle2 specification" could be fed to some unified code.

We start by having the `hg bundle` related code on its own to helps defines its
specific needs first. Once the common and specific parts of each logic will be
known we can start unification.
2017-05-05 17:09:47 +02:00
Pierre-Yves David
e9ce49e179 bundle: handle compression earlier
We can also handle that part before starting any generation.
2017-05-04 21:47:03 +02:00
Pierre-Yves David
f76028d798 bundle: check changegroup version earlier
We can check if we know how to bundle this changegroup version before actually
starting to generate the changegroup.
2017-05-04 21:46:02 +02:00
Pierre-Yves David
f734e61f99 bundle: check lack of revs to bundle before generating the changegroup
We already have the information so we can check it earlier.
2017-05-04 21:44:36 +02:00
Pulkit Goyal
c3219cc9ed py3: convert kwargs' keys to str before passing in cmdutil.getcommiteditor 2017-05-05 04:41:45 +05:30
Pierre-Yves David
e6d7dd827e bundle: factor the 'getchangegroup' out
The call in the two branches is identical, so we can just issue it outside of
the conditional.
2017-05-04 12:48:45 +02:00
Pierre-Yves David
ce3d8fe617 bundle: avoid reset of the 'outgoing' variable
We have a cleaner way to achieve the same effect. Not resetting the variable
will help us to simplify the code.
2017-05-04 12:47:27 +02:00
Pierre-Yves David
8247e24b4d commands: directly 'getchangegroup'
It is identical to 'getlocalchangegroup' with a shorter name.
2017-05-04 12:41:17 +02:00
Martin von Zweigbergk
feebdd58e5 changegroup: delete unused 'bundlecaps' argument (API) 2017-05-02 23:47:10 -07:00
Pulkit Goyal
5e026b2f2b py3: handle opts correctly for hg add
opts in add command were passed again to cmdutil.add() as kwargs so we need
to convert them again to str. Intstead we convert them to bytes when passing
scmutil.match(). Opts handling is also corrected for all the functions which
are called from cmdutil.add().
2017-04-25 01:52:30 +05:30
Pulkit Goyal
524f812ff5 py3: handle opts correctly for rollback
dryrun and force are just check for None, the value is not used. So its better
to leave opts as unicodes as that wont harm us.
2017-04-24 04:32:04 +05:30
Pulkit Goyal
6458308e66 py3: handle opts correctly for unbundle
There is just a check whether the value is None or not. So even having
optupdate as unicodes won't harm us.
2017-04-21 15:04:32 +05:30
Pulkit Goyal
bcae1e9ab7 py3: make sure opts are passed and used correctly in help command
opts are converted back to bytes in help.help_() where they are used.
Before that it's ensured that we have a bytes value for keep variable.
2017-04-28 00:49:30 +05:30
Pulkit Goyal
13bba2b158 py3: handle opts uniformly in commands.py
Since keyword arguments can't be bytes on Python 3, we converted then to
unicodes before passing into different command functions. We need to adopt a
certain pattern to convert opts back to bytes. Following are some of the
functions which are called from inside these command functions and should
always be feeded bytes to follow the right behaviour.

ui.fomattter()
scmutil.match()
patch.diffallopts()
hg.peer()
cmdutil.{show_changeset|copy|graphrevs|checkunsupportedflag}
server.{createservice|runservice}

There are few commands which are left out where opts is again passed to a
function as keyword arguments or converting opts back to bytes is kind of
not necessary. Those are cat, revert, help, unbundle and rollback. Following
patches will deal with them. This patch apart from these five commands,
convert opts back to bytes for rest of the commands.

This fixes a lot of things which are hidden like --git works now. Similarly
more flags of commands which run on Python 3 currently get fixed.
2017-05-03 15:25:06 +05:30
Jun Wu
04c3104f68 annotate: use fctx.isbinary 2017-05-03 18:03:38 -07:00
Martin von Zweigbergk
971305ce1d bisect: allow resetting with unfinished graft/rebase/etc
"hg bisect --reset" just deletes the state file (it doesn't move back
to the starting point like rebase does); it can not conflict with an
ongoing rebase etc.

checkunfinished() has this documentation:

  It's probably good to check this right before bailifchanged().

So that's where I moved it.
2017-05-03 09:09:44 -07:00
Matt DeVore
2eace305ec log: document the characters ---graph uses to draw
The meaning of : vs | was undocumented and non-obvious.
2017-04-18 14:51:32 -07:00
Matt Harbison
6d898e296f serve: add support for Mercurial subrepositories
I've been using `hg serve --web-conf ...` with a simple '/=projects/**' [paths]
configuration for awhile without issue.  Let's ditch the need for the manual
configuration in this case, and limit the repos served to the actual subrepos.

This doesn't attempt to handle the case where a new subrepo appears while the
server is running.  That could probably be handled with a hook if somebody wants
it.  But it's such a rare case, it probably doesn't matter for the temporary
serves.

The main repo is served at '/', just like a repository without subrepos.  I'm
not sure why the duplicate 'adding ...' lines appear on Linux.  They don't
appear on Windows (see 3f4ff1bdf101), so they are optional.

Subrepositories that are configured with '../path' or absolute paths are not
cloneable from the server.  (They aren't cloneable locally either, unless they
also exist at their configured source, perhaps via the share extension.)  They
are still served, so that they can be browsed, or cloned individually.  If we
care about that cloning someday, we can probably just add the extra entries to
the webconf dictionary.  Even if the entries use '../' to escape the root, only
the related subrepositories would end up in the dictionary.
2017-04-15 18:05:40 -04:00
Ryan McElroy
ce07523994 pull: abort pull --update if config requires destination (issue5528) 2017-04-07 06:31:50 -07:00
Jun Wu
aa5d108c15 bundle: allow bundle command to use changegroup3 in tests
Since bundle2 writes changegroup version, we can just reuse the bundle2
format for changegroup3.

This won't enable the bundle command to write changegroup3 in the wild,
since exchange.parsebundlespec only returns changegroup2. It unlocks tests
to override exchange.parsebundlespec and get "hg bundle" write changegroup3.
2017-04-06 17:01:58 -07:00
Pulkit Goyal
40a840896d py3: use pycompat.byteskwargs() to convert opts to bytes
We have converted opts to unicodes before passing them.
2017-04-07 13:45:33 +05:30
Alexander Fomin
b6338c907a diff: add --binary option for git mode diffs
This patch adds --binary option to `hg diff` and `hg export` to allow more
control about when binary diffs are displayed in Git mode as well as some
tests to verify it behaves correctly (issue5510).
2017-04-05 15:31:08 -07:00
Gregory Szorc
04c3125727 commands: update help for "unbundle"
Similar to the recent change to "bundle," this command no longer
just deals with "changegroup" data.
2017-04-01 13:43:52 -07:00
Gregory Szorc
5c890f5f16 commands: update help for "bundle"
We now have a dedicated help topic to describe bundle specification
strings. Let's update `hg bundle`'s documentation to reflect its
existence.

While I was hear, I also tweaked some wording which I felt was out
of date and needed tweaking. Specifically, `hg bundle` no longer
just deals with "changegroup" data: it can also generate files
that have non-changegroup data.
2017-04-01 13:43:43 -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
Jun Wu
28aef1acdc debugconfig: list environment variables in debug output
Since we print "read config from" for config files, printing environment
variables will make it more consistent.
2017-03-26 21:40:22 -07:00
Jun Wu
cc0447168c rcutil: let environ override system configs (BC)
This is BC because system configs won't be able to override $EDITOR, $PAGER.
The new behavior is arguably more rational.
2017-03-26 21:33:37 -07:00
Jun Wu
d4692f9619 rcutil: let rccomponents return different types of configs (API)
The next patches will convert environ to raw config items, and insert the
config items between systemrcpath and userrcpath. This patch teaches
rccomponents to return the type information so the caller could distinguish
between "path" and raw config "items".
2017-03-26 21:04:29 -07:00
Jun Wu
d63b24bd71 rcutil: rename rcpath to rccomponents (API) 2017-03-26 20:48:00 -07:00
Jun Wu
582704c32f rcutil: move scmutil.*rcpath to rcutil (API)
As discussed at [1], the logic around "actual config"s seem to be
non-trivial enough that it's worth a new module.

This patch creates the module and move "scmutil.*rcpath" functions there as
the first step. More methods will be moved to the module in the future.

The module is different from config.py because the latter only cares about
data structure and parsing, and does not care about special case, or system
config paths, or environment variables.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095503.html
2017-03-26 20:18:42 -07:00
Pierre-Yves David
b55b067aa6 tags: use the 'tag' function from the 'tags' module in the 'tag' command
There is No need to go through the 'repo' object method anymore.
2017-03-27 16:00:34 +02:00
Martin von Zweigbergk
68e5878038 status: support commands.status.relative config
When the config is set to true, status output becomes relative to the
working directory. This has bugged me since I started using hg and it
turns it is sillily simple to support it (unless I missed something,
of course).

We could also add a --relative flag, but I would personally always
want that on, and I haven't heard any use for having it sometimes on,
so this patch only lets you enable it via config.
2017-03-21 17:50:44 -07:00
Martin von Zweigbergk
dc4c37c445 plain: ignore [commands] config
We only have commands.{update,rebase}.requiredest so far. We should
clearly ignore those two if HGPLAIN is in effect, and it seems like we
should ignore any future config that will be added in [commands] since
that is about changing the behavior of commands.

Thanks to Yuya for suggesting to centralize the code in ui.py.

While at it, remove the unnecessary False values passed to
ui.configbool() for the aforementioned config options.
2017-03-21 21:26:52 -07:00
Ryan McElroy
158bdd12b9 update: add flag to require update destination
In some mercurial workflows, the default destination for update does not
always work well and can lead to confusing behavior. With this flag enabled,
every update command will require passing an explicit destination, eliminating
this confusion.
2017-03-14 17:43:18 -07:00
Augie Fackler
471b2bd76a commit: keep opts as byteskwargs as much as possible
This fixes many flag-handling bugs on 'hg commit' in Python 3.
2017-03-19 01:20:08 -04:00
Yuya Nishihara
7e7dd65819 py3: convert log opts to bytes-key dict
Now simple log command works.
2017-03-14 18:23:59 +09:00
Yuya Nishihara
2b0fe29f27 graphlog: pass function arguments without expansion
It's annoying on Python 3 because keys must be unicode type. Let's stop using
**opts expansion when not necessary.
2017-03-14 18:16:13 +09:00
Rishabh Madan
ea88450bc5 py3: change explicit conversion of config value from str to pycompat.bytestr 2017-03-17 19:12:22 +05:30
Pulkit Goyal
73e25e061d py3: make sure using bytes status char rather than ascii values
'MAR!?IC' is converted to their ascii values when slicing through it. This
patch uses pycompat.iterbytestr() to get bytes value.
2017-03-16 09:13:13 +05:30
Jun Wu
a1b35a50eb commit: get rid of ui.backupconfig 2017-03-16 14:15:20 -07:00
Pulkit Goyal
fcc99d385f py3: convert opts back to bytes for status 2017-03-16 10:10:00 +05:30
Martin von Zweigbergk
b7d134a4b3 heads: enable pager 2017-03-13 11:19:24 -07:00
Martin von Zweigbergk
d6f2ec5990 branches: enable pager 2017-03-13 11:03:59 -07:00
Augie Fackler
f010a9d8ef files: use native string type to load rev opt from dict 2017-03-12 00:51:00 -05:00
Augie Fackler
b9f0d10d43 summary: don't explicitly str() something we're about to %s
str() is wrong on Python 3 here, and %s implicitly calls str() anyway,
so this was just extra dancing for no reason.
2017-03-11 20:58:26 -05:00
Pierre-Yves David
d47e9585d6 commands: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:53:17 -08:00
Mads Kiilerich
975c19c195 vfs: use repo.vfs.unlinkpath 2017-03-11 11:02:25 -08:00
Simon Farnsworth
d6cdf14b5e config: set blockedtag when invoking configuration edit 2017-03-06 03:27:24 -08:00
Simon Farnsworth
63ca96dec0 bisect: set a blockedtag when running the check command
So that the hg bisect data clearly shows the bisect command separately to the
main data set.
2017-03-06 03:26:30 -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