| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ Changelog | |||
| 8 | 8 | * `[include]` sections in git configuration files are now respected | |
| 9 | 9 | * Added `GitConfigParser.rename_section()` | |
| 10 | 10 | * Added `Submodule.rename()` | |
| 11 | + * **POSSIBLY BREAKING CHANGE**: As `rev_parse` will now throw `BadName` as well as `BadObject`, client code will have to catch both exception types. | ||
| 11 | 12 | * A list of all issues can be found here: https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.6+-+Features%22+ | |
| 12 | 13 | ||
| 13 | 14 | 0.3.5 - Bugfixes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,7 +116,7 @@ def _set_cache_(self, attr): | |||
| 116 | 116 | except cp.NoSectionError: | |
| 117 | 117 | raise ValueError("This submodule instance does not exist anymore in '%s' file" | |
| 118 | 118 | % os.path.join(self.repo.working_tree_dir, '.gitmodules')) | |
| 119 | - # end | ||
| 119 | + # end | ||
| 120 | 120 | self._url = reader.get_value('url') | |
| 121 | 121 | # git-python extension values - optional | |
| 122 | 122 | self._branch_path = reader.get_value(self.k_head_option, git.Head.to_full_path(self.k_head_default)) | |
@@ -411,7 +411,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 411 | 411 | del(writer) | |
| 412 | 412 | ||
| 413 | 413 | # we deliberatly assume that our head matches our index ! | |
| 414 | - | ||
| 414 | + | ||
| 415 | 415 | try: | |
| 416 | 416 | repo.head.commit | |
| 417 | 417 | parent_repo_is_empty = False | |
@@ -429,7 +429,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): | |||
| 429 | 429 | return sm | |
| 430 | 430 | ||
| 431 | 431 | def update(self, recursive=False, init=True, to_latest_revision=False, progress=None, dry_run=False, | |
| 432 | - force=False, keep_going=False): | ||
| 432 | + force=False, keep_going=False): | ||
| 433 | 433 | """Update the repository of this submodule to point to the checkout | |
| 434 | 434 | we point at with the binsha of this instance. | |
| 435 | 435 | ||
@@ -444,14 +444,14 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 444 | 444 | :param progress: UpdateProgress instance or None of no progress should be shown | |
| 445 | 445 | :param dry_run: if True, the operation will only be simulated, but not performed. | |
| 446 | 446 | All performed operations are read-only | |
| 447 | - :param force: | ||
| 447 | + :param force: | ||
| 448 | 448 | If True, we may reset heads even if the repository in question is dirty. Additinoally we will be allowed | |
| 449 | - to set a tracking branch which is ahead of its remote branch back into the past or the location of the | ||
| 449 | + to set a tracking branch which is ahead of its remote branch back into the past or the location of the | ||
| 450 | 450 | remote branch. This will essentially 'forget' commits. | |
| 451 | - If False, local tracking branches that are in the future of their respective remote branches will simply | ||
| 451 | + If False, local tracking branches that are in the future of their respective remote branches will simply | ||
| 452 | 452 | not be moved. | |
| 453 | - :param keep_going: if True, we will ignore but log all errors, and keep going recursively. | ||
| 454 | - Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see | ||
| 453 | + :param keep_going: if True, we will ignore but log all errors, and keep going recursively. | ||
| 454 | + Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see | ||
| 455 | 455 | otherwise. | |
| 456 | 456 | In conjunction with dry_run, it can be useful to anticipate all errors when updating submodules | |
| 457 | 457 | :note: does nothing in bare repositories | |
@@ -487,7 +487,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 487 | 487 | op |= BEGIN | |
| 488 | 488 | # END handle start | |
| 489 | 489 | ||
| 490 | - progress.update(op, i, len_rmts, prefix + "Fetching remote %s of submodule %r" % (remote, self.name)) | ||
| 490 | + progress.update(op, i, len_rmts, prefix + "Fetching remote %s of submodule %r" | ||
| 491 | + % (remote, self.name)) | ||
| 491 | 492 | #=============================== | |
| 492 | 493 | if not dry_run: | |
| 493 | 494 | remote.fetch(progress=progress) | |
@@ -589,11 +590,11 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 589 | 590 | base_commit = mrepo.merge_base(mrepo.head.commit, hexsha) | |
| 590 | 591 | if len(base_commit) == 0 or base_commit[0].hexsha == hexsha: | |
| 591 | 592 | if force: | |
| 592 | - log.debug("Will force checkout or reset on local branch that is possibly in the future of" + | ||
| 593 | - "the commit it will be checked out to, effectively 'forgetting' new commits") | ||
| 593 | + log.debug("Will force checkout or reset on local branch that is possibly in the future of" | ||
| 594 | + + "the commit it will be checked out to, effectively 'forgetting' new commits") | ||
| 594 | 595 | else: | |
| 595 | - log.info("Skipping %s on branch '%s' of submodule repo '%s' as it contains un-pushed commits", | ||
| 596 | - is_detached and "checkout" or "reset", mrepo.head, mrepo) | ||
| 596 | + log.info("Skipping %s on branch '%s' of submodule repo '%s' as it contains " | ||
| 597 | + + "un-pushed commits", is_detached and "checkout" or "reset", mrepo.head, mrepo) | ||
| 597 | 598 | may_reset = False | |
| 598 | 599 | # end handle force | |
| 599 | 600 | # end handle if we are in the future | |
@@ -619,7 +620,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 619 | 620 | mrepo.head.reset(hexsha, index=True, working_tree=True) | |
| 620 | 621 | # END handle checkout | |
| 621 | 622 | # if we may reset/checkout | |
| 622 | - progress.update(END | UPDWKTREE, 0, 1, prefix + "Done updating working tree for submodule %r" % self.name) | ||
| 623 | + progress.update(END | UPDWKTREE, 0, 1, prefix + "Done updating working tree for submodule %r" | ||
| 624 | + % self.name) | ||
| 623 | 625 | # END update to new commit only if needed | |
| 624 | 626 | except Exception as err: | |
| 625 | 627 | if not keep_going: | |
@@ -633,7 +635,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= | |||
| 633 | 635 | # in dry_run mode, the module might not exist | |
| 634 | 636 | if mrepo is not None: | |
| 635 | 637 | for submodule in self.iter_items(self.module()): | |
| 636 | - submodule.update(recursive, init, to_latest_revision, progress=progress, dry_run=dry_run, | ||
| 638 | + submodule.update(recursive, init, to_latest_revision, progress=progress, dry_run=dry_run, | ||
| 637 | 639 | force=force, keep_going=keep_going) | |
| 638 | 640 | # END handle recursive update | |
| 639 | 641 | # END handle dry run | |
@@ -898,14 +900,14 @@ def set_parent_commit(self, commit, check=True): | |||
| 898 | 900 | """Set this instance to use the given commit whose tree is supposed to | |
| 899 | 901 | contain the .gitmodules blob. | |
| 900 | 902 | ||
| 901 | - :param commit: | ||
| 902 | - Commit'ish reference pointing at the root_tree, or None to always point to the | ||
| 903 | + :param commit: | ||
| 904 | + Commit'ish reference pointing at the root_tree, or None to always point to the | ||
| 903 | 905 | most recent commit | |
| 904 | 906 | :param check: | |
| 905 | 907 | if True, relatively expensive checks will be performed to verify | |
| 906 | 908 | validity of the submodule. | |
| 907 | 909 | :raise ValueError: if the commit's tree didn't contain the .gitmodules blob. | |
| 908 | - :raise ValueError: | ||
| 910 | + :raise ValueError: | ||
| 909 | 911 | if the parent commit didn't store this submodule under the current path | |
| 910 | 912 | :return: self""" | |
| 911 | 913 | if commit is None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,13 +85,13 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init= | |||
| 85 | 85 | Unless force_reset is specified, a local tracking branch will never be reset into its past, therefore | |
| 86 | 86 | the remote branch must be in the future for this to have an effect. | |
| 87 | 87 | :param force_reset: if True, submodules may checkout or reset their branch even if the repository has | |
| 88 | - pending changes that would be overwritten, or if the local tracking branch is in the future of the | ||
| 88 | + pending changes that would be overwritten, or if the local tracking branch is in the future of the | ||
| 89 | 89 | remote tracking branch and would be reset into its past. | |
| 90 | 90 | :param progress: RootUpdateProgress instance or None if no progress should be sent | |
| 91 | 91 | :param dry_run: if True, operations will not actually be performed. Progress messages | |
| 92 | 92 | will change accordingly to indicate the WOULD DO state of the operation. | |
| 93 | - :param keep_going: if True, we will ignore but log all errors, and keep going recursively. | ||
| 94 | - Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see | ||
| 93 | + :param keep_going: if True, we will ignore but log all errors, and keep going recursively. | ||
| 94 | + Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see | ||
| 95 | 95 | otherwise. | |
| 96 | 96 | In conjunction with dry_run, it can be useful to anticipate all errors when updating submodules | |
| 97 | 97 | :return: self""" | |
@@ -136,7 +136,7 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init= | |||
| 136 | 136 | ################### | |
| 137 | 137 | rrsm = (spsms - ssms) | |
| 138 | 138 | len_rrsm = len(rrsm) | |
| 139 | - | ||
| 139 | + | ||
| 140 | 140 | for i, rsm in enumerate(rrsm): | |
| 141 | 141 | op = REMOVE | |
| 142 | 142 | if i == 0: | |
@@ -168,7 +168,8 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init= | |||
| 168 | 168 | ############## | |
| 169 | 169 | if sm.path != psm.path and psm.module_exists(): | |
| 170 | 170 | progress.update(BEGIN | PATHCHANGE, i, len_csms, prefix + | |
| 171 | - "Moving repository of submodule %r from %s to %s" % (sm.name, psm.abspath, sm.abspath)) | ||
| 171 | + "Moving repository of submodule %r from %s to %s" | ||
| 172 | + % (sm.name, psm.abspath, sm.abspath)) | ||
| 172 | 173 | # move the module to the new path | |
| 173 | 174 | if not dry_run: | |
| 174 | 175 | psm.move(sm.path, module=True, configuration=False) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -591,8 +591,8 @@ def test_rev_parse(self): | |||
| 591 | 591 | commit = rev_parse(first_rev) | |
| 592 | 592 | assert len(commit.parents) == 0 | |
| 593 | 593 | assert commit.hexsha == first_rev | |
| 594 | - self.failUnlessRaises(BadObject, rev_parse, first_rev + "~") | ||
| 595 | - self.failUnlessRaises(BadObject, rev_parse, first_rev + "^") | ||
| 594 | + self.failUnlessRaises(BadName, rev_parse, first_rev + "~") | ||
| 595 | + self.failUnlessRaises(BadName, rev_parse, first_rev + "^") | ||
| 596 | 596 | ||
| 597 | 597 | # short SHA1 | |
| 598 | 598 | commit2 = rev_parse(first_rev[:20]) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -535,7 +535,7 @@ def test_root_module(self, rwrepo): | |||
| 535 | 535 | touch(nsm_file) | |
| 536 | 536 | nsm.module().index.add([nsm]) | |
| 537 | 537 | nsm.module().index.commit("added new file") | |
| 538 | - rm.update(recursive=False, dry_run=True, progress=prog) # would not change head, and thus doens't fail | ||
| 538 | + rm.update(recursive=False, dry_run=True, progress=prog) # would not change head, and thus doens't fail | ||
| 539 | 539 | # Everything we can do from now on will trigger the 'future' check, so no is_dirty() check will even run | |
| 540 | 540 | # This would only run if our local branch is in the past and we have uncommitted changes | |
| 541 | 541 | ||
@@ -691,7 +691,7 @@ def test_git_submodule_compatibility(self, rwdir): | |||
| 691 | 691 | def assert_exists(sm, value=True): | |
| 692 | 692 | assert sm.exists() == value | |
| 693 | 693 | assert sm.module_exists() == value | |
| 694 | - # end | ||
| 694 | + # end | ||
| 695 | 695 | ||
| 696 | 696 | # As git is backwards compatible itself, it would still recognize what we do here ... unless we really | |
| 697 | 697 | # muss it up. That's the only reason why the test is still here ... . | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -251,9 +251,9 @@ def _parse_progress_line(self, line): | |||
| 251 | 251 | message = message[:-len(done_token)] | |
| 252 | 252 | # END end message handling | |
| 253 | 253 | ||
| 254 | - self.update(op_code, | ||
| 255 | - cur_count and float(cur_count), | ||
| 256 | - max_count and float(max_count), | ||
| 254 | + self.update(op_code, | ||
| 255 | + cur_count and float(cur_count), | ||
| 256 | + max_count and float(max_count), | ||
| 257 | 257 | message) | |
| 258 | 258 | # END for each sub line | |
| 259 | 259 | return failed_lines | |
| Back | FazBrowse Home | New Git URL |
0 commit comments