mepo 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mepo/__init__.py +7 -0
- mepo/__main__.py +19 -0
- mepo/cmdline/__init__.py +0 -0
- mepo/cmdline/branch_parser.py +57 -0
- mepo/cmdline/config_parser.py +50 -0
- mepo/cmdline/parser.py +503 -0
- mepo/cmdline/stash_parser.py +72 -0
- mepo/cmdline/tag_parser.py +79 -0
- mepo/command/__init__.py +0 -0
- mepo/command/branch.py +12 -0
- mepo/command/branch_create.py +13 -0
- mepo/command/branch_delete.py +13 -0
- mepo/command/branch_list.py +24 -0
- mepo/command/changed-files.py +56 -0
- mepo/command/checkout-if-exists.py +33 -0
- mepo/command/checkout.py +41 -0
- mepo/command/clone.py +145 -0
- mepo/command/commit.py +48 -0
- mepo/command/compare.py +119 -0
- mepo/command/config.py +14 -0
- mepo/command/config_delete.py +7 -0
- mepo/command/config_get.py +18 -0
- mepo/command/config_print.py +5 -0
- mepo/command/config_set.py +8 -0
- mepo/command/develop.py +24 -0
- mepo/command/diff.py +71 -0
- mepo/command/fetch.py +21 -0
- mepo/command/init.py +25 -0
- mepo/command/list.py +9 -0
- mepo/command/pull-all.py +30 -0
- mepo/command/pull.py +27 -0
- mepo/command/push.py +14 -0
- mepo/command/reset.py +105 -0
- mepo/command/restore-state.py +44 -0
- mepo/command/save.py +79 -0
- mepo/command/stage.py +26 -0
- mepo/command/stash.py +16 -0
- mepo/command/stash_apply.py +13 -0
- mepo/command/stash_list.py +14 -0
- mepo/command/stash_pop.py +13 -0
- mepo/command/stash_push.py +13 -0
- mepo/command/stash_show.py +13 -0
- mepo/command/status.py +93 -0
- mepo/command/tag.py +14 -0
- mepo/command/tag_create.py +55 -0
- mepo/command/tag_delete.py +21 -0
- mepo/command/tag_list.py +24 -0
- mepo/command/tag_push.py +24 -0
- mepo/command/unstage.py +22 -0
- mepo/command/update-state.py +23 -0
- mepo/command/whereis.py +53 -0
- mepo/component.py +244 -0
- mepo/git.py +579 -0
- mepo/registry.py +80 -0
- mepo/state.py +170 -0
- mepo/utilities/__init__.py +0 -0
- mepo/utilities/chdir.py +14 -0
- mepo/utilities/colors.py +16 -0
- mepo/utilities/exceptions.py +34 -0
- mepo/utilities/mepoconfig.py +77 -0
- mepo/utilities/shellcmd.py +21 -0
- mepo/utilities/verify.py +38 -0
- mepo/utilities/version.py +92 -0
- mepo-2.0.0.dist-info/METADATA +73 -0
- mepo-2.0.0.dist-info/RECORD +69 -0
- mepo-2.0.0.dist-info/WHEEL +4 -0
- mepo-2.0.0.dist-info/entry_points.txt +2 -0
- mepo-2.0.0.dist-info/licenses/LICENSE +200 -0
- mepo-2.0.0.dist-info/licenses/LICENSE-NOSA +261 -0
mepo/__init__.py
ADDED
mepo/__main__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from importlib import import_module
|
|
2
|
+
|
|
3
|
+
from mepo.cmdline.parser import MepoArgParser
|
|
4
|
+
from mepo.utilities import mepoconfig
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
args = MepoArgParser().parse()
|
|
9
|
+
mepo_cmd = mepoconfig.get_alias_command(args.mepo_cmd)
|
|
10
|
+
|
|
11
|
+
# Load the module containing the "run" method of specified command
|
|
12
|
+
cmd_module = import_module(f"mepo.command.{mepo_cmd}")
|
|
13
|
+
|
|
14
|
+
# Execute "run" method of specified command
|
|
15
|
+
cmd_module.run(args)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
main()
|
mepo/cmdline/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
class MepoBranchArgParser:
|
|
2
|
+
|
|
3
|
+
def __init__(self, branch):
|
|
4
|
+
self.branch_subparsers = branch.add_subparsers()
|
|
5
|
+
self.branch_subparsers.title = "mepo branch sub-commands"
|
|
6
|
+
self.branch_subparsers.dest = "mepo_branch_cmd"
|
|
7
|
+
self.branch_subparsers.required = True
|
|
8
|
+
self.__list()
|
|
9
|
+
self.__create()
|
|
10
|
+
self.__delete()
|
|
11
|
+
|
|
12
|
+
def __list(self):
|
|
13
|
+
brlist = self.branch_subparsers.add_parser(
|
|
14
|
+
"list",
|
|
15
|
+
description="List local branches. If no component is specified, runs over all components",
|
|
16
|
+
)
|
|
17
|
+
brlist.add_argument(
|
|
18
|
+
"-a", "--all", action="store_true", help="list all (local+remote) branches"
|
|
19
|
+
)
|
|
20
|
+
brlist.add_argument(
|
|
21
|
+
"--nocolor", action="store_true", help="do not display color"
|
|
22
|
+
)
|
|
23
|
+
brlist.add_argument(
|
|
24
|
+
"comp_name",
|
|
25
|
+
metavar="comp-name",
|
|
26
|
+
nargs="*",
|
|
27
|
+
help="component to list branches in",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def __create(self):
|
|
31
|
+
create = self.branch_subparsers.add_parser(
|
|
32
|
+
"create", description="Create branch <branch-name> in component <comp-name>"
|
|
33
|
+
)
|
|
34
|
+
create.add_argument("branch_name", metavar="branch-name", help="name of branch")
|
|
35
|
+
create.add_argument(
|
|
36
|
+
"comp_name",
|
|
37
|
+
metavar="comp-name",
|
|
38
|
+
nargs="+",
|
|
39
|
+
help="component to create branches in",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def __delete(self):
|
|
43
|
+
delete = self.branch_subparsers.add_parser(
|
|
44
|
+
"delete", description="Delete branch <branch-name> in component <comp-name>"
|
|
45
|
+
)
|
|
46
|
+
delete.add_argument("branch_name", metavar="branch-name", help="name of branch")
|
|
47
|
+
delete.add_argument(
|
|
48
|
+
"comp_name",
|
|
49
|
+
metavar="comp-name",
|
|
50
|
+
nargs="+",
|
|
51
|
+
help="component to delete branches in",
|
|
52
|
+
)
|
|
53
|
+
delete.add_argument(
|
|
54
|
+
"--force",
|
|
55
|
+
action="store_true",
|
|
56
|
+
help="delete branch even if it has not been fully merged",
|
|
57
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class MepoConfigArgParser:
|
|
2
|
+
|
|
3
|
+
def __init__(self, config):
|
|
4
|
+
self.config = config.add_subparsers()
|
|
5
|
+
self.config.title = "mepo config sub-commands"
|
|
6
|
+
self.config.dest = "mepo_config_cmd"
|
|
7
|
+
self.config.required = True
|
|
8
|
+
self.__get()
|
|
9
|
+
self.__set()
|
|
10
|
+
self.__delete()
|
|
11
|
+
self.__print()
|
|
12
|
+
|
|
13
|
+
def __get(self):
|
|
14
|
+
get = self.config.add_parser(
|
|
15
|
+
"get",
|
|
16
|
+
description=(
|
|
17
|
+
"Get config `entry` in `.mepoconfig`. "
|
|
18
|
+
"Note this uses gitconfig style where `entry` is of the form `section.option`. "
|
|
19
|
+
"So to get an `alias` `st` You would run `mepo config get alias.st`"
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
get.add_argument("entry", metavar="entry", help="Entry to display.")
|
|
23
|
+
|
|
24
|
+
def __set(self):
|
|
25
|
+
set_ = self.config.add_parser(
|
|
26
|
+
"set",
|
|
27
|
+
description=(
|
|
28
|
+
"Set config `entry` to `value` in `.mepoconfig`. "
|
|
29
|
+
"Note this uses gitconfig style where `entry` is of the form `section.option`. "
|
|
30
|
+
"So to set an `alias` for `status` of `st` You would run `mepo config set alias.st status`"
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
set_.add_argument("entry", metavar="entry", help="Entry to set.")
|
|
34
|
+
set_.add_argument("value", metavar="value", help="Value to set entry to.")
|
|
35
|
+
|
|
36
|
+
def __delete(self):
|
|
37
|
+
delete = self.config.add_parser(
|
|
38
|
+
"delete",
|
|
39
|
+
description=(
|
|
40
|
+
"Delete config `entry` in `.mepoconfig`. "
|
|
41
|
+
"Note this uses gitconfig style where `entry` is of the form `section.option`. "
|
|
42
|
+
"So to delete an `alias` `st` You would run `mepo config delete alias.st`"
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
delete.add_argument("entry", metavar="entry", help="Entry to delete.")
|
|
46
|
+
|
|
47
|
+
def __print(self):
|
|
48
|
+
_ = self.config.add_parser(
|
|
49
|
+
"print", description="Print contents of `.mepoconfig`"
|
|
50
|
+
)
|
mepo/cmdline/parser.py
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
from .branch_parser import MepoBranchArgParser
|
|
4
|
+
from .stash_parser import MepoStashArgParser
|
|
5
|
+
from .tag_parser import MepoTagArgParser
|
|
6
|
+
from .config_parser import MepoConfigArgParser
|
|
7
|
+
|
|
8
|
+
from ..utilities import mepoconfig
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MepoArgParser:
|
|
12
|
+
|
|
13
|
+
__slots__ = ["parser", "subparsers"]
|
|
14
|
+
|
|
15
|
+
def __init__(self):
|
|
16
|
+
self.parser = argparse.ArgumentParser(
|
|
17
|
+
description="Tool to manage (m)ultiple r(epo)s"
|
|
18
|
+
)
|
|
19
|
+
self.subparsers = self.parser.add_subparsers()
|
|
20
|
+
self.subparsers.title = "mepo commands"
|
|
21
|
+
self.subparsers.required = True
|
|
22
|
+
self.subparsers.dest = "mepo_cmd"
|
|
23
|
+
|
|
24
|
+
def parse(self):
|
|
25
|
+
self.__init()
|
|
26
|
+
self.__clone()
|
|
27
|
+
self.__list()
|
|
28
|
+
self.__status()
|
|
29
|
+
self.__restore_state()
|
|
30
|
+
self.__diff()
|
|
31
|
+
self.__fetch()
|
|
32
|
+
self.__checkout()
|
|
33
|
+
self.__checkout_if_exists()
|
|
34
|
+
self.__changed_files()
|
|
35
|
+
self.__branch()
|
|
36
|
+
self.__tag()
|
|
37
|
+
self.__stash()
|
|
38
|
+
self.__develop()
|
|
39
|
+
self.__pull()
|
|
40
|
+
self.__pull_all()
|
|
41
|
+
self.__compare()
|
|
42
|
+
self.__reset()
|
|
43
|
+
self.__whereis()
|
|
44
|
+
self.__stage()
|
|
45
|
+
self.__unstage()
|
|
46
|
+
self.__commit()
|
|
47
|
+
self.__push()
|
|
48
|
+
self.__save()
|
|
49
|
+
self.__config()
|
|
50
|
+
self.__update_state()
|
|
51
|
+
return self.parser.parse_args()
|
|
52
|
+
|
|
53
|
+
def __init(self):
|
|
54
|
+
init = self.subparsers.add_parser(
|
|
55
|
+
"init",
|
|
56
|
+
description="Initialize mepo based on `config-file`",
|
|
57
|
+
aliases=mepoconfig.get_command_alias("init"),
|
|
58
|
+
)
|
|
59
|
+
init.add_argument(
|
|
60
|
+
"--registry",
|
|
61
|
+
nargs="?",
|
|
62
|
+
default="components.yaml",
|
|
63
|
+
help="default: %(default)s",
|
|
64
|
+
)
|
|
65
|
+
init.add_argument(
|
|
66
|
+
"--style",
|
|
67
|
+
metavar="style-type",
|
|
68
|
+
nargs="?",
|
|
69
|
+
default=None,
|
|
70
|
+
choices=["naked", "prefix", "postfix"],
|
|
71
|
+
help="Style of directory file, default: prefix, allowed options: %(choices)s",
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def __clone(self):
|
|
75
|
+
clone = self.subparsers.add_parser(
|
|
76
|
+
"clone",
|
|
77
|
+
description="Clone repositories.",
|
|
78
|
+
aliases=mepoconfig.get_command_alias("clone"),
|
|
79
|
+
)
|
|
80
|
+
clone.add_argument(
|
|
81
|
+
"repo_url", metavar="URL", nargs="?", default=None, help="URL to clone"
|
|
82
|
+
)
|
|
83
|
+
clone.add_argument(
|
|
84
|
+
"directory",
|
|
85
|
+
nargs="?",
|
|
86
|
+
default=None,
|
|
87
|
+
help="Directory to clone into (Only allowed with URL!)",
|
|
88
|
+
)
|
|
89
|
+
clone.add_argument(
|
|
90
|
+
"--branch",
|
|
91
|
+
"-b",
|
|
92
|
+
metavar="name",
|
|
93
|
+
nargs="?",
|
|
94
|
+
default=None,
|
|
95
|
+
help="Branch/tag of URL to initially clone (Only allowed with URL!)",
|
|
96
|
+
)
|
|
97
|
+
clone.add_argument(
|
|
98
|
+
"--registry",
|
|
99
|
+
metavar="registry",
|
|
100
|
+
nargs="?",
|
|
101
|
+
default=None,
|
|
102
|
+
help="Registry (default: components.yaml)",
|
|
103
|
+
)
|
|
104
|
+
clone.add_argument(
|
|
105
|
+
"--style",
|
|
106
|
+
metavar="style-type",
|
|
107
|
+
nargs="?",
|
|
108
|
+
default=None,
|
|
109
|
+
choices=["naked", "prefix", "postfix"],
|
|
110
|
+
help="Style of directory file, default: prefix, allowed options: %(choices)s (ignored if init already called)",
|
|
111
|
+
)
|
|
112
|
+
clone.add_argument(
|
|
113
|
+
"--allrepos",
|
|
114
|
+
action="store_true",
|
|
115
|
+
help="Must be passed with -b/--branch. When set, it not only checkouts out the branch/tag for the fixture, but for all the subrepositories as well.",
|
|
116
|
+
)
|
|
117
|
+
clone.add_argument(
|
|
118
|
+
"--partial",
|
|
119
|
+
metavar="partial-type",
|
|
120
|
+
nargs="?",
|
|
121
|
+
default=None,
|
|
122
|
+
choices=["off", "blobless", "treeless"],
|
|
123
|
+
help='Style of partial clone, default: None, allowed options: %(choices)s. Off means a "normal" full git clone, blobless means cloning with "--filter=blob:none" and treeless means cloning with "--filter=tree:0". NOTE: We do *not* recommend using "treeless" as it is very aggressive and will cause problems with many git commands.',
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
def __list(self):
|
|
127
|
+
listcomps = self.subparsers.add_parser(
|
|
128
|
+
"list",
|
|
129
|
+
description="List all components that are being tracked",
|
|
130
|
+
aliases=mepoconfig.get_command_alias("list"),
|
|
131
|
+
)
|
|
132
|
+
listcomps.add_argument(
|
|
133
|
+
"-1", "--one-per-line", action="store_true", help="one component per line"
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def __status(self):
|
|
137
|
+
status = self.subparsers.add_parser(
|
|
138
|
+
"status",
|
|
139
|
+
description="Check current status of all components",
|
|
140
|
+
aliases=mepoconfig.get_command_alias("status"),
|
|
141
|
+
)
|
|
142
|
+
status.add_argument(
|
|
143
|
+
"--ignore-permissions",
|
|
144
|
+
action="store_true",
|
|
145
|
+
help="Tells command to ignore changes in file permissions.",
|
|
146
|
+
)
|
|
147
|
+
status.add_argument(
|
|
148
|
+
"--nocolor", action="store_true", help="Tells status to not display colors."
|
|
149
|
+
)
|
|
150
|
+
status.add_argument(
|
|
151
|
+
"--hashes", action="store_true", help="Print the exact hash of the HEAD."
|
|
152
|
+
)
|
|
153
|
+
status.add_argument(
|
|
154
|
+
"--serial", action="store_true", help="Run the serial version."
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
def __restore_state(self):
|
|
158
|
+
restore_state = self.subparsers.add_parser(
|
|
159
|
+
"restore-state",
|
|
160
|
+
description="Restores all components to the last saved state.",
|
|
161
|
+
aliases=mepoconfig.get_command_alias("restore-state"),
|
|
162
|
+
)
|
|
163
|
+
restore_state.add_argument(
|
|
164
|
+
"--serial", action="store_true", help="Run the serial version."
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def __diff(self):
|
|
168
|
+
diff = self.subparsers.add_parser(
|
|
169
|
+
"diff",
|
|
170
|
+
description="Diff all components",
|
|
171
|
+
aliases=mepoconfig.get_command_alias("diff"),
|
|
172
|
+
)
|
|
173
|
+
diff.add_argument(
|
|
174
|
+
"--name-only", action="store_true", help="Show only names of changed files"
|
|
175
|
+
)
|
|
176
|
+
diff.add_argument(
|
|
177
|
+
"--name-status",
|
|
178
|
+
action="store_true",
|
|
179
|
+
help="Show name-status of changed files",
|
|
180
|
+
)
|
|
181
|
+
diff.add_argument(
|
|
182
|
+
"--ignore-permissions",
|
|
183
|
+
action="store_true",
|
|
184
|
+
help="Tells command to ignore changes in file permissions.",
|
|
185
|
+
)
|
|
186
|
+
diff.add_argument(
|
|
187
|
+
"--staged", action="store_true", help="Show diff of staged changes"
|
|
188
|
+
)
|
|
189
|
+
diff.add_argument(
|
|
190
|
+
"-b",
|
|
191
|
+
"--ignore-space-change",
|
|
192
|
+
action="store_true",
|
|
193
|
+
help="Ignore changes in amount of whitespace",
|
|
194
|
+
)
|
|
195
|
+
diff.add_argument(
|
|
196
|
+
"comp_name",
|
|
197
|
+
metavar="comp-name",
|
|
198
|
+
nargs="*",
|
|
199
|
+
help="Component to list branches in",
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def __checkout(self):
|
|
203
|
+
checkout = self.subparsers.add_parser(
|
|
204
|
+
"checkout",
|
|
205
|
+
description="Switch to branch/tag `branch-name` in component `comp-name`. "
|
|
206
|
+
"If no components listed, checkout from all. "
|
|
207
|
+
"Specifying `-b` causes the branch `branch-name` to be created and checked out.",
|
|
208
|
+
aliases=mepoconfig.get_command_alias("checkout"),
|
|
209
|
+
)
|
|
210
|
+
checkout.add_argument(
|
|
211
|
+
"branch_name", metavar="branch-name", help="Name of branch"
|
|
212
|
+
)
|
|
213
|
+
checkout.add_argument(
|
|
214
|
+
"comp_name",
|
|
215
|
+
metavar="comp-name",
|
|
216
|
+
nargs="*",
|
|
217
|
+
help="Components to checkout branch in",
|
|
218
|
+
)
|
|
219
|
+
checkout.add_argument("-b", action="store_true", help="create the branch")
|
|
220
|
+
checkout.add_argument(
|
|
221
|
+
"-q", "--quiet", action="store_true", help="Suppress prints"
|
|
222
|
+
)
|
|
223
|
+
checkout.add_argument(
|
|
224
|
+
"--detach", action="store_true", help="Detach upon checkout"
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def __checkout_if_exists(self):
|
|
228
|
+
checkout_if_exists = self.subparsers.add_parser(
|
|
229
|
+
"checkout-if-exists",
|
|
230
|
+
description="Switch to branch or tag `ref-name` in any component where it is present. ",
|
|
231
|
+
aliases=mepoconfig.get_command_alias("checkout-if-exists"),
|
|
232
|
+
)
|
|
233
|
+
checkout_if_exists.add_argument(
|
|
234
|
+
"ref_name", metavar="ref-name", help="Name of branch or tag"
|
|
235
|
+
)
|
|
236
|
+
checkout_if_exists.add_argument(
|
|
237
|
+
"-q", "--quiet", action="store_true", help="Suppress prints"
|
|
238
|
+
)
|
|
239
|
+
checkout_if_exists.add_argument(
|
|
240
|
+
"--detach", action="store_true", help="Detach on checkout"
|
|
241
|
+
)
|
|
242
|
+
checkout_if_exists.add_argument(
|
|
243
|
+
"-n",
|
|
244
|
+
"--dry-run",
|
|
245
|
+
action="store_true",
|
|
246
|
+
help="Dry-run only (lists repos where branch exists)",
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def __changed_files(self):
|
|
250
|
+
changed_files = self.subparsers.add_parser(
|
|
251
|
+
"changed-files",
|
|
252
|
+
description="List files that have changes versus the state. By default runs against all components.",
|
|
253
|
+
aliases=mepoconfig.get_command_alias("changed-files"),
|
|
254
|
+
)
|
|
255
|
+
changed_files.add_argument(
|
|
256
|
+
"--full-path", action="store_true", help="Print with full path"
|
|
257
|
+
)
|
|
258
|
+
changed_files.add_argument(
|
|
259
|
+
"comp_name",
|
|
260
|
+
metavar="comp-name",
|
|
261
|
+
nargs="*",
|
|
262
|
+
help="Component to list branches in",
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
def __fetch(self):
|
|
266
|
+
fetch = self.subparsers.add_parser(
|
|
267
|
+
"fetch",
|
|
268
|
+
description="Download objects and refs from in component `comp-name`. "
|
|
269
|
+
"If no components listed, fetches from all",
|
|
270
|
+
aliases=mepoconfig.get_command_alias("fetch"),
|
|
271
|
+
)
|
|
272
|
+
fetch.add_argument(
|
|
273
|
+
"comp_name", metavar="comp-name", nargs="*", help="Components to fetch in"
|
|
274
|
+
)
|
|
275
|
+
fetch.add_argument("--all", action="store_true", help="Fetch all remotes.")
|
|
276
|
+
fetch.add_argument(
|
|
277
|
+
"-p", "--prune", action="store_true", help="Prune remote branches."
|
|
278
|
+
)
|
|
279
|
+
fetch.add_argument("-t", "--tags", action="store_true", help="Fetch tags.")
|
|
280
|
+
fetch.add_argument("-f", "--force", action="store_true", help="Force action.")
|
|
281
|
+
|
|
282
|
+
def __branch(self):
|
|
283
|
+
branch = self.subparsers.add_parser(
|
|
284
|
+
"branch",
|
|
285
|
+
description="Runs branch commands.",
|
|
286
|
+
aliases=mepoconfig.get_command_alias("branch"),
|
|
287
|
+
)
|
|
288
|
+
MepoBranchArgParser(branch)
|
|
289
|
+
|
|
290
|
+
def __stash(self):
|
|
291
|
+
stash = self.subparsers.add_parser(
|
|
292
|
+
"stash",
|
|
293
|
+
description="Runs stash commands.",
|
|
294
|
+
aliases=mepoconfig.get_command_alias("stash"),
|
|
295
|
+
)
|
|
296
|
+
MepoStashArgParser(stash)
|
|
297
|
+
|
|
298
|
+
def __tag(self):
|
|
299
|
+
tag = self.subparsers.add_parser(
|
|
300
|
+
"tag",
|
|
301
|
+
description="Runs tag commands.",
|
|
302
|
+
aliases=mepoconfig.get_command_alias("tag"),
|
|
303
|
+
)
|
|
304
|
+
MepoTagArgParser(tag)
|
|
305
|
+
|
|
306
|
+
def __develop(self):
|
|
307
|
+
develop = self.subparsers.add_parser(
|
|
308
|
+
"develop",
|
|
309
|
+
description="Checkout current version of 'develop' branches of specified components",
|
|
310
|
+
aliases=mepoconfig.get_command_alias("develop"),
|
|
311
|
+
)
|
|
312
|
+
develop.add_argument(
|
|
313
|
+
"comp_name",
|
|
314
|
+
metavar="comp-name",
|
|
315
|
+
nargs="+",
|
|
316
|
+
default=None,
|
|
317
|
+
help="Component(s) to checkout development branches",
|
|
318
|
+
)
|
|
319
|
+
develop.add_argument(
|
|
320
|
+
"-q", "--quiet", action="store_true", help="Suppress prints"
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
def __pull(self):
|
|
324
|
+
pull = self.subparsers.add_parser(
|
|
325
|
+
"pull",
|
|
326
|
+
description="Pull branches of specified components",
|
|
327
|
+
aliases=mepoconfig.get_command_alias("pull"),
|
|
328
|
+
)
|
|
329
|
+
pull.add_argument(
|
|
330
|
+
"comp_name",
|
|
331
|
+
metavar="comp-name",
|
|
332
|
+
nargs="+",
|
|
333
|
+
default=None,
|
|
334
|
+
help="Components to pull in",
|
|
335
|
+
)
|
|
336
|
+
pull.add_argument("-q", "--quiet", action="store_true", help="Suppress prints")
|
|
337
|
+
|
|
338
|
+
def __pull_all(self):
|
|
339
|
+
pull_all = self.subparsers.add_parser(
|
|
340
|
+
"pull-all",
|
|
341
|
+
description="Pull branches of all components (only those in non-detached HEAD state)",
|
|
342
|
+
aliases=mepoconfig.get_command_alias("pull-all"),
|
|
343
|
+
)
|
|
344
|
+
pull_all.add_argument(
|
|
345
|
+
"-q", "--quiet", action="store_true", help="Suppress prints"
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
def __compare(self):
|
|
349
|
+
compare = self.subparsers.add_parser(
|
|
350
|
+
"compare",
|
|
351
|
+
description="Compare current and original states of all components. "
|
|
352
|
+
"Will only show differing repos unless --all is passed in",
|
|
353
|
+
aliases=mepoconfig.get_command_alias("compare"),
|
|
354
|
+
)
|
|
355
|
+
compare.add_argument(
|
|
356
|
+
"--all",
|
|
357
|
+
action="store_true",
|
|
358
|
+
help="Show all repos, not only differing repos",
|
|
359
|
+
)
|
|
360
|
+
compare.add_argument(
|
|
361
|
+
"--nocolor",
|
|
362
|
+
action="store_true",
|
|
363
|
+
help="Tells command to not display colors.",
|
|
364
|
+
)
|
|
365
|
+
compare.add_argument(
|
|
366
|
+
"--wrap",
|
|
367
|
+
action="store_true",
|
|
368
|
+
help="Tells command to ignore terminal size and wrap",
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
def __reset(self):
|
|
372
|
+
reset = self.subparsers.add_parser(
|
|
373
|
+
"reset",
|
|
374
|
+
description="Reset the current mepo clone to the original state. "
|
|
375
|
+
"This will delete all subrepos and does not check for uncommitted changes! "
|
|
376
|
+
"Must be run in the root of the mepo clone.",
|
|
377
|
+
aliases=mepoconfig.get_command_alias("reset"),
|
|
378
|
+
)
|
|
379
|
+
reset.add_argument("-f", "--force", action="store_true", help="Force action.")
|
|
380
|
+
reset.add_argument(
|
|
381
|
+
"--reclone", action="store_true", help="Reclone repos after reset."
|
|
382
|
+
)
|
|
383
|
+
reset.add_argument("-n", "--dry-run", action="store_true", help="Dry-run only")
|
|
384
|
+
|
|
385
|
+
def __whereis(self):
|
|
386
|
+
whereis = self.subparsers.add_parser(
|
|
387
|
+
"whereis",
|
|
388
|
+
description="Get the location of component `comp-name` "
|
|
389
|
+
"relative to my current location. If `comp-name` is not present, "
|
|
390
|
+
"get the relative locations of ALL components.",
|
|
391
|
+
aliases=mepoconfig.get_command_alias("whereis"),
|
|
392
|
+
)
|
|
393
|
+
whereis.add_argument(
|
|
394
|
+
"comp_name",
|
|
395
|
+
metavar="comp-name",
|
|
396
|
+
nargs="?",
|
|
397
|
+
default=None,
|
|
398
|
+
help="Component to get location of",
|
|
399
|
+
)
|
|
400
|
+
whereis.add_argument(
|
|
401
|
+
"-i", "--ignore-case", action="store_true", help="Ignore case for whereis"
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
def __stage(self):
|
|
405
|
+
stage = self.subparsers.add_parser(
|
|
406
|
+
"stage",
|
|
407
|
+
description="Stage modified & untracked files in the specified component(s)",
|
|
408
|
+
aliases=mepoconfig.get_command_alias("stage"),
|
|
409
|
+
)
|
|
410
|
+
stage.add_argument(
|
|
411
|
+
"--untracked", action="store_true", help="Stage untracked files as well"
|
|
412
|
+
)
|
|
413
|
+
stage.add_argument(
|
|
414
|
+
"comp_name",
|
|
415
|
+
metavar="comp-name",
|
|
416
|
+
nargs="+",
|
|
417
|
+
help="Component to stage file in",
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
def __unstage(self):
|
|
421
|
+
unstage = self.subparsers.add_parser(
|
|
422
|
+
"unstage",
|
|
423
|
+
description="Un-stage staged files. "
|
|
424
|
+
"If a component is specified, files are un-staged only for that component.",
|
|
425
|
+
aliases=mepoconfig.get_command_alias("unstage"),
|
|
426
|
+
)
|
|
427
|
+
unstage.add_argument(
|
|
428
|
+
"comp_name",
|
|
429
|
+
metavar="comp-name",
|
|
430
|
+
nargs="*",
|
|
431
|
+
help="Component to unstage in",
|
|
432
|
+
default=None,
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
def __commit(self):
|
|
436
|
+
commit = self.subparsers.add_parser(
|
|
437
|
+
"commit",
|
|
438
|
+
description="Commit staged files in the specified components",
|
|
439
|
+
aliases=mepoconfig.get_command_alias("commit"),
|
|
440
|
+
)
|
|
441
|
+
commit.add_argument(
|
|
442
|
+
"-a",
|
|
443
|
+
"--all",
|
|
444
|
+
action="store_true",
|
|
445
|
+
help="Stage all tracked files and then commit",
|
|
446
|
+
)
|
|
447
|
+
commit.add_argument(
|
|
448
|
+
"-m",
|
|
449
|
+
"--message",
|
|
450
|
+
type=str,
|
|
451
|
+
metavar="message",
|
|
452
|
+
default=None,
|
|
453
|
+
help="Message to commit with",
|
|
454
|
+
)
|
|
455
|
+
commit.add_argument(
|
|
456
|
+
"comp_name",
|
|
457
|
+
metavar="comp-name",
|
|
458
|
+
nargs="+",
|
|
459
|
+
help="Component to commit file in",
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
def __push(self):
|
|
463
|
+
push = self.subparsers.add_parser(
|
|
464
|
+
"push",
|
|
465
|
+
description="Push local commits to remote for specified component. "
|
|
466
|
+
"Use mepo tag push to push tags",
|
|
467
|
+
aliases=mepoconfig.get_command_alias("push"),
|
|
468
|
+
)
|
|
469
|
+
push.add_argument(
|
|
470
|
+
"comp_name",
|
|
471
|
+
metavar="comp-name",
|
|
472
|
+
nargs="+",
|
|
473
|
+
help="Component to push to remote",
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
def __save(self):
|
|
477
|
+
save = self.subparsers.add_parser(
|
|
478
|
+
"save",
|
|
479
|
+
description="Save current state in a yaml registry",
|
|
480
|
+
aliases=mepoconfig.get_command_alias("save"),
|
|
481
|
+
)
|
|
482
|
+
save.add_argument(
|
|
483
|
+
"registry",
|
|
484
|
+
metavar="registry",
|
|
485
|
+
nargs="?",
|
|
486
|
+
default="components-new.yaml",
|
|
487
|
+
help="default: %(default)s",
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
def __config(self):
|
|
491
|
+
config = self.subparsers.add_parser(
|
|
492
|
+
"config",
|
|
493
|
+
description="Runs config commands.",
|
|
494
|
+
aliases=mepoconfig.get_command_alias("config"),
|
|
495
|
+
)
|
|
496
|
+
MepoConfigArgParser(config)
|
|
497
|
+
|
|
498
|
+
def __update_state(self):
|
|
499
|
+
_ = self.subparsers.add_parser(
|
|
500
|
+
"update-state",
|
|
501
|
+
description="Permanently update mepo1 state to current",
|
|
502
|
+
aliases=mepoconfig.get_command_alias("update-state"),
|
|
503
|
+
)
|