##// END OF EJS Templates
git: skeleton of a new extension to _directly_ operate on git repos...
git: skeleton of a new extension to _directly_ operate on git repos This is based in part of work I did years ago in hgit, but it's mostly new code since I'm using pygit2 instead of dulwich and the hg storage interfaces have improved. Some cleanup of old hgit code by Pulkit, which I greatly appreciate. test-git-interop.t does not cover a whole lot of cases, but it passes. It includes status, diff, making a new commit, and `hg annotate` working on the git repository. This is _not_ (yet) production quality code: this is an experiment. Known technical debt lurking in this implementation: * Writing bookmarks just totally ignores transactions. * The way progress is threaded down into the gitstore is awful. * Ideally we'd find a way to incrementally reindex DAGs. I'm not sure how to do that efficiently, so we might need a "known only fast-forwards" mode on the DAG indexer for use on `hg commit` and friends. * We don't even _try_ to do anything reasonable for `hg pull` or `hg push`. * Mercurial need an interface for the changelog type. Tests currently require git 2.24 as far as I'm aware: `git status` has some changed output that I didn't try and handle in a compatible way. This patch has produced some interesting cleanups, most recently on the manifest type. I expect continuing down this road will produce other meritorious cleanups throughout our code. Differential Revision: https://phab.mercurial-scm.org/D6734

File last commit:

r43347:687b865b default
r44961:ad718271 default
Show More
children.py
84 lines | 2.4 KiB | text/x-python | PythonLexer
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 # Mercurial extension to provide the 'hg children' command
#
# Copyright 2007 by Intevation GmbH <intevation@intevation.de>
Martin Geisler
add blank line after copyright notices and after header
r8228 #
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 # Author(s):
# Thomas Arendsen Hein <thomas@intevation.de>
#
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783
Augie Fackler
children: mark extension as deprecated
r16668 '''command to display child changesets (DEPRECATED)
Martin Geisler
children: use hg reST role for example
r16670 This extension is deprecated. You should use :hg:`log -r
"children(REV)"` instead.
Augie Fackler
children: mark extension as deprecated
r16668 '''
Dirkjan Ochtman
help: add/fix docstrings for a bunch of extensions
r8873
Gregory Szorc
children: use absolute_import
r28093 from __future__ import absolute_import
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 from mercurial.i18n import _
Gregory Szorc
children: use absolute_import
r28093 from mercurial import (
cmdutil,
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 logcmdutil,
Pulkit Goyal
py3: handle keyword arguments in hgext/children.py...
r34974 pycompat,
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 registrar,
Martin von Zweigbergk
children: support specifying revision by revset...
r37375 scmutil,
Gregory Szorc
children: use absolute_import
r28093 )
Yuya Nishihara
commands: move templates of common command options to cmdutil (API)...
r32375 templateopts = cmdutil.templateopts
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783
Gregory Szorc
children: declare command using decorator
r21248 cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 command = registrar.command(cmdtable)
Augie Fackler
extensions: change magic "shipped with hg" string...
r29841 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
Augie Fackler
extensions: document that `testedwith = 'internal'` is special...
r25186 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
# be specifying the version(s) of Mercurial they are tested with, or
# leave the attribute unspecified.
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 testedwith = b'ships-with-hg-core'
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783
Augie Fackler
formatting: blacken the codebase...
r43346
@command(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'children',
[
(
b'r',
b'rev',
b'.',
_(b'show children of the specified revision'),
_(b'REV'),
),
]
Augie Fackler
formatting: blacken the codebase...
r43346 + templateopts,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 _(b'hg children [-r REV] [FILE]'),
rdamazio@google.com
help: assigning categories to existing commands...
r40329 helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
Augie Fackler
formatting: blacken the codebase...
r43346 inferrepo=True,
)
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 def children(ui, repo, file_=None, **opts):
Martin Geisler
expand "dir" to "directory" in help texts
r8026 """show the children of the given or working directory revision
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783
Martin Geisler
children: wrap docstrings at 70 characters
r9253 Print the children of the working directory's revisions. If a
revision is given via -r/--rev, the children of that revision will
be printed. If a file argument is given, revision in which the
file was last changed (after the working directory revision or the
argument to --rev if given) is printed.
timeless
children: update help with replacement
r27716
Please use :hg:`log` instead::
Pulkit Goyal
children: fix the log expansion of `hg children` in doc...
r34946 hg children => hg log -r "children(.)"
timeless
children: use double quotes for arguments...
r28799 hg children -r REV => hg log -r "children(REV)"
timeless
children: update help with replacement
r27716
See :hg:`help log` and :hg:`help revsets.children`.
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 """
Pulkit Goyal
py3: handle keyword arguments in hgext/children.py...
r34974 opts = pycompat.byteskwargs(opts)
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 rev = opts.get(b'rev')
Martin von Zweigbergk
children: support specifying revision by revset...
r37375 ctx = scmutil.revsingle(repo, rev)
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 if file_:
Martin von Zweigbergk
children: support specifying revision by revset...
r37375 fctx = repo.filectx(file_, changeid=ctx.rev())
Yuya Nishihara
children: don't pass filectx to displayer...
r24482 childctxs = [fcctx.changectx() for fcctx in fctx.children()]
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783 else:
Yuya Nishihara
children: don't pass filectx to displayer...
r24482 childctxs = ctx.children()
Thomas Arendsen Hein
Add extension to provide the 'hg children' command (with tests)
r4783
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
Yuya Nishihara
children: don't pass filectx to displayer...
r24482 for cctx in childctxs:
Dirkjan Ochtman
cmdutil: use change contexts for cset-printer and cset-templater
r7369 displayer.show(cctx)
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()