| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ | |||
| 20 | 20 | from git.stats import Stats | |
| 21 | 21 | from git.utils import dashify | |
| 22 | 22 | from git.utils import touch | |
| 23 | + from git.remote import Remote | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | 26 | __all__ = [ name for name, obj in locals().items() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,7 +151,7 @@ def create(cls, repo, name, url, **kwargs): | |||
| 151 | 151 | Raise | |
| 152 | 152 | GitCommandError in case an origin with that name already exists | |
| 153 | 153 | """ | |
| 154 | - self.repo.git.remote( "add", name, url, **kwargs ) | ||
| 154 | + repo.git.remote( "add", name, url, **kwargs ) | ||
| 155 | 155 | return cls(repo, name) | |
| 156 | 156 | ||
| 157 | 157 | # add is an alias | |
@@ -164,6 +164,9 @@ def remove(cls, repo, name ): | |||
| 164 | 164 | """ | |
| 165 | 165 | repo.git.remote("rm", name) | |
| 166 | 166 | ||
| 167 | + # alias | ||
| 168 | + rm = remove | ||
| 169 | + | ||
| 167 | 170 | def rename(self, new_name): | |
| 168 | 171 | """ | |
| 169 | 172 | Rename self to the given new_name | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,7 +49,7 @@ def test_base(self): | |||
| 49 | 49 | assert writer.get(opt) == val | |
| 50 | 50 | del(writer) | |
| 51 | 51 | assert getattr(remote, opt) == val | |
| 52 | - # END | ||
| 52 | + # END for each default option key | ||
| 53 | 53 | ||
| 54 | 54 | # RENAME | |
| 55 | 55 | other_name = "totally_other_name" | |
@@ -69,6 +69,21 @@ def test_base(self): | |||
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | 71 | def test_creation_and_removal(self): | |
| 72 | - self.fail( "Test remote creation/removal" ) | ||
| 72 | + new_name = "test_new_one" | ||
| 73 | + arg_list = (new_name, "git@server:hello.git") | ||
| 74 | + remote = Remote.create(self.repo, *arg_list ) | ||
| 75 | + assert remote.name == "test_new_one" | ||
| 76 | + | ||
| 77 | + # create same one again | ||
| 78 | + self.failUnlessRaises(GitCommandError, Remote.create, self.repo, *arg_list) | ||
| 79 | + | ||
| 80 | + Remote.remove(self.repo, new_name) | ||
| 81 | + | ||
| 82 | + for remote in self.repo.remotes: | ||
| 83 | + if remote.name == new_name: | ||
| 84 | + raise AssertionError("Remote removal failed") | ||
| 85 | + # END if deleted remote matches existing remote's name | ||
| 86 | + # END for each remote | ||
| 87 | + | ||
| 73 | 88 | ||
| 74 | 89 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments