Mercurial > hg
annotate contrib/tcsh_completion @ 39687:bfeab472e3c0
localrepo: create new function for instantiating a local repo object
Today, there is a single local repository class - localrepository. Its
__init__ is responsible for loading the .hg/requires file and taking
different actions depending on what is present.
In addition, extensions may define a "reposetup" function that
monkeypatches constructed repository instances, often by implementing
a derived type and changing the __class__ of the repo instance.
Work around alternate storage backends and partial clone has made it
clear to me that shoehorning all this logic into __init__ and operating
on an existing instance is too convoluted. For example, localrepository
assumes revlog storage and swapping in non-revlog storage requires
overriding e.g. file() to return something that isn't a revlog. I've
authored various patches that either:
a) teach various methods (like file()) about different states and
taking the appropriate code path at run-time
b) create methods/attributes/callables used for instantiating things
and populating these in __init__
"a" incurs run-time performance penalties and makes code more
complicated since various functions have a bunch of "if storage is X"
branches.
"b" makes localrepository quickly explode in complexity.
My plan for tackling this problem is to make the local repository type
more dynamic. Instead of a static localrepository class/type that
supports all of the local repository configurations (revlogs vs other,
revlogs with ellipsis, revlog v1 versus revlog v2, etc), we'll
dynamically construct a type providing the implementations that are
needed for the repository on disk, derived from the .hg/requires file
and configuration options. The constructed repository type will be
specialized and methods won't need to be taught about different
implementations nor overloaded.
We may also leverage this functionality for building types that don't
implement all attributes. For example, the "intents" feature allows
commands to declare that they are read only. By dynamically
constructing a repository type, we could return a repository instance
with no attributes related to mutating the repository. This could
include things like a "changelog" property implementation that doesn't
check whether it needs to invalidate the hidden revisions set on every
access.
This commit establishes a function for building a local repository
instance. Future commits will start moving functionality from
localrepository.__init__ to this function. Then we'll start dynamically
changing the returned type depending on options that are present.
This change may seem radical. But it should be fully compatible with
the reposetup() model - at least for now.
Differential Revision: https://phab.mercurial-scm.org/D4563
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 12 Sep 2018 11:02:16 -0700 |
parents | 2616325766e3 |
children |
rev | line source |
---|---|
1156 | 1 # |
2 # tcsh completion for Mercurial | |
3 # | |
4 # This file has been auto-generated by tcsh_completion_build.sh for | |
13515
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
5 # Mercurial Distributed SCM (version 1.7.5+157-8a220ae0b2ba) |
1156 | 6 # |
7 # Copyright (C) 2005 TK Soh. | |
8 # | |
9 # This is free software; you can redistribute it and/or modify it under | |
10 # the terms of the GNU General Public License as published by the Free | |
11 # Software Foundation; either version 2 of the License, or (at your | |
1308
2073e5a71008
Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1264
diff
changeset
|
12 # option) any later version. |
1156 | 13 # |
14 | |
15 complete hg \ | |
16 'n/--cwd/d/' 'n/-R/d/' 'n/--repository/d/' \ | |
1158
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
17 'C/-/( -R --repository \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
18 --cwd \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
19 -y --noninteractive \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
20 -q --quiet \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
21 -v --verbose \ |
7766
2b2548342265
Update tcsh completion scripts with new commands and for new help output.
Gilles Moris <gilles.moris@free.fr>
parents:
1308
diff
changeset
|
22 --config \ |
1158
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
23 --debug \ |
1264
be4a14bfaa9c
Generated new tcsh_completion with tcsh_completion_build.sh
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1158
diff
changeset
|
24 --debugger \ |
7766
2b2548342265
Update tcsh completion scripts with new commands and for new help output.
Gilles Moris <gilles.moris@free.fr>
parents:
1308
diff
changeset
|
25 --encoding \ |
2b2548342265
Update tcsh completion scripts with new commands and for new help output.
Gilles Moris <gilles.moris@free.fr>
parents:
1308
diff
changeset
|
26 --encodingmode \ |
1158
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
27 --traceback \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
28 --time \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
29 --profile \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
30 --version \ |
4650ec7ef690
Regenerate tcsh_completion after bugfix in generator script
TK Soh <tksoh@freescale.com>
parents:
1156
diff
changeset
|
31 -h --help)/' \ |
7766
2b2548342265
Update tcsh completion scripts with new commands and for new help output.
Gilles Moris <gilles.moris@free.fr>
parents:
1308
diff
changeset
|
32 'p/1/(add addremove annotate blame archive \ |
13515
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
33 backout bisect bookmarks branch branches \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
34 bundle cat clone commit ci \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
35 copy cp debugancestor debugbuilddag debugcheckstate \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
36 debugcommands debugcomplete debugdag debugdata debugdate \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
37 debugfsinfo debugignore debugindex debugindexdot debuginstall \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
38 debugpushkey debugrebuildstate debugrename debugrevspec debugsetparents \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
39 debugstate debugsub debugwalk diff export \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
40 forget grep heads help identify \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
41 id import patch incoming in \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
42 init locate log history manifest \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
43 merge outgoing out parents paths \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
44 pull push recover remove rm \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
45 rename move mv resolve revert \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
46 rollback root serve showconfig debugconfig \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
47 status st summary sum tag \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
48 tags tip unbundle update up \ |
2616325766e3
contrib: update tcsh_completion for Mercurial 1.8
Gilles Moris <gilles.moris@free.fr>
parents:
11445
diff
changeset
|
49 checkout co verify version)/' |
1156 | 50 |