libvcs.cmd.svn#

For subversion, aka svn(1)

libvcs.cmd.svn.DepthLiteral#
libvcs.cmd.svn.RevisionLiteral#
class libvcs.cmd.svn.Svn(*, dir)#
Parameters:

dir (libvcs._internal.types.StrPath) –

add(self, *, path, targets=None, depth=None, force=None, auto_props=None, no_auto_props=None, parents=None)#

Passing None means the flag won’t be passed unless otherwise stated.

Wraps svn add.

Parameters:
  • targets (pathlib.Path) – –targets ARG: contents of file ARG as additional args

  • depth (DepthLiteral) – –depth ARG, Sparse checkout support, Optional

  • force (Optional[bool]) – –force, Ignore already versioned paths

  • no_ignore–no-ignore

  • auto_props (Optional[bool]) – –auto-props

  • no_auto_props (Optional[bool]) – –no-auto-props

  • parents (Optional[bool]) – –parents

  • path (Union[list[pathlib.Path], pathlib.Path]) –

Examples

>>> svn = Svn(dir=tmp_path)
>>> svn.checkout(url=f'file://{create_svn_remote_repo()}')
'...'
>>> new_file = tmp_path / 'new.txt'
>>> new_file.write_text('example text', encoding="utf-8")
12
>>> svn.add(path=new_file)
'A  new.txt'
auth(self, remove=None, show_passwords=None, **kwargs)#

Wraps svn auth.

Parameters:
  • remove (str, optional) – Remove matching auth credentials

  • show_passwords (bool, optional) – Show cached passwords

Examples

>>> Svn(dir=tmp_path).auth()
"Credentials cache in '...' is empty"
blame(self, target, *, revision=None, verbose=None, force=None, use_merge_history=None, incremental=None, xml=None, extensions=None, **kwargs)#

Wraps svn blame.

Parameters:
  • target (pathlib.Path) – path of file

  • revision (Union[RevisionLiteral, str]) – Number, ‘{ DATE }’, ‘HEAD’, ‘BASE’, ‘COMMITTED’, ‘PREV’

  • verbose (bool) – -v, –verbose, output extra info

  • use_merge_history (bool) – -g, –use-merge-history, show extra mergeg info

  • incremental (bool) – –incremental, give output suitable for concatenation

  • xml (bool) – –xml, xml output

  • extensions (str, optional) – Diff or blame tool (pass raw args).

  • force (bool, optional) – force operation to run

Examples

>>> svn = Svn(dir=tmp_path)
>>> svn.checkout(url=f'file://{create_svn_remote_repo()}')
'Checked out revision ...'
>>> new_file = tmp_path / 'new.txt'
>>> new_file.write_text('example text', encoding="utf-8")
12
>>> svn.add(path=new_file)
'A  new.txt'
>>> svn.commit(path=new_file, message='My new commit')
'...'
>>> svn.blame('new.txt')
'1        ... example text'
cat(self, *args, **kwargs)#

Wraps svn cat.

changelist(self, *args, **kwargs)#

Wraps svn changelist (cl).

checkout(self, *, url, revision=None, force=None, ignore_externals=None, depth=None)#

Check out a working copy from an SVN repo.

Wraps svn checkout (co).

Parameters:
  • url (str) –

  • revision (Union[RevisionLiteral, str]) – Number, ‘{ DATE }’, ‘HEAD’, ‘BASE’, ‘COMMITTED’, ‘PREV’

  • force (bool, optional) – force operation to run

  • ignore_externals (bool, optional) – ignore externals definitions

  • depth (DepthLiteral) – Sparse checkout support, Optional

Examples

>>> svn = Svn(dir=tmp_path)
>>> svn_remote_repo = create_svn_remote_repo()
>>> svn.checkout(url=f'file://{svn_remote_repo}')
'Checked out revision ...'
>>> svn.checkout(url=f'file://{svn_remote_repo}', revision=1)
'svn: E160006: No such revision 1...'
cleanup(self, *args, **kwargs)#

Wraps svn cleanup.

commit(self, *, path, targets=None, message=None, no_unlock=None, file=None, depth=None, encoding=None, force_log=None, keep_changelists=None, include_externals=None, **kwargs)#

Wraps svn commit (ci).

Parameters:
  • targets (pathlib.Path) – –targets ARG: contents of file ARG as additional args

  • depth (DepthLiteral) – –depth ARG, Sparse checkout support, Optional

  • encoding (Optional[str]) – –encoding, treat value as charset encoding passed

  • keep_changelists (Optional[bool]) – –keep_changelists, don’t delete changelists after commit

  • force_log (Optional[bool]) – –force-log, Ignore already versioned paths

  • path (Union[list[pathlib.Path], pathlib.Path]) –

  • message (Optional[str]) –

  • no_unlock (Optional[bool]) –

  • file (Optional[pathlib.Path]) –

  • include_externals (Optional[bool]) –

Examples

>>> svn = Svn(dir=tmp_path)
>>> svn.checkout(url=f'file://{create_svn_remote_repo()}')
'...'
>>> new_file = tmp_path / 'new.txt'
>>> new_file.write_text('example text', encoding="utf-8")
12
>>> svn.add(path=new_file)
'A  new.txt'
>>> svn.commit(path=new_file, message='My new commit')
'Adding          new.txt...Transmitting file data...Committed revision 1.'
copy(self, *args, **kwargs)#

Wraps svn copy (cp).

delete(self, *args, **kwargs)#

Wraps svn delete (del, remove, rm).

diff(self, *args, **kwargs)#

Wraps svn diff.

export(self, *args, **kwargs)#

Wraps svn export.

help(self, *args, **kwargs)#

Wraps svn help (?, h).

import_(self, *args, **kwargs)#

Wraps svn import.

Due to python limitation, .import isn’t possible.

info(self, *args, **kwargs)#

Wraps svn info.

list(self, *args, **kwargs)#

Wraps svn list (ls).

lock(self, *args, **kwargs)#

Wraps svn lock.

log(self, *args, **kwargs)#

Wraps svn log.

merge(self, *args, **kwargs)#

Wraps svn merge.

mergelist(self, *args, **kwargs)#

Wraps svn mergelist.

mkdir(self, *args, **kwargs)#

Wraps svn mkdir.

move(self, *args, **kwargs)#

Wraps svn move (mv, rename, ren).

patch(self, *args, **kwargs)#

Wraps svn patch.

propdel(self, *args, **kwargs)#

Wraps svn propdel (pdel, pd).

propedit(self, *args, **kwargs)#

Wraps svn propedit (pedit, pe).

propget(self, *args, **kwargs)#

Wraps svn propget (pget, pg).

proplist(self, *args, **kwargs)#

Wraps svn proplist (plist, pl).

propset(self, *args, **kwargs)#

Wraps svn propset (pset, ps).

relocate(self, *args, **kwargs)#

Wraps svn relocate.

resolve(self, *args, **kwargs)#

Wraps svn resolve.

resolved(self, *args, **kwargs)#

Wraps svn resolved.

revert(self, *args, **kwargs)#

Wraps svn revert.

status(self, *args, **kwargs)#

Wraps svn status (stat, st).

switch(self, *args, **kwargs)#

Wraps svn switch (sw).

unlock(self, *args, **kwargs)#

Wraps svn unlock.

update(self, *args, **kwargs)#

Wraps svn update (up).

upgrade(self, *args, **kwargs)#

Wraps svn upgrade.