-class vcs_svn(vcs):
-
- def repotype(self):
- return 'svn'
-
- def userargs(self):
- if self.username is None:
- return ['--non-interactive']
- return ['--username', self.username,
- '--password', self.password,
- '--non-interactive']
-
- def gotorevisionx(self, rev):
- if not os.path.exists(self.local):
- p = SilentPopen(['svn', 'checkout', self.remote, self.local] + self.userargs())
- if p.returncode != 0:
- self.clone_failed = True
- raise VCSException("Svn checkout of '%s' failed" % rev, p.output)
- else:
- for svncommand in (
- 'svn revert -R .',
- r"svn status | awk '/\?/ {print $2}' | xargs rm -rf"):
- p = SilentPopen([svncommand], cwd=self.local, shell=True)
- if p.returncode != 0:
- raise VCSException("Svn reset ({0}) failed in {1}".format(svncommand, self.local), p.output)
- if not self.refreshed:
- p = SilentPopen(['svn', 'update'] + self.userargs(), cwd=self.local)
- if p.returncode != 0:
- raise VCSException("Svn update failed", p.output)
- self.refreshed = True
-
- revargs = list(['-r', rev] if rev else [])
- p = SilentPopen(['svn', 'update', '--force'] + revargs + self.userargs(), cwd=self.local)
- if p.returncode != 0:
- raise VCSException("Svn update failed", p.output)
-
- def getref(self):
- p = SilentPopen(['svn', 'info'], cwd=self.local)
- for line in p.output.splitlines():
- if line and line.startswith('Last Changed Rev: '):
- return line[18:]
- return None
-
-