Skip to content

Commit 0259175

Browse files
committed
refactor: Rename check_destination -> ensure_dir
1 parent ee79a33 commit 0259175

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

libvcs/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def run(
127127
cwd=cwd,
128128
)
129129

130-
def check_destination(self, *args, **kwargs):
130+
def ensure_dir(self, *args, **kwargs):
131131
"""Assure destination path exists. If not, create directories."""
132132
if os.path.exists(self.path):
133133
return True

libvcs/git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def get_revision(self):
167167

168168
def obtain(self):
169169
"""Retrieve the repository, clone if doesn't exist."""
170-
self.check_destination()
170+
self.ensure_dir()
171171

172172
url = self.url
173173

@@ -188,7 +188,7 @@ def obtain(self):
188188
self.run(cmd, log_in_real_time=True)
189189

190190
def update_repo(self):
191-
self.check_destination()
191+
self.ensure_dir()
192192

193193
if not os.path.isdir(os.path.join(self.path, '.git')):
194194
self.obtain()

libvcs/hg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, url, repo_dir, **kwargs):
2525
BaseRepo.__init__(self, url, repo_dir, **kwargs)
2626

2727
def obtain(self):
28-
self.check_destination()
28+
self.ensure_dir()
2929

3030
self.run(['clone', '--noupdate', '-q', self.url, self.path])
3131
self.run(['update', '-q'])
@@ -34,7 +34,7 @@ def get_revision(self):
3434
return self.run(['parents', '--template={rev}'])
3535

3636
def update_repo(self):
37-
self.check_destination()
37+
self.ensure_dir()
3838
if not os.path.isdir(os.path.join(self.path, '.hg')):
3939
self.obtain()
4040
self.update_repo()

libvcs/svn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _user_pw_args(self):
6868
return args
6969

7070
def obtain(self, quiet=None):
71-
self.check_destination()
71+
self.ensure_dir()
7272

7373
url, rev = self.url, self.rev
7474

@@ -124,7 +124,7 @@ def get_revision(self, location=None):
124124
return revision
125125

126126
def update_repo(self, dest=None):
127-
self.check_destination()
127+
self.ensure_dir()
128128
if os.path.isdir(os.path.join(self.path, '.svn')):
129129
dest = self.path if not dest else dest
130130

tests/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def test_repr_base():
2424
assert '<BaseRepo hello>' == str_repo
2525

2626

27-
def test_check_destination_creates_parent_if_not_exist(tmpdir):
27+
def test_ensure_dir_creates_parent_if_not_exist(tmpdir):
2828
parentdir = tmpdir.join('parentdir') # doesn't exist yet
2929
repo_dir = parentdir.join('myrepo')
3030
repo = BaseRepo(url='file://path/to/myrepo', repo_dir=str(repo_dir))
3131

32-
repo.check_destination()
32+
repo.ensure_dir()
3333
assert parentdir.check()
3434

3535

0 commit comments

Comments
 (0)