batchfetch 1.2.9__tar.gz → 1.3.1__tar.gz
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.
- {batchfetch-1.2.9 → batchfetch-1.3.1}/PKG-INFO +19 -4
- {batchfetch-1.2.9 → batchfetch-1.3.1}/README.md +18 -3
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch/batchfetch_base.py +29 -13
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch/batchfetch_cli.py +24 -14
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch/batchfetch_git.py +3 -4
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/PKG-INFO +19 -4
- {batchfetch-1.2.9 → batchfetch-1.3.1}/setup.py +1 -1
- {batchfetch-1.2.9 → batchfetch-1.3.1}/LICENSE +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch/__init__.py +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch/helpers.py +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.2.9 → batchfetch-1.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: batchfetch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Efficiently clone and pull multiple Git repositories.
|
|
5
5
|
Home-page: https://github.com/jamescherti/batchfetch
|
|
6
6
|
Author: James Cherti
|
|
@@ -117,13 +117,13 @@ The parent directory of the "path:" value defines the managed directory, where t
|
|
|
117
117
|
|
|
118
118
|
For example, if the "path:" value is `file/my-project`, the managed directory will be `file/`. Any file within `file/` that is not managed by batchfetch will be considered an untracked file.
|
|
119
119
|
|
|
120
|
-
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.
|
|
120
|
+
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.ignore_untracked` list, enabling users to manage untracked files effectively.
|
|
121
121
|
|
|
122
122
|
Here is an example of a *batchfetch.yaml* file that enables *batchfetch* to accept a list of untracked files:
|
|
123
123
|
|
|
124
124
|
``` yaml
|
|
125
125
|
options:
|
|
126
|
-
|
|
126
|
+
ignore_untracked:
|
|
127
127
|
- ./test
|
|
128
128
|
- /absolute/path
|
|
129
129
|
- ../relative/path
|
|
@@ -132,7 +132,7 @@ tasks:
|
|
|
132
132
|
- git: https://github.com/user/project
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *
|
|
135
|
+
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *ignore_untracked* option.
|
|
136
136
|
|
|
137
137
|
### How is the Git local paths handled?
|
|
138
138
|
|
|
@@ -196,6 +196,21 @@ batchfetch easysession
|
|
|
196
196
|
|
|
197
197
|
This will execute only the task corresponding to the `easysession` path, skipping all others in the `batchfetch.yml` file.
|
|
198
198
|
|
|
199
|
+
### How can I configure batchfetch to load a file other than batchfetch.yaml?
|
|
200
|
+
|
|
201
|
+
You can specify the configuration file using the `-f` command-line option:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
batchfetch -f alternative-batchfetch.yaml
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Alternatively, you can set the `BATCHFETCH_FILE` environment variable:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
export BATCHFETCH_FILE=alternative-batchfetch.yaml
|
|
211
|
+
batchfetch
|
|
212
|
+
```
|
|
213
|
+
|
|
199
214
|
## License
|
|
200
215
|
|
|
201
216
|
Copyright (C) 2024 [James Cherti](https://www.jamescherti.com)
|
|
@@ -97,13 +97,13 @@ The parent directory of the "path:" value defines the managed directory, where t
|
|
|
97
97
|
|
|
98
98
|
For example, if the "path:" value is `file/my-project`, the managed directory will be `file/`. Any file within `file/` that is not managed by batchfetch will be considered an untracked file.
|
|
99
99
|
|
|
100
|
-
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.
|
|
100
|
+
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.ignore_untracked` list, enabling users to manage untracked files effectively.
|
|
101
101
|
|
|
102
102
|
Here is an example of a *batchfetch.yaml* file that enables *batchfetch* to accept a list of untracked files:
|
|
103
103
|
|
|
104
104
|
``` yaml
|
|
105
105
|
options:
|
|
106
|
-
|
|
106
|
+
ignore_untracked:
|
|
107
107
|
- ./test
|
|
108
108
|
- /absolute/path
|
|
109
109
|
- ../relative/path
|
|
@@ -112,7 +112,7 @@ tasks:
|
|
|
112
112
|
- git: https://github.com/user/project
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *
|
|
115
|
+
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *ignore_untracked* option.
|
|
116
116
|
|
|
117
117
|
### How is the Git local paths handled?
|
|
118
118
|
|
|
@@ -176,6 +176,21 @@ batchfetch easysession
|
|
|
176
176
|
|
|
177
177
|
This will execute only the task corresponding to the `easysession` path, skipping all others in the `batchfetch.yml` file.
|
|
178
178
|
|
|
179
|
+
### How can I configure batchfetch to load a file other than batchfetch.yaml?
|
|
180
|
+
|
|
181
|
+
You can specify the configuration file using the `-f` command-line option:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
batchfetch -f alternative-batchfetch.yaml
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Alternatively, you can set the `BATCHFETCH_FILE` environment variable:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
export BATCHFETCH_FILE=alternative-batchfetch.yaml
|
|
191
|
+
batchfetch
|
|
192
|
+
```
|
|
193
|
+
|
|
179
194
|
## License
|
|
180
195
|
|
|
181
196
|
Copyright (C) 2024 [James Cherti](https://www.jamescherti.com)
|
|
@@ -107,7 +107,7 @@ class TaskBatchFetch(TaskBase):
|
|
|
107
107
|
self.global_options_schema: Dict[Any, Any] = {
|
|
108
108
|
Optional("exec_before"): Or([str], str),
|
|
109
109
|
Optional("exec_after"): Or([str], str),
|
|
110
|
-
Optional("
|
|
110
|
+
Optional("ignore_untracked"): Or([str], str),
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
self.task_schema: Dict[Any, Any] = {
|
|
@@ -121,7 +121,7 @@ class TaskBatchFetch(TaskBase):
|
|
|
121
121
|
self.global_options_values: Dict[str, Any] = {
|
|
122
122
|
"exec_before": [],
|
|
123
123
|
"exec_after": [],
|
|
124
|
-
"
|
|
124
|
+
"ignore_untracked": [],
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
self.task_default_values: Dict[str, Any] = {
|
|
@@ -138,28 +138,44 @@ class TaskBatchFetch(TaskBase):
|
|
|
138
138
|
# Mark values as initialized
|
|
139
139
|
self._values_initialized = True
|
|
140
140
|
|
|
141
|
-
def
|
|
142
|
-
stdout = run_indent_str(
|
|
143
|
-
|
|
141
|
+
def _local_task_exec(self, *args, **kwargs):
|
|
142
|
+
stdout = run_indent_str(env=self.env, spaces=self.indent,
|
|
143
|
+
*args, **kwargs)
|
|
144
144
|
if not stdout.endswith("\n"):
|
|
145
145
|
stdout += "\n"
|
|
146
146
|
self.add_output(stdout)
|
|
147
147
|
|
|
148
|
-
def
|
|
148
|
+
def _exec_before(self, cwd: os.PathLike = Path(".")):
|
|
149
149
|
self._initialize_data()
|
|
150
|
-
|
|
151
|
-
if self["delete"] or not cmd:
|
|
150
|
+
if self["delete"]:
|
|
152
151
|
return
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
# Global
|
|
154
|
+
cmd = self.options["exec_before"] \
|
|
155
|
+
if "exec_before" in self.options else None
|
|
156
|
+
if cmd:
|
|
157
|
+
self._local_task_exec(cmd, cwd=str(cwd))
|
|
158
|
+
|
|
159
|
+
# Local
|
|
160
|
+
cmd = self["exec_before"]
|
|
161
|
+
if cmd:
|
|
162
|
+
self._local_task_exec(cmd, cwd=str(cwd))
|
|
155
163
|
|
|
156
|
-
def
|
|
164
|
+
def _exec_after(self, cwd: os.PathLike = Path(".")):
|
|
157
165
|
self._initialize_data()
|
|
158
|
-
|
|
159
|
-
if not cmd or self["delete"] or not self.is_changed():
|
|
166
|
+
if self["delete"] or not self.is_changed():
|
|
160
167
|
return
|
|
161
168
|
|
|
162
|
-
|
|
169
|
+
# Local
|
|
170
|
+
cmd = self.options["exec_after"] \
|
|
171
|
+
if "exec_after" in self.options else None
|
|
172
|
+
if cmd:
|
|
173
|
+
self._local_task_exec(cmd, cwd=str(cwd))
|
|
174
|
+
|
|
175
|
+
# Local
|
|
176
|
+
cmd = self["exec_after"]
|
|
177
|
+
if cmd:
|
|
178
|
+
self._local_task_exec(cmd, cwd=str(cwd))
|
|
163
179
|
|
|
164
180
|
def is_changed(self) -> bool:
|
|
165
181
|
self._initialize_data()
|
|
@@ -47,7 +47,7 @@ class BatchFetchCli:
|
|
|
47
47
|
self.cfg: dict = {}
|
|
48
48
|
self.check_untracked = check_untracked
|
|
49
49
|
self.tracked_paths: Dict[Path, Set[str]] = {}
|
|
50
|
-
self.
|
|
50
|
+
self.ignore_untracked: Set[Path] = set()
|
|
51
51
|
self.verbose = verbose
|
|
52
52
|
self.max_workers = max_workers
|
|
53
53
|
self.dirs_relative_to_batchfetch: Set[str] = set()
|
|
@@ -100,20 +100,20 @@ class BatchFetchCli:
|
|
|
100
100
|
file=sys.stderr)
|
|
101
101
|
sys.exit(1)
|
|
102
102
|
|
|
103
|
-
self.
|
|
104
|
-
self.
|
|
103
|
+
self.ignore_untracked.add(Path(path).absolute())
|
|
104
|
+
self.ignore_untracked.add(Path(path).resolve())
|
|
105
105
|
untracked_paths = None
|
|
106
106
|
if "options" in yaml_dict and \
|
|
107
|
-
"
|
|
107
|
+
"ignore_untracked" in yaml_dict["options"]:
|
|
108
108
|
untracked_paths = \
|
|
109
|
-
yaml_dict["options"]["
|
|
109
|
+
yaml_dict["options"]["ignore_untracked"]
|
|
110
110
|
|
|
111
111
|
if isinstance(untracked_paths, str):
|
|
112
112
|
untracked_paths = [untracked_paths]
|
|
113
113
|
|
|
114
114
|
if untracked_paths:
|
|
115
115
|
for ignore_untracked_path in untracked_paths:
|
|
116
|
-
self.
|
|
116
|
+
self.ignore_untracked.add(
|
|
117
117
|
Path(ignore_untracked_path).absolute()
|
|
118
118
|
)
|
|
119
119
|
|
|
@@ -277,7 +277,7 @@ class BatchFetchCli:
|
|
|
277
277
|
actual_filenames = {file.name for file in tracked_dir.iterdir()}
|
|
278
278
|
for filename in actual_filenames - tracked_filenames:
|
|
279
279
|
full_path = tracked_dir / filename
|
|
280
|
-
if full_path in self.
|
|
280
|
+
if full_path in self.ignore_untracked:
|
|
281
281
|
continue
|
|
282
282
|
|
|
283
283
|
untracked_paths.add(full_path)
|
|
@@ -291,13 +291,19 @@ class BatchFetchCli:
|
|
|
291
291
|
"\n")
|
|
292
292
|
err_str += ("The paths above are not managed by batchfetch."
|
|
293
293
|
" To retain them, add them to the "
|
|
294
|
-
"options.
|
|
294
|
+
"options.ignore_untracked list, using either "
|
|
295
295
|
"relative or absolute paths")
|
|
296
296
|
raise BatchFetchError(err_str)
|
|
297
297
|
|
|
298
298
|
|
|
299
299
|
def parse_args():
|
|
300
300
|
"""Parse the command line arguments."""
|
|
301
|
+
# Batchfetch file
|
|
302
|
+
try:
|
|
303
|
+
batchfetch_file = os.environ["BATCHFETCH_FILE"]
|
|
304
|
+
except KeyError:
|
|
305
|
+
batchfetch_file = None
|
|
306
|
+
|
|
301
307
|
# Jobs
|
|
302
308
|
try:
|
|
303
309
|
jobs = os.environ["BATCHFETCH_JOBS"]
|
|
@@ -326,12 +332,16 @@ def parse_args():
|
|
|
326
332
|
"paths defined in the batchfetch.yml list of tasks."),
|
|
327
333
|
)
|
|
328
334
|
|
|
329
|
-
parser.add_argument(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
+
parser.add_argument(
|
|
336
|
+
"-f",
|
|
337
|
+
"--file",
|
|
338
|
+
default=batchfetch_file,
|
|
339
|
+
required=False,
|
|
340
|
+
help=("Specify the batchfetch YAML file "
|
|
341
|
+
"(default: './batchfetch.yaml')."
|
|
342
|
+
"Alternatively, the BATCHFETCH_FILE environment variable can be "
|
|
343
|
+
"used to configure the number of jobs."),
|
|
344
|
+
)
|
|
335
345
|
|
|
336
346
|
parser.add_argument(
|
|
337
347
|
"-C",
|
|
@@ -133,7 +133,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
133
133
|
# Pre exec
|
|
134
134
|
self._update_current_branch_name()
|
|
135
135
|
self._repo_fix_remote_origin()
|
|
136
|
-
self.
|
|
136
|
+
self._exec_before(cwd=self.git_local_dir)
|
|
137
137
|
|
|
138
138
|
if not self["revision"]:
|
|
139
139
|
self.values["revision"] = self._run_get_firstline(
|
|
@@ -158,7 +158,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
158
158
|
git_merge_done = self._git_merge()
|
|
159
159
|
|
|
160
160
|
if self.get_changed():
|
|
161
|
-
self.
|
|
161
|
+
self._exec_after(cwd=self.git_local_dir)
|
|
162
162
|
except BatchFetchError as err:
|
|
163
163
|
self.set_error(True)
|
|
164
164
|
self.add_output(self.indent_spaces + "[ERROR] " + str(err) + "\n")
|
|
@@ -268,8 +268,7 @@ class BatchFetchGit(TaskBatchFetch):
|
|
|
268
268
|
|
|
269
269
|
try:
|
|
270
270
|
# Check if the revision such as
|
|
271
|
-
stdout, _ = self._run(["git", "cat-file", "-e",
|
|
272
|
-
self["revision"]])
|
|
271
|
+
stdout, _ = self._run(["git", "cat-file", "-e", self["revision"]])
|
|
273
272
|
except subprocess.CalledProcessError:
|
|
274
273
|
do_git_fetch = True
|
|
275
274
|
self.add_output(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: batchfetch
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Efficiently clone and pull multiple Git repositories.
|
|
5
5
|
Home-page: https://github.com/jamescherti/batchfetch
|
|
6
6
|
Author: James Cherti
|
|
@@ -117,13 +117,13 @@ The parent directory of the "path:" value defines the managed directory, where t
|
|
|
117
117
|
|
|
118
118
|
For example, if the "path:" value is `file/my-project`, the managed directory will be `file/`. Any file within `file/` that is not managed by batchfetch will be considered an untracked file.
|
|
119
119
|
|
|
120
|
-
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.
|
|
120
|
+
When *batchfetch* encounters an untracked file, it displays an error message to inform users about paths that are not managed by the system. The message provides clear instructions on how to handle these paths by adding them to the `options.ignore_untracked` list, enabling users to manage untracked files effectively.
|
|
121
121
|
|
|
122
122
|
Here is an example of a *batchfetch.yaml* file that enables *batchfetch* to accept a list of untracked files:
|
|
123
123
|
|
|
124
124
|
``` yaml
|
|
125
125
|
options:
|
|
126
|
-
|
|
126
|
+
ignore_untracked:
|
|
127
127
|
- ./test
|
|
128
128
|
- /absolute/path
|
|
129
129
|
- ../relative/path
|
|
@@ -132,7 +132,7 @@ tasks:
|
|
|
132
132
|
- git: https://github.com/user/project
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *
|
|
135
|
+
By default, *batchfetch.yaml* is the only untracked file that is ignored. The user does not need to add it to the *ignore_untracked* option.
|
|
136
136
|
|
|
137
137
|
### How is the Git local paths handled?
|
|
138
138
|
|
|
@@ -196,6 +196,21 @@ batchfetch easysession
|
|
|
196
196
|
|
|
197
197
|
This will execute only the task corresponding to the `easysession` path, skipping all others in the `batchfetch.yml` file.
|
|
198
198
|
|
|
199
|
+
### How can I configure batchfetch to load a file other than batchfetch.yaml?
|
|
200
|
+
|
|
201
|
+
You can specify the configuration file using the `-f` command-line option:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
batchfetch -f alternative-batchfetch.yaml
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Alternatively, you can set the `BATCHFETCH_FILE` environment variable:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
export BATCHFETCH_FILE=alternative-batchfetch.yaml
|
|
211
|
+
batchfetch
|
|
212
|
+
```
|
|
213
|
+
|
|
199
214
|
## License
|
|
200
215
|
|
|
201
216
|
Copyright (C) 2024 [James Cherti](https://www.jamescherti.com)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|