# eric7.Plugins.VcsPlugins.vcsSubversion.subversion

Module implementing the version control systems interface to Subversion.

### Global Attributes

None

### Classes

Subversion | Class implementing the version control systems interface to Subversion.

### Functions

None

## Subversion

Class implementing the version control systems interface to Subversion.

### Signals

committed()
  emitted after the commit action has completed

### Derived from

VersionControl

### Class Attributes

None

### Class Methods

None

### Methods

Subversion | Constructor
__svnGetFileForRevision | Private method to get a file for a specific revision from the repository.
__svnURL | Private method to format a url for subversion.
__vcsAllRegisteredStates_wc | Private method used to get the registered states of a number of files in the VCS.
__vcsAllRegisteredStates_wcng | Private method used to get the registered states of a number of files in the VCS.
__vcsCommit_Step2 | Private slot performing the second step of the commit action.
__vcsRegisteredState_wc | Private method used to get the registered state of a file in the VCS.
__vcsRegisteredState_wcng | Private method used to get the registered state of a file in the vcs.
_createStatusMonitorThread | Protected method to create an instance of the VCS status monitor thread.
clearStatusCache | Public method to clear the status cache.
getPlugin | Public method to get a reference to the plugin object.
svnAddToChangelist | Public method to add a file or directory to a changelist.
svnBlame | Public method to show the output of the svn blame command.
svnCopy | Public method used to copy a file/directory.
svnDelProp | Public method used to delete a property of a file/directory.
svnExtendedDiff | Public method used to view the difference of a file/directory to the Subversion repository.
svnGetChangelists | Public method to get a list of all defined change lists.
svnGetReposName | Public method used to retrieve the URL of the subversion repository path.
svnListProps | Public method used to list the properties of a file/directory.
svnListTagBranch | Public method used to list the available tags or branches.
svnLock | Public method used to lock a file in the Subversion repository.
svnNormalizeURL | Public method to normalize a url for subversion.
svnRelocate | Public method to relocate the working copy to a new repository URL.
svnRemoveFromChangelist | Public method to remove a file or directory from its changelist.
svnRepoBrowser | Public method to open the repository browser.
svnSetProp | Public method used to add a property to a file/directory.
svnShowChangelists | Public method used to inspect the change lists defined for the project.
svnUnlock | Public method used to unlock a file in the Subversion repository.
svnUpgrade | Public method to upgrade the working copy format.
svnUrlDiff | Public method used to view the difference of a file/directory of two repository URLs.
vcsAdd | Public method used to add a file/directory to the Subversion repository.
vcsAddBinary | Public method used to add a file/directory in binary mode to the Subversion repository.
vcsAddCommitMessage | Public method to add a commit message to the list of saved messages.
vcsAddTree | Public method to add a directory tree rooted at path to the Subversion repository.
vcsAllRegisteredStates | Public method used to get the registered states of a number of files in the VCS.
vcsCheckout | Public method used to check the project out of the Subversion repository.
vcsCleanup | Public method used to cleanup the working copy.
vcsClearCommitMessages | Public method to clear the list of saved messages.
vcsCommandLine | Public method used to execute arbitrary subversion commands.
vcsCommit | Public method used to make the change of a file/directory permanent in the Subversion repository.
vcsCommitMessages | Public method to get the list of saved commit messages.
vcsConvertProject | Public method to convert an uncontrolled project to a version controlled project.
vcsDiff | Public method used to view the difference of a file/directory to the Subversion repository.
vcsExists | Public method used to test for the presence of the svn executable.
vcsExport | Public method used to export a directory from the Subversion repository.
vcsForget | Public method used to remove a file from the repository.
vcsGetProjectBrowserHelper | Public method to instanciate a helper object for the different project browsers.
vcsGetProjectHelper | Public method to instanciate a helper object for the project.
vcsImport | Public method used to import the project into the Subversion repository.
vcsInit | Public method used to initialize the subversion repository.
vcsInitConfig | Public method to initialize the VCS configuration.
vcsLogBrowser | Public method used to browse the log of a file/directory from the Subversion repository.
vcsMerge | Public method used to merge a URL/revision into the local project.
vcsMove | Public method used to move a file/directory.
vcsName | Public method returning the name of the vcs.
vcsNewProjectOptionsDialog | Public method to get a dialog to enter repository info for getting a new project.
vcsOptionsDialog | Public method to get a dialog to enter repository info.
vcsRegisteredState | Public method used to get the registered state of a file in the vcs.
vcsRemove | Public method used to remove a file/directory from the Subversion repository.
vcsRepositoryInfos | Public method to retrieve information about the repository.
vcsResolved | Public method used to resolve conflicts of a file/directory.
vcsRevert | Public method used to revert changes made to a file/directory.
vcsSbsDiff | Public method used to view the difference of a file to the Mercurial repository side-by-side.
vcsShutdown | Public method used to shutdown the Subversion interface.
vcsStatus | Public method used to view the status of files/directories in the Subversion repository.
vcsSwitch | Public method used to switch a directory to a different tag/branch.
vcsTag | Public method used to set the tag of a file/directory in the Subversion repository.
vcsUpdate | Public method used to update a file/directory with the Subversion repository.

### Static Methods

None

#### Subversion (Constructor)

Subversion(plugin, parent=None, name=None)

Constructor

plugin
  reference to the plugin object
parent
  parent widget (QWidget)
name
  name of this object (string)

#### Subversion.__svnGetFileForRevision

__svnGetFileForRevision(name, rev="")

Private method to get a file for a specific revision from the repository.

name
  file name to get from the repository (string)
rev
  revision to retrieve (integer or string)

Return:
  contents of the file (string) and an error message (string)

#### Subversion.__svnURL

__svnURL(url)

Private method to format a url for subversion.

url
  unformatted url string (string)

Return:
  properly formated url for subversion (string)

#### Subversion.__vcsAllRegisteredStates_wc

__vcsAllRegisteredStates_wc(names, dname, shortcut=True)

Private method used to get the registered states of a number of files in the VCS.

This is the variant for subversion installations using the old working copy meta-data format.

Note: If a shortcut is to be taken, the code will only check, if the named directory has been scanned already. If so, it is assumed, that the states for all files has been populated by the previous run.

names
  dictionary with all filenames to be checked as keys
dname
  directory to check in (string)
shortcut
  flag indicating a shortcut should be taken (boolean)

Return:
  the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error

#### Subversion.__vcsAllRegisteredStates_wcng

__vcsAllRegisteredStates_wcng(names, dname, shortcut=True)

Private method used to get the registered states of a number of files in the VCS.

This is the variant for subversion installations using the new working copy meta-data format.

Note: If a shortcut is to be taken, the code will only check, if the named directory has been scanned already. If so, it is assumed, that the states for all files has been populated by the previous run.

names
  dictionary with all filenames to be checked as keys
dname
  directory to check in (string)
shortcut
  flag indicating a shortcut should be taken (boolean)

Return:
  the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error

#### Subversion.__vcsCommit_Step2

__vcsCommit_Step2()

Private slot performing the second step of the commit action.

#### Subversion.__vcsRegisteredState_wc

__vcsRegisteredState_wc(name)

Private method used to get the registered state of a file in the VCS.

This is the variant for subversion installations using the old working copy meta-data format.

name
  filename to check (string)

Return:
  a combination of canBeCommited and canBeAdded

#### Subversion.__vcsRegisteredState_wcng

__vcsRegisteredState_wcng(name)

Private method used to get the registered state of a file in the vcs.

This is the variant for subversion installations using the new working copy meta-data format.

name
  filename to check (string)

Return:
  a combination of canBeCommited and canBeAdded

#### Subversion._createStatusMonitorThread

_createStatusMonitorThread(interval, project)

Protected method to create an instance of the VCS status monitor thread.

interval
  check interval for the monitor thread in seconds (integer)
project
  reference to the project object

Return:
  reference to the monitor thread (QThread)

#### Subversion.clearStatusCache

clearStatusCache()

Public method to clear the status cache.

#### Subversion.getPlugin

getPlugin()

Public method to get a reference to the plugin object.

Return:
  reference to the plugin object (VcsSubversionPlugin)

#### Subversion.svnAddToChangelist

svnAddToChangelist(names)

Public method to add a file or directory to a changelist.

Note: Directories will be added recursively.

names
  name or list of names of file or directory to add (string)

#### Subversion.svnBlame

svnBlame(name)

Public method to show the output of the svn blame command.

name
  file name to show the blame for (string)

#### Subversion.svnCopy

svnCopy(name, project)

Public method used to copy a file/directory.

name
  file/directory name to be copied (string)
project
  reference to the project object

Return:
  flag indicating successfull operation (boolean)

#### Subversion.svnDelProp

svnDelProp(name, recursive=False)

Public method used to delete a property of a file/directory.

name
  file/directory name (string or list of strings)
recursive
  flag indicating a recursive list is requested

#### Subversion.svnExtendedDiff

svnExtendedDiff(name)

Public method used to view the difference of a file/directory to the Subversion repository.

If name is a directory and is the project directory, all project files are saved first. If name is a file (or list of files), which is/are being edited and has unsaved modification, they can be saved or the operation may be aborted.

This method gives the chance to enter the revisions to be compared.

name
  file/directory name to be diffed (string)

#### Subversion.svnGetChangelists

svnGetChangelists()

Public method to get a list of all defined change lists.

Return:
  list of defined change list names (list of strings)

#### Subversion.svnGetReposName

svnGetReposName(path)

Public method used to retrieve the URL of the subversion repository path.

path
  local path to get the svn repository path for (string)

Return:
  string with the repository path URL

#### Subversion.svnListProps

svnListProps(name, recursive=False)

Public method used to list the properties of a file/directory.

name
  file/directory name (string or list of strings)
recursive
  flag indicating a recursive list is requested

#### Subversion.svnListTagBranch

svnListTagBranch(path, tags=True)

Public method used to list the available tags or branches.

path
  directory name of the project (string)
tags
  flag indicating listing of branches or tags (False = branches, True = tags)

#### Subversion.svnLock

svnLock(name, stealIt=False, parent=None)

Public method used to lock a file in the Subversion repository.

name
  file/directory name to be locked (string or list of strings)
stealIt
  flag indicating a forced operation (boolean)
parent
  reference to the parent object of the subversion dialog (QWidget)

#### Subversion.svnNormalizeURL

svnNormalizeURL(url)

Public method to normalize a url for subversion.

url
  url string (string)

Return:
  properly normalized url for subversion (string)

#### Subversion.svnRelocate

svnRelocate(projectPath)

Public method to relocate the working copy to a new repository URL.

projectPath
  path name of the project (string)

#### Subversion.svnRemoveFromChangelist

svnRemoveFromChangelist(names)

Public method to remove a file or directory from its changelist.

Note: Directories will be removed recursively.

names
  name or list of names of file or directory to remove (string)

#### Subversion.svnRepoBrowser

svnRepoBrowser(projectPath=None)

Public method to open the repository browser.

projectPath
  path name of the project (string)

#### Subversion.svnSetProp

svnSetProp(name, recursive=False)

Public method used to add a property to a file/directory.

name
  file/directory name (string or list of strings)
recursive
  flag indicating a recursive list is requested

#### Subversion.svnShowChangelists

svnShowChangelists(path)

Public method used to inspect the change lists defined for the project.

path
  directory name to show change lists for (string)

#### Subversion.svnUnlock

svnUnlock(name, breakIt=False, parent=None)

Public method used to unlock a file in the Subversion repository.

name
  file/directory name to be unlocked (string or list of strings)
breakIt
  flag indicating a forced operation (boolean)
parent
  reference to the parent object of the subversion dialog (QWidget)

#### Subversion.svnUpgrade

svnUpgrade(path)

Public method to upgrade the working copy format.

path
  directory name to show change lists for (string)

#### Subversion.svnUrlDiff

svnUrlDiff(name)

Public method used to view the difference of a file/directory of two repository URLs.

If name is a directory and is the project directory, all project files are saved first. If name is a file (or list of files), which is/are being edited and has unsaved modification, they can be saved or the operation may be aborted.

This method gives the chance to enter the revisions to be compared.

name
  file/directory name to be diffed (string)

#### Subversion.vcsAdd

vcsAdd(name, isDir=False, noDialog=False)

Public method used to add a file/directory to the Subversion repository.

name
  file/directory name to be added (string)
isDir
  flag indicating name is a directory (boolean)
noDialog
  flag indicating quiet operations

#### Subversion.vcsAddBinary

vcsAddBinary(name, isDir=False)

Public method used to add a file/directory in binary mode to the Subversion repository.

name
  file/directory name to be added (string)
isDir
  flag indicating name is a directory (boolean)

#### Subversion.vcsAddCommitMessage

vcsAddCommitMessage(message)

Public method to add a commit message to the list of saved messages.

message (str)
  message to be added

#### Subversion.vcsAddTree

vcsAddTree(path)

Public method to add a directory tree rooted at path to the Subversion repository.

path
  root directory of the tree to be added (string or list of strings))

#### Subversion.vcsAllRegisteredStates

vcsAllRegisteredStates(names, dname, shortcut=True)

Public method used to get the registered states of a number of files in the VCS.

Note: If a shortcut is to be taken, the code will only check, if the named directory has been scanned already. If so, it is assumed, that the states for all files have been populated by the previous run.

names
  dictionary with all filenames to be checked as keys
dname
  directory to check in (string)
shortcut
  flag indicating a shortcut should be taken (boolean)

Return:
  the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error

#### Subversion.vcsCheckout

vcsCheckout(vcsDataDict, projectDir, noDialog=False)

Public method used to check the project out of the Subversion repository.

vcsDataDict
  dictionary of data required for the checkout
projectDir
  project directory to create (string)
noDialog
  flag indicating quiet operations

Return:
  flag indicating an execution without errors (boolean)

#### Subversion.vcsCleanup

vcsCleanup(name)

Public method used to cleanup the working copy.

name
  directory name to be cleaned up (string)

#### Subversion.vcsClearCommitMessages

vcsClearCommitMessages()

Public method to clear the list of saved messages.

#### Subversion.vcsCommandLine

vcsCommandLine(name)

Public method used to execute arbitrary subversion commands.

name
  directory name of the working directory (string)

#### Subversion.vcsCommit

vcsCommit(name, message, noDialog=False)

Public method used to make the change of a file/directory permanent in the Subversion repository.

name
  file/directory name to be committed (string or list of strings)
message
  message for this operation (string)
noDialog
  flag indicating quiet operations

#### Subversion.vcsCommitMessages

vcsCommitMessages()

Public method to get the list of saved commit messages.

Return:
  list of saved commit messages

Return Type:
  list of str

#### Subversion.vcsConvertProject

vcsConvertProject(vcsDataDict, project, addAll=True)

Public method to convert an uncontrolled project to a version controlled project.

vcsDataDict (dict)
  dictionary of data required for the conversion
project (Project)
  reference to the project object
addAll (bool)
  flag indicating to add all files to the repository

#### Subversion.vcsDiff

vcsDiff(name)

Public method used to view the difference of a file/directory to the Subversion repository.

If name is a directory and is the project directory, all project files are saved first. If name is a file (or list of files), which is/are being edited and has unsaved modification, they can be saved or the operation may be aborted.

name
  file/directory name to be diffed (string)

#### Subversion.vcsExists

vcsExists()

Public method used to test for the presence of the svn executable.

Return:
  flag indicating the existance (boolean) and an error message (string)

#### Subversion.vcsExport

vcsExport(vcsDataDict, projectDir)

Public method used to export a directory from the Subversion repository.

vcsDataDict
  dictionary of data required for the checkout
projectDir
  project directory to create (string)

Return:
  flag indicating an execution without errors (boolean)

#### Subversion.vcsForget

vcsForget(name)

Public method used to remove a file from the repository.

Note: svn does not support this operation. The method is implemented as a NoOp.

name (str or list of str)
  file/directory name to be removed

#### Subversion.vcsGetProjectBrowserHelper

vcsGetProjectBrowserHelper(browser, project, isTranslationsBrowser=False)

Public method to instanciate a helper object for the different project browsers.

browser
  reference to the project browser object
project
  reference to the project object
isTranslationsBrowser
  flag indicating, the helper is requested for the translations browser (this needs some special treatment)

Return:
  the project browser helper object

#### Subversion.vcsGetProjectHelper

vcsGetProjectHelper(project)

Public method to instanciate a helper object for the project.

project
  reference to the project object

Return:
  the project helper object

#### Subversion.vcsImport

vcsImport(vcsDataDict, projectDir, noDialog=False, addAll=True)

Public method used to import the project into the Subversion repository.

vcsDataDict (dict)
  dictionary of data required for the import
projectDir (str)
  project directory (string)
noDialog (bool)
  flag indicating quiet operations
addAll (bool)
  flag indicating to add all files to the repository

Return:
  tuple containing a flag indicating an execution without errors and a flag indicating the version controll status

Return Type:
  tuple of (bool, bool)

#### Subversion.vcsInit

vcsInit(vcsDir, noDialog=False)

Public method used to initialize the subversion repository.

The subversion repository has to be initialized from outside eric because the respective command always works locally. Therefore we always return TRUE without doing anything.

vcsDir
  name of the VCS directory (string)
noDialog
  flag indicating quiet operations (boolean)

Return:
  always TRUE

#### Subversion.vcsInitConfig

vcsInitConfig(project)

Public method to initialize the VCS configuration.

This method ensures, that an ignore file exists.

project
  reference to the project (Project)

#### Subversion.vcsLogBrowser

vcsLogBrowser(name, isFile=False)

Public method used to browse the log of a file/directory from the Subversion repository.

name
  file/directory name to show the log of (string)
isFile
  flag indicating log for a file is to be shown (boolean)

#### Subversion.vcsMerge

vcsMerge(name)

Public method used to merge a URL/revision into the local project.

name
  file/directory name to be merged (string)

#### Subversion.vcsMove

vcsMove(name, project, target=None, noDialog=False)

Public method used to move a file/directory.

name
  file/directory name to be moved (string)
project
  reference to the project object
target
  new name of the file/directory (string)
noDialog
  flag indicating quiet operations

Return:
  flag indicating successfull operation (boolean)

#### Subversion.vcsName

vcsName()

Public method returning the name of the vcs.

Return:
  always 'Subversion' (string)

#### Subversion.vcsNewProjectOptionsDialog

vcsNewProjectOptionsDialog(parent=None)

Public method to get a dialog to enter repository info for getting a new project.

parent
  parent widget (QWidget)

Return:
  reference to the instantiated options dialog (SvnNewProjectOptionsDialog)

#### Subversion.vcsOptionsDialog

vcsOptionsDialog(project, archive, editable=False, parent=None)

Public method to get a dialog to enter repository info.

project
  reference to the project object
archive
  name of the project in the repository (string)
editable
  flag indicating that the project name is editable (boolean)
parent
  parent widget (QWidget)

Return:
  reference to the instantiated options dialog (SvnOptionsDialog)

#### Subversion.vcsRegisteredState

vcsRegisteredState(name)

Public method used to get the registered state of a file in the vcs.

name
  filename to check (string)

Return:
  a combination of canBeCommited and canBeAdded

#### Subversion.vcsRemove

vcsRemove(name, project=False, noDialog=False)

Public method used to remove a file/directory from the Subversion repository.

The default operation is to remove the local copy as well.

name
  file/directory name to be removed (string or list of strings))
project
  flag indicating deletion of a project tree (boolean) (not needed)
noDialog
  flag indicating quiet operations

Return:
  flag indicating successfull operation (boolean)

#### Subversion.vcsRepositoryInfos

vcsRepositoryInfos(ppath)

Public method to retrieve information about the repository.

ppath
  local path to get the repository infos (string)

Return:
  string with ready formated info for display (string)

#### Subversion.vcsResolved

vcsResolved(name)

Public method used to resolve conflicts of a file/directory.

name
  file/directory name to be resolved (string)

#### Subversion.vcsRevert

vcsRevert(name)

Public method used to revert changes made to a file/directory.

name (str)
  file/directory name to be reverted

Return:
  flag indicating, that the update contained an add or delete

Return Type:
  bool

#### Subversion.vcsSbsDiff

vcsSbsDiff(name, extended=False, revisions=None)

Public method used to view the difference of a file to the Mercurial repository side-by-side.

name
  file name to be diffed (string)
extended
  flag indicating the extended variant (boolean)
revisions
  tuple of two revisions (tuple of strings)

Raises ValueError:
  raised to indicate an illegal name parameter type

#### Subversion.vcsShutdown

vcsShutdown()

Public method used to shutdown the Subversion interface.

#### Subversion.vcsStatus

vcsStatus(name)

Public method used to view the status of files/directories in the Subversion repository.

name
  file/directory name(s) to show the status of (string or list of strings)

#### Subversion.vcsSwitch

vcsSwitch(name)

Public method used to switch a directory to a different tag/branch.

name
  directory name to be switched (string)

Return:
  flag indicating added or changed files (boolean)

#### Subversion.vcsTag

vcsTag(name)

Public method used to set the tag of a file/directory in the Subversion repository.

name
  file/directory name to be tagged (string)

#### Subversion.vcsUpdate

vcsUpdate(name, noDialog=False)

Public method used to update a file/directory with the Subversion repository.

name
  file/directory name to be updated (string or list of strings)
noDialog
  flag indicating quiet operations (boolean)

Return:
  flag indicating, that the update contained an add or delete (boolean)

Up