1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00

Fixes to gotorevision(None)

Up until now, this would do nothing in most cases
This commit is contained in:
Daniel Martí 2013-09-15 23:20:27 +02:00
parent 9257690f95
commit c4237fe732
2 changed files with 21 additions and 25 deletions

View File

@ -121,22 +121,14 @@ def check_repomanifest(app, sdk_path, branch=None):
if vcs.repotype() == 'git': if vcs.repotype() == 'git':
if branch: if branch:
vcs.gotorevision('origin/'+branch) branch = 'origin/'+branch
else: vcs.gotorevision(branch)
vcs.gotorevision('origin/master') elif vcs.repotype() == 'git-svn':
pass
elif vcs.repotype() == 'git-svn':
if branch:
vcs.gotorevision(branch) vcs.gotorevision(branch)
else:
vcs.gotorevision(None)
elif vcs.repotype() == 'svn': elif vcs.repotype() == 'svn':
vcs.gotorevision(None) vcs.gotorevision(None)
elif vcs.repotype() == 'hg': elif vcs.repotype() == 'hg':
if branch:
vcs.gotorevision(branch) vcs.gotorevision(branch)
else:
vcs.gotorevision('default')
elif vcs.repotype() == 'bzr': elif vcs.repotype() == 'bzr':
vcs.gotorevision(None) vcs.gotorevision(None)

View File

@ -169,7 +169,7 @@ class vcs_git(vcs):
raise VCSException("Git fetch failed") raise VCSException("Git fetch failed")
self.refreshed = True self.refreshed = True
# Check out the appropriate revision... # Check out the appropriate revision...
if rev: rev = str(rev if rev else 'origin/master')
if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0: if subprocess.call(['git', 'checkout', rev], cwd=self.local) != 0:
raise VCSException("Git checkout failed") raise VCSException("Git checkout failed")
# Get rid of any uncontrolled files left behind... # Get rid of any uncontrolled files left behind...
@ -242,6 +242,8 @@ class vcs_gitsvn(vcs):
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Git svn rebase failed") raise VCSException("Git svn rebase failed")
self.refreshed = True self.refreshed = True
rev = str(rev if rev else 'master')
if rev: if rev:
nospaces_rev = rev.replace(' ', '%20') nospaces_rev = rev.replace(' ', '%20')
# Try finding a svn tag # Try finding a svn tag
@ -311,8 +313,8 @@ class vcs_svn(vcs):
self.userargs(), cwd=self.local) != 0: self.userargs(), cwd=self.local) != 0:
raise VCSException("Svn update failed") raise VCSException("Svn update failed")
self.refreshed = True self.refreshed = True
if rev:
revargs = ['-r', rev] revargs = list(['-r', rev] if rev else [])
if subprocess.call(['svn', 'update', '--force'] + revargs + if subprocess.call(['svn', 'update', '--force'] + revargs +
self.userargs(), cwd=self.local) != 0: self.userargs(), cwd=self.local) != 0:
raise VCSException("Svn update failed") raise VCSException("Svn update failed")
@ -336,6 +338,8 @@ class vcs_hg(vcs):
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Hg pull failed") raise VCSException("Hg pull failed")
self.refreshed = True self.refreshed = True
rev = str(rev if rev else 'default')
if rev: if rev:
revargs = [rev] revargs = [rev]
if subprocess.call(['hg', 'checkout', '-C'] + revargs, if subprocess.call(['hg', 'checkout', '-C'] + revargs,
@ -366,8 +370,8 @@ class vcs_bzr(vcs):
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Bzr update failed") raise VCSException("Bzr update failed")
self.refreshed = True self.refreshed = True
if rev:
revargs = ['-r', rev] revargs = list(['-r', rev] if rev else [])
if subprocess.call(['bzr', 'revert'] + revargs, if subprocess.call(['bzr', 'revert'] + revargs,
cwd=self.local) != 0: cwd=self.local) != 0:
raise VCSException("Bzr revert failed") raise VCSException("Bzr revert failed")