Archived
saving dependency work
This commit is contained in:
@@ -25,24 +25,29 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Bazaar(VersionControl):
|
||||
name = 'bzr'
|
||||
dirname = '.bzr'
|
||||
repo_name = 'branch'
|
||||
name = "bzr"
|
||||
dirname = ".bzr"
|
||||
repo_name = "branch"
|
||||
schemes = (
|
||||
'bzr', 'bzr+http', 'bzr+https', 'bzr+ssh', 'bzr+sftp', 'bzr+ftp',
|
||||
'bzr+lp',
|
||||
"bzr",
|
||||
"bzr+http",
|
||||
"bzr+https",
|
||||
"bzr+ssh",
|
||||
"bzr+sftp",
|
||||
"bzr+ftp",
|
||||
"bzr+lp",
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Bazaar, self).__init__(*args, **kwargs)
|
||||
# This is only needed for python <2.7.5
|
||||
# Register lp but do not expose as a scheme to support bzr+lp.
|
||||
if getattr(urllib_parse, 'uses_fragment', None):
|
||||
urllib_parse.uses_fragment.extend(['lp'])
|
||||
if getattr(urllib_parse, "uses_fragment", None):
|
||||
urllib_parse.uses_fragment.extend(["lp"])
|
||||
|
||||
@staticmethod
|
||||
def get_base_rev_args(rev):
|
||||
return ['-r', rev]
|
||||
return ["-r", rev]
|
||||
|
||||
def export(self, location, url):
|
||||
# type: (str, HiddenText) -> None
|
||||
@@ -55,7 +60,7 @@ class Bazaar(VersionControl):
|
||||
|
||||
url, rev_options = self.get_url_rev_options(url)
|
||||
self.run_command(
|
||||
make_command('export', location, url, rev_options.to_args()),
|
||||
make_command("export", location, url, rev_options.to_args()),
|
||||
show_stdout=False,
|
||||
)
|
||||
|
||||
@@ -63,23 +68,21 @@ class Bazaar(VersionControl):
|
||||
# type: (str, HiddenText, RevOptions) -> None
|
||||
rev_display = rev_options.to_display()
|
||||
logger.info(
|
||||
'Checking out %s%s to %s',
|
||||
"Checking out %s%s to %s",
|
||||
url,
|
||||
rev_display,
|
||||
display_path(dest),
|
||||
)
|
||||
cmd_args = (
|
||||
make_command('branch', '-q', rev_options.to_args(), url, dest)
|
||||
)
|
||||
cmd_args = make_command("branch", "-q", rev_options.to_args(), url, dest)
|
||||
self.run_command(cmd_args)
|
||||
|
||||
def switch(self, dest, url, rev_options):
|
||||
# type: (str, HiddenText, RevOptions) -> None
|
||||
self.run_command(make_command('switch', url), cwd=dest)
|
||||
self.run_command(make_command("switch", url), cwd=dest)
|
||||
|
||||
def update(self, dest, url, rev_options):
|
||||
# type: (str, HiddenText, RevOptions) -> None
|
||||
cmd_args = make_command('pull', '-q', rev_options.to_args())
|
||||
cmd_args = make_command("pull", "-q", rev_options.to_args())
|
||||
self.run_command(cmd_args, cwd=dest)
|
||||
|
||||
@classmethod
|
||||
@@ -87,19 +90,18 @@ class Bazaar(VersionControl):
|
||||
# type: (str) -> Tuple[str, Optional[str], AuthInfo]
|
||||
# hotfix the URL scheme after removing bzr+ from bzr+ssh:// readd it
|
||||
url, rev, user_pass = super(Bazaar, cls).get_url_rev_and_auth(url)
|
||||
if url.startswith('ssh://'):
|
||||
url = 'bzr+' + url
|
||||
if url.startswith("ssh://"):
|
||||
url = "bzr+" + url
|
||||
return url, rev, user_pass
|
||||
|
||||
@classmethod
|
||||
def get_remote_url(cls, location):
|
||||
urls = cls.run_command(
|
||||
['info'], show_stdout=False, stdout_only=True, cwd=location
|
||||
["info"], show_stdout=False, stdout_only=True, cwd=location
|
||||
)
|
||||
for line in urls.splitlines():
|
||||
line = line.strip()
|
||||
for x in ('checkout of branch: ',
|
||||
'parent branch: '):
|
||||
for x in ("checkout of branch: ", "parent branch: "):
|
||||
if line.startswith(x):
|
||||
repo = line.split(x)[1]
|
||||
if cls._is_local_repository(repo):
|
||||
@@ -110,7 +112,10 @@ class Bazaar(VersionControl):
|
||||
@classmethod
|
||||
def get_revision(cls, location):
|
||||
revision = cls.run_command(
|
||||
['revno'], show_stdout=False, stdout_only=True, cwd=location,
|
||||
["revno"],
|
||||
show_stdout=False,
|
||||
stdout_only=True,
|
||||
cwd=location,
|
||||
)
|
||||
return revision.splitlines()[-1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user