Commit Graph

950 Commits

Author SHA1 Message Date
Martin von Zweigbergk
d0f5db29a6 cleanup: reuse existing wctx variables instead of calling repo[None]
Incidentally, this apparently means we load .hgsub one time less as
well, which affects a test case.
2017-05-20 22:27:52 -07:00
Yuya Nishihara
6c2103bc71 commands: move templates of common command options to cmdutil (API)
The goal is to get rid of the debugcommands -> commands dependency.

Since globalopts is the property of the commands, it's kept in the commands
module.
2017-05-14 16:19:47 +09:00
Augie Fackler
b92dbee43c cmdutil: use repo[None].walk instead of repo.walk 2017-05-18 18:00:52 -04:00
Yuya Nishihara
7b77796abc extensions: show deprecation warning for the use of cmdutil.command
Since this is a fundamental API for extensions, we set 1-year period until
actually removing it.
2016-01-09 23:24:52 +09: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
Martin von Zweigbergk
c3406ac3db cleanup: use set literals
We no longer support Python 2.6, so we can now use set literals.
2017-02-10 16:56:29 -08:00
Pulkit Goyal
edb3048605 py3: convert kwargs' keys to str using pycompat.strkwargs 2017-05-04 00:24:21 +05:30
Martin von Zweigbergk
0a45a04c8a forget: access status fields by name, not index 2017-05-04 21:11:40 -07:00
Pulkit Goyal
b69219d4a1 py3: use %d to format integers into bytestrings 2017-05-05 01:41:54 +05:30
Pulkit Goyal
7b5053db1f py3: slice over bytes to prevent getting ascii values 2017-05-05 01:26:13 +05:30
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
deceb69003 py3: convert opts to bytes in cmdutil.dorecord()
commands.commit() calls cmdutil.dorecord() where opts are passed as unicodes
being keyword arguments. This patch converts them back to bytes as they are
required.
2017-04-21 02:20:46 +05:30
Yuya Nishihara
9466c3179f commit: optionally strip quotes from commit template (BC)
For consistency with the other template options.
2017-02-25 19:32:39 +09:00
Yuya Nishihara
5fbb2d3cd5 graphlog: optionally strip quotes from graphnode template (BC)
For consistency with the other template options.
2017-02-25 19:28:16 +09: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
Yuya Nishihara
caee220313 templater: provide loop counter as "index" keyword
This was originally written for JSON templating where we would have to be
careful to not add extra comma, but seems generally useful.

Inner loop started by % operator has its own counter.
2016-04-22 21:46:33 +09:00
Denis Laxalde
2ae8148594 cmdutil: add a "changeset.obsolete" label in changeset_printer
Until now there were no label to highlight obsolete changesets in log output,
only evolution troubles (unstable, bumped, divergent) are supported. We add a
"changeset.obsolete" label on changeset entries produced by changeset_printer
so that obsolete changesets can be highlighted in log output. This is useful
because, unless using a graph log where obsolete changesets have a 'x' marker,
there's no way to identify obsolete changesets. And even in graph mode, when
working directory's parent is obsolete, we get a '@' marker and we do not see
it as obsolete.
2017-03-25 09:39:07 +01: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
Jun Wu
e7a5a37c7c import: get rid of ui.backupconfig 2017-03-16 14:23:49 -07:00
Yuya Nishihara
02022fc3c5 util: wrap s.encode('string_escape') call for future py3 compatibility 2017-03-15 23:06:50 +09:00
Pierre-Yves David
80b1f7c309 cmdutil: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:53:09 -08:00
Mads Kiilerich
a936a7f3a7 vfs: use repo.wvfs.unlinkpath 2015-01-14 01:15:26 +01:00
Pierre-Yves David
526ec9867d vfs: use 'vfs' module directly in 'mercurial.cmdutil'
Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.
2017-03-02 13:30:47 +01:00
Pierre-Yves David
e5cb48ac36 vfs: replace 'scmutil.opener' usage with 'scmutil.vfs'
The 'vfs' class is the first class citizen for years. We remove all usages of
the older API. This will let us remove the old API eventually.
2017-03-02 03:52:36 +01:00
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
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
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
ee94a5599f revert: move code dealing with deletions closer together 2016-02-24 14:44:14 -08:00
Durham Goode
cfe81cb036 revert: remove set(mf) because it's O(manifest)
The revert code had a 'set(manifest)' line in it, which has a runtime equivalent
to the size of the manifest. With alternative manifest implementations, like
treemanifest, this can be extra expensive. Let's rewrite it to be O(changes)
instead of O(manifest size).
2017-03-01 19:51:05 -08:00
Yuya Nishihara
ea9be23c11 graphlog: restore pager lost at ebae4e1a56fc 2017-02-23 21:20:26 +09:00
Yuya Nishihara
d63d83be69 revset: import set classes directly from smartset module
Follows up 97d0be4019ac.
2017-02-19 18:16:09 +09:00
Augie Fackler
5fd61fb005 cmdutil: remove forwarding methods per deprecation policy 2017-02-03 16:01:19 -05:00
Sean Farley
e145fc2df7 ui: rename tmpdir parameter to more specific repopath
This was requested by Augie and I agree that repopath is more
descriptive.
2017-01-18 18:25:51 -08:00
Sean Farley
a405503f7a cmdutil: add tmpdir parament to ui.edit calls 2017-01-16 21:15:21 -08:00
Matt Harbison
511b164fad templater: add '{envvars}' to access environment variables
Since the option for ui.exportableenviron is experimental, so is this template
until the underlying API is sorted out.
2017-01-17 23:12:54 -05:00
Valters Vingolds
0b2827adb4 rebase: provide detailed hint to abort message if working dir is not clean
Detailed hint message is now provided when 'pull --rebase' operation detects
unclean working dir, for example:
  abort: uncommitted changes
  (cannot pull with rebase: please commit or shelve your changes first)

Added tests for uncommitted merge, and for subrepo support verifying that same
hint is also passed to subrepo state check.
2017-01-10 09:32:27 +01:00
Yuya Nishihara
630684236e commit: fix unmodified message detection for the "--- >8 ----" magic
We need the raw editortext to be compared with the templatetext.
2017-01-06 22:50:04 +09:00
Denis Laxalde
ea885ed1d6 log: drop unnecessary ui.note label from "trouble: " line
Follow-up on 38b8a4a2230c and 3f2425cfd46f.
2017-01-07 12:07:56 +01:00
Denis Laxalde
627f47db5c cmdutil: add missing "i18n" comment about "trouble: " line
Follow-up on 38b8a4a2230c per late review.
2017-01-06 12:36:21 +01:00
Sean Farley
52b92c45af cmdutil: add special string that ignores rest of text
Similar to git, we add a special string:

  HG: ------------------------ >8 ------------------------

that means anything below it is ignored in a commit message.

This is helpful for integrating with third-party tools that display the
2016-12-31 15:36:36 -06:00
Denis Laxalde
37fb9b1045 cmdutil: add support for evolution "troubles" display in changeset_printer
Add a "trouble" line in changeset header along with a couple of labels on
"log.changeset" line to indicate whether a changeset is troubled or not and
which kind trouble occurs.
2016-10-10 12:06:58 +02:00
Denis Laxalde
1f19429796 cmdutil: extract a _changesetlabels function out of changeset_printer._show()
There is a common logic in changeset_printer and in the summary command for
labelling a changeset.

This prepares extension of changeset's labels with evolution "troubles"
information that would show up in both log and summary outputs. Ultimately,
both would use this function.
2017-01-03 10:56:41 +01:00
Pulkit Goyal
5629f71f5b py3: replace os.sep with pycompat.ossep (part 3 of 4) 2016-12-17 20:14:24 +05:30
Jun Wu
c40d1d56d5 revert: pass operation to crecord
So crecord would know what to display
2016-11-23 19:03:24 +00:00
Denis Laxalde
11b3012d89 revert: prompt before removing files in interactive mode
Prior to this change, files to be removed (i.e. files added since the revision
to revert to) were unconditionally removed despite the interactive mode. Now
prompt before actually removing the files, as this is done for other actions
(e.g. forget).
2016-11-25 09:10:30 +01:00
Denis Laxalde
1dc33c0e5e revert: indicate the default choice when prompting to forget files 2016-11-25 09:09:31 +01:00
Denis Laxalde
5b0914afc0 style: avoid an unnecessary line split 2016-11-25 09:09:03 +01:00
Pulkit Goyal
97f340e354 py3: use pycompat.getcwd() instead of os.getcwd()
We have pycompat.getcwd() which returns bytes path on Python 3. This patch
changes most of the occurences of the os.getcwd() with pycompat one.
2016-11-23 00:03:11 +05:30
Yuya Nishihara
dce6c5ba27 server: move cmdutil.service() to new module (API)
And call it runservice() because I'll soon add createservice().

The main reason I'm going to introduce the 'server' module is to solve
future dependency cycle between chgserver.py and commandserver.py.

The 'server' module sits at the same layer as the cmdutil. I believe it's
generally good to get rid of things from the big cmdutil module.
2016-10-15 13:47:43 +09:00