| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bfbd5ec commit 24f75e7
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -309,7 +309,7 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath): | |||
| 309 | 309 | #{ Edit Interface | |
| 310 | 310 | ||
| 311 | 311 | @classmethod | |
| 312 | - def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=None): | ||
| 312 | + def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=None, env=None): | ||
| 313 | 313 | """Add a new submodule to the given repository. This will alter the index | |
| 314 | 314 | as well as the .gitmodules file, but will not create a new commit. | |
| 315 | 315 | If the submodule already exists, no matter if the configuration differs | |
@@ -336,6 +336,12 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N | |||
| 336 | 336 | no checkout will be performed | |
| 337 | 337 | :param depth: Create a shallow clone with a history truncated to the | |
| 338 | 338 | specified number of commits. | |
| 339 | + :param env: Optional dictionary containing the desired environment variables. | ||
| 340 | + Note: Provided variables will be used to update the execution | ||
| 341 | + environment for `git`. If some variable is not specified in `env` | ||
| 342 | + and is defined in `os.environ`, value from `os.environ` will be used. | ||
| 343 | + If you want to unset some variable, consider providing empty string | ||
| 344 | + as its value. | ||
| 339 | 345 | :return: The newly created submodule instance | |
| 340 | 346 | :note: works atomically, such that no change will be done if the repository | |
| 341 | 347 | update fails for instance""" | |
@@ -404,7 +410,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N | |||
| 404 | 410 | raise ValueError("depth should be an integer") | |
| 405 | 411 | ||
| 406 | 412 | # _clone_repo(cls, repo, url, path, name, **kwargs): | |
| 407 | - mrepo = cls._clone_repo(repo, url, path, name, **kwargs) | ||
| 413 | + mrepo = cls._clone_repo(repo, url, path, name, env=env, **kwargs) | ||
| 408 | 414 | # END verify url | |
| 409 | 415 | ||
| 410 | 416 | ## See #525 for ensuring git urls in config-files valid under Windows. | |
@@ -436,7 +442,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False, depth=N | |||
| 436 | 442 | return sm | |
| 437 | 443 | ||
| 438 | 444 | def update(self, recursive=False, init=True, to_latest_revision=False, progress=None, dry_run=False, | |
| 439 | - force=False, keep_going=False): | ||
| 445 | + force=False, keep_going=False, env=None): | ||
| 440 | 446 | """Update the repository of this submodule to point to the checkout | |
| 441 | 447 | we point at with the binsha of this instance. | |
| 442 | 448 | ||
@@ -461,6 +467,12 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 461 | 467 | Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see | |
| 462 | 468 | otherwise. | |
| 463 | 469 | In conjunction with dry_run, it can be useful to anticipate all errors when updating submodules | |
| 470 | + :param env: Optional dictionary containing the desired environment variables. | ||
| 471 | + Note: Provided variables will be used to update the execution | ||
| 472 | + environment for `git`. If some variable is not specified in `env` | ||
| 473 | + and is defined in `os.environ`, value from `os.environ` will be used. | ||
| 474 | + If you want to unset some variable, consider providing empty string | ||
| 475 | + as its value. | ||
| 464 | 476 | :note: does nothing in bare repositories | |
| 465 | 477 | :note: method is definitely not atomic if recurisve is True | |
| 466 | 478 | :return: self""" | |
@@ -527,7 +539,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 527 | 539 | progress.update(BEGIN | CLONE, 0, 1, prefix + "Cloning url '%s' to '%s' in submodule %r" % | |
| 528 | 540 | (self.url, checkout_module_abspath, self.name)) | |
| 529 | 541 | if not dry_run: | |
| 530 | - mrepo = self._clone_repo(self.repo, self.url, self.path, self.name, n=True) | ||
| 542 | + mrepo = self._clone_repo(self.repo, self.url, self.path, self.name, n=True, env=env) | ||
| 531 | 543 | # END handle dry-run | |
| 532 | 544 | progress.update(END | CLONE, 0, 1, prefix + "Done cloning to %s" % checkout_module_abspath) | |
| 533 | 545 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments