libvcs.cmd.svn¶
For subversion, aka svn(1)
Run svn (subversion) commands directly against SVN working copy.
Busmanâs holiday?.
We need to fill these SVN commands and their tests to exquisite perfection, like the artisans in those Michelin-star videos on YouTube. We welcome your contributions, providing you âcolor between the linesâ and stick to the interface. Get in, âAPIs unstable until we fit the spec.
Bases:
LibVCSException,TypeErrorRaised when required parameters are not passed.
Bases:
objectRun commands directly against SVN working copy.
Lite, typed, pythonic wrapper for svn(1).
- Parameters:
path (StrPath) â Operates as PATH in the corresponding svn subcommand.
progress_callback (ProgressCallbackProtocol | None)
- Return type:
Examples
>>> Svn(path=tmp_path) <Svn path=...>
-
attribute
Run a command for this SVN working copy.
Passing None to a subcommand option, the flag wonât be passed unless otherwise stated.
svn help and svn help [cmd]
Wraps svnâs Options.
- Parameters:
non_interactive (bool | None) â ânon-interactive, defaults to True
config_option (Path | None) â âconfig-option,
FILE:SECTION:OPTION=[VALUE]cwd (
libvcs._internal.types.StrOrBytesPath, optional) â Defaults tocwdmake_parents (bool, default: True) â Creates checkout directory (:attr:`self.path) if it doesnât already exist.
check_returncode (bool, default: None) â Passthrough to
Svn.run()args (_CMD)
kwargs (Any)
- Return type:
Examples
>>> svn = Svn(path=tmp_path) >>> svn.run(['help']) "usage: svn <subcommand> [options] [args]..."
Check out a working copy from an SVN repo.
Wraps svn checkout (co).
- Parameters:
url (str)
revision (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
make_parents (bool, default: True) â Creates checkout directory (:attr:`self.path) if it doesnât already exist.
check_returncode (bool, default: True) â Passthrough to
Svn.run()
- Return type:
Examples
>>> svn = Svn(path=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=10) 'svn: E160006: No such revision 10...'
Stage an unversioned file to be pushed to repository next commit.
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 (bool | None) â âforce, Ignore already versioned paths
no_ignore â âno-ignore
- Return type:
Examples
>>> svn = Svn(path=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'
Show authorship for file line-by-line.
Wraps svn blame.
- Parameters:
target (pathlib.Path) â path of file
revision (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
kwargs (Any)
- Return type:
Examples
>>> svn = Svn(path=tmp_path) >>> repo = create_svn_remote_repo() >>> svn.checkout(url=f'file://{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') '4 ... example text'
Output contents of files from working copy or repository URLs.
Wraps svn cat.
Connect or disconnect files with a changelist.
Wraps svn changelist (cl).
Recursively clean up working copy of locks. Unblocks operations.
Wraps svn cleanup.
Push changes from working copy to SVN repo.
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 (str | None) â âencoding, treat value as charset encoding passed
keep_changelists (bool | None) â âkeep_changelists, donât delete changelists after commit
force_log (bool | None) â âforce-log, Ignore already versioned paths
kwargs (Any)
- Return type:
Examples
>>> svn = Svn(path=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 4.'
Copy file or dir in this SVN working copy or repo.
Wraps svn copy (cp).
Remove file from this SVN working copy or repo.
Wraps svn delete (del, remove, rm).
Return diff of two files or revisions.
Wraps svn diff.
Export clean directory tree of working directory.
Wraps svn export.
SVN Help command.
Wraps svn help (?, h).
Import local directory into repository.
Wraps svn import.
Due to python limitation, .import isnât possible.
Return info about this SVN repository.
Wraps svn info.
- targetspathlib.Path
âtargets ARG: contents of file ARG as additional args
- xmlbool
âxml, xml output
- revisionUnion[RevisionLiteral, str]
Number, â{ DATE }â, âHEADâ, âBASEâ, âCOMMITTEDâ, âPREVâ
- depth :
âdepth ARG, Sparse checkout support, Optional
- incrementalbool
âincremental, give output suitable for concatenation
List files in SVN repository (without downloading them).
Wraps svn list (ls).
Lock path or URLs for working copy or repository.
Wraps svn lock.
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.lock(targets='samplepickle') "'samplepickle' locked by user '...'."
Show logs from repository.
Wraps svn log.
Apply diffs between two places to SVN working copy.
Wraps svn merge.
Create directory in SVN working copy.
Wraps svn mkdir.
Move a file in SVN working copy.
Wraps svn move (mv, rename, ren).
Apply a patch to SVN working copy.
Wraps svn patch.
Remove a property for this SVN working copy.
Wraps svn propdel (pdel, pd).
Change a property for this SVN working copy.
Wraps svn propedit (pedit, pe).
Return a property for this SVN working copy.
Wraps svn propget (pget, pg).
Return list of properties for this SVN working copy.
Wraps svn proplist (plist, pl).
Set property for this SVN working copy or a remote revision.
Note: Setting remote properties via ârevprop does not work yet.
Wraps svn propset (pset, ps).
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.propset(name="my_prop", value="value", path=".") "property 'my_prop' set on '.'"
Set the SVN repository URL for this working copy.
Wraps svn relocate.
Examples
>>> svn = Svn(path=tmp_path / 'initial_place') >>> repo_path = create_svn_remote_repo() >>> svn.checkout(url=repo_path.as_uri()) '...Checked out revision ...' >>> new_place = repo_path.rename(tmp_path / 'new_place') >>> svn.relocate(to_path=new_place.absolute().as_uri()) ''
Resolve conflicts with this SVN working copy.
Wraps svn resolve.
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.resolve(path='.') ''
Resolve this working copyâs conflicted state.
Wraps svn resolved.
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.resolved(path='.') ''
Revert any changes to this SVN working copy.
Wraps svn revert.
Examples
>>> svn = Svn(path=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.revert(path=new_file) ''
Return status of this SVN working copy.
Wraps svn status (stat, st).
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.status() ''
Switch working copy to a different SVN repo URL.
Wraps svn switch (sw).
Examples
>>> svn = Svn(path=tmp_path / 'initial_place') >>> repo_path = create_svn_remote_repo() >>> svn.checkout(url=(repo_path / 'sampledir').as_uri()) '...Checked out revision ...' >>> other_dir = repo_path / 'otherdir' >>> svn.switch(to_path=other_dir.as_uri(), path='.', ignore_ancestry=True) 'D...Updated to revision...'
Unlock path or URL reserved by another user.
Wraps svn unlock.
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.lock(targets='samplepickle') "'samplepickle' locked by user '...'." >>> svn.unlock(targets='samplepickle') "'samplepickle' unlocked."
Fetch latest changes to working copy.
Wraps svn update (up).
Examples
>>> svn = Svn(path=tmp_path) >>> svn.checkout(url=f'file://{create_svn_remote_repo()}') '...Checked out revision ...' >>> svn.update() "Updating ..."