|
17 | 17 | rmtree |
18 | 18 | ) |
19 | 19 |
|
20 | | -fromgit.configimportSectionConstraint |
| 20 | +fromgit.configimport ( |
| 21 | +SectionConstraint, |
| 22 | +cp |
| 23 | +) |
21 | 24 | fromgit.excimport ( |
22 | 25 | InvalidGitRepositoryError, |
23 | 26 | NoSuchPathError |
@@ -302,6 +305,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False): |
302 | 305 | writer.set_value(cls.k_head_option,br.path) |
303 | 306 | sm._branch_path=br.path |
304 | 307 | # END handle path |
| 308 | +writer.release() |
305 | 309 | del(writer) |
306 | 310 |
|
307 | 311 | # we deliberatly assume that our head matches our index ! |
@@ -419,7 +423,9 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress= |
419 | 423 | # the default implementation will be offended and not update the repository |
420 | 424 | # Maybe this is a good way to assure it doesn't get into our way, but |
421 | 425 | # we want to stay backwards compatible too ... . Its so redundant ! |
422 | | -self.repo.config_writer().set_value(sm_section(self.name),'url',self.url) |
| 426 | +writer=self.repo.config_writer() |
| 427 | +writer.set_value(sm_section(self.name),'url',self.url) |
| 428 | +writer.release() |
423 | 429 | # END handle dry_run |
424 | 430 | # END handle initalization |
425 | 431 |
|
@@ -576,6 +582,7 @@ def move(self, module_path, configuration=True, module=True): |
576 | 582 | writer=self.config_writer(index=index)# auto-write |
577 | 583 | writer.set_value('path',module_path) |
578 | 584 | self.path=module_path |
| 585 | +writer.release() |
579 | 586 | del(writer) |
580 | 587 | # END handle configuration flag |
581 | 588 | exceptException: |
@@ -700,8 +707,12 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False): |
700 | 707 |
|
701 | 708 | # now git config - need the config intact, otherwise we can't query |
702 | 709 | # inforamtion anymore |
703 | | -self.repo.config_writer().remove_section(sm_section(self.name)) |
704 | | -self.config_writer().remove_section() |
| 710 | +writer=self.repo.config_writer() |
| 711 | +writer.remove_section(sm_section(self.name)) |
| 712 | +writer.release() |
| 713 | +writer=self.config_writer() |
| 714 | +writer.remove_section() |
| 715 | +writer.release() |
705 | 716 | # END delete configuration |
706 | 717 |
|
707 | 718 | # void our data not to delay invalid access |
@@ -800,14 +811,18 @@ def exists(self): |
800 | 811 | """ |
801 | 812 | :return: True if the submodule exists, False otherwise. Please note that |
802 | 813 | a submodule may exist (in the .gitmodules file) even though its module |
803 | | - doesn't exist""" |
| 814 | + doesn't exist on disk""" |
804 | 815 | # keep attributes for later, and restore them if we have no valid data |
805 | 816 | # this way we do not actually alter the state of the object |
806 | 817 | loc=locals() |
807 | 818 | forattrinself._cache_attrs: |
808 | | -ifhasattr(self,attr): |
809 | | -loc[attr]=getattr(self,attr) |
810 | | -# END if we have the attribute cache |
| 819 | +try: |
| 820 | +ifhasattr(self,attr): |
| 821 | +loc[attr]=getattr(self,attr) |
| 822 | +# END if we have the attribute cache |
| 823 | +exceptcp.NoSectionError: |
| 824 | +# on PY3, this can happen apparently ... don't know why this doesn't happen on PY2 |
| 825 | +pass |
811 | 826 | # END for each attr |
812 | 827 | self._clear_cache() |
813 | 828 |
|
|