eric5.Plugins.VcsPlugins.vcsMercurial.hg

Module implementing the version control systems interface to Mercurial.

Global Attributes

None

Classes

Hg Class implementing the version control systems interface to Mercurial.

Functions

None


Hg

Class implementing the version control systems interface to Mercurial.

Signals

activeExtensionsChanged()
emitted when the list of active extensions has changed
committed()
emitted after the commit action has completed

Derived from

VersionControl

Class Attributes

IgnoreFileName

Class Methods

None

Methods

Hg Constructor
__getExtensionsInfo Private method to get the active extensions from Mercurial.
__hgURL Private method to format a url for Mercurial.
__iniFileChanged Private slot to handle a change of the Mercurial configuration file.
__monitorRepoIniFile Private slot to add a repository configuration file to the list of monitored files.
__vcsCommit_Step2 Private slot performing the second step of the commit action.
_createStatusMonitorThread Protected method to create an instance of the VCS status monitor thread.
clearStatusCache Public method to clear the status cache.
getClient Public method to get a reference to the command server interface.
getExtensionObject Public method to get a reference to an extension object.
getHgSubPath Public method to get the path to the .hgsub file containing the definitions of sub-repositories.
getPlugin Public method to get a reference to the plugin object.
hasSubrepositories Public method to check, if the project might have sub-repositories.
hgAddSubrepository Public method to add a sub-repository.
hgAnnotate Public method to show the output of the hg annotate command.
hgBackout Public method used to backout an earlier changeset from the Mercurial repository.
hgBisect Public method to perform bisect commands.
hgBranch Public method used to create a branch in the Mercurial repository.
hgBundle Public method to create a changegroup file.
hgCopy Public method used to copy a file/directory.
hgCreateIgnoreFile Public method to create the ignore file.
hgEditConfig Public method used to edit the repository configuration file.
hgEditUserConfig Public method used to edit the user configuration file.
hgExport Public method to export patches to files.
hgExtendedDiff Public method used to view the difference of a file/directory to the Mercurial repository.
hgForget Public method used to remove a file from the Mercurial repository.
hgGetBranchesList Public method to get the list of branches.
hgGetTagsList Public method to get the list of tags.
hgGraft Public method to copy changesets from another branch.
hgGraftContinue Public method to continue copying changesets from another branch.
hgIdentify Public method to identify the current working directory.
hgIdentifyBundle Public method used to identify a changegroup file.
hgImport Public method to import a patch file.
hgIncoming Public method used to view the log of incoming changes from the Mercurial repository.
hgInfo Public method to show information about the heads of the repository.
hgListTagBranch Public method used to list the available tags or branches.
hgLogBrowser Public method used to browse the log of a file/directory from the Mercurial repository.
hgNormalizeURL Public method to normalize a url for Mercurial.
hgOutgoing Public method used to view the log of outgoing changes from the Mercurial repository.
hgPhase Public method to change the phase of revisions.
hgPreviewBundle Public method used to view the log of incoming changes from a changegroup file.
hgPull Public method used to pull changes from a remote Mercurial repository.
hgPush Public method used to push changes to a remote Mercurial repository.
hgRecover Public method to recover an interrupted transaction.
hgRemoveSubrepositories Public method to remove sub-repositories.
hgResolve Public method used to resolve conflicts of a file/directory.
hgRevert Public method used to revert changes made to a file/directory.
hgRollback Public method used to rollback the last transaction.
hgServe Public method used to serve the project.
hgShowBranch Public method used to show the current branch the working directory.
hgShowConfig Public method to show the combined configuration.
hgShowPaths Public method to show the path aliases for remote repositories.
hgUnbundle Public method to apply changegroup files.
hgVerify Public method to verify the integrity of the repository.
isExtensionActive Public method to check, if an extension is active.
vcsAdd Public method used to add a file/directory to the Mercurial repository.
vcsAddBinary Public method used to add a file/directory in binary mode to the Mercurial repository.
vcsAddTree Public method to add a directory tree rooted at path to the Mercurial 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 a Mercurial repository (clone).
vcsCleanup Public method used to cleanup the working directory.
vcsCommandLine Public method used to execute arbitrary mercurial commands.
vcsCommit Public method used to make the change of a file/directory permanent in the Mercurial repository.
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 Mercurial repository.
vcsExists Public method used to test for the presence of the hg executable.
vcsExport Public method used to export a directory from the Subversion repository.
vcsGetProjectBrowserHelper Public method to instantiate a helper object for the different project browsers.
vcsGetProjectHelper Public method to instantiate 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 mercurial repository.
vcsInitConfig Public method to initialize the VCS configuration.
vcsLog Public method used to view the log of a file/directory from the Mercurial 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 Mercurial repository.
vcsRepositoryInfos Public method to retrieve information about the repository.
vcsShutdown Public method used to shutdown the Mercurial interface.
vcsStatus Public method used to view the status of files/directories in the Mercurial repository.
vcsSwitch Public method used to switch a working directory to a different revision.
vcsTag Public method used to set the tag in the Mercurial repository.
vcsUpdate Public method used to update a file/directory with the Mercurial repository.

Static Methods

None

Hg (Constructor)

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

Constructor

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

Hg.__getExtensionsInfo

__getExtensionsInfo()

Private method to get the active extensions from Mercurial.

Hg.__hgURL

__hgURL(url)

Private method to format a url for Mercurial.

url
unformatted url string (string)
Returns:
properly formated url for mercurial (string)

Hg.__iniFileChanged

__iniFileChanged(path)

Private slot to handle a change of the Mercurial configuration file.

path
name of the changed file (string)

Hg.__monitorRepoIniFile

__monitorRepoIniFile(name)

Private slot to add a repository configuration file to the list of monitored files.

name
directory name pointing into the repository (string)

Hg.__vcsCommit_Step2

__vcsCommit_Step2()

Private slot performing the second step of the commit action.

Hg._createStatusMonitorThread

_createStatusMonitorThread(interval, project)

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

project
reference to the project object (Project)
interval
check interval for the monitor thread in seconds (integer)
Returns:
reference to the monitor thread (QThread)

Hg.clearStatusCache

clearStatusCache()

Public method to clear the status cache.

Hg.getClient

getClient()

Public method to get a reference to the command server interface.

Returns:
reference to the client (HgClient)

Hg.getExtensionObject

getExtensionObject(extensionName)

Public method to get a reference to an extension object.

extensionName
name of the extension (string)
Returns:
reference to the extension object (boolean)

Hg.getHgSubPath

getHgSubPath()

Public method to get the path to the .hgsub file containing the definitions of sub-repositories.

Returns:
full path of the .hgsub file (string)

Hg.getPlugin

getPlugin()

Public method to get a reference to the plugin object.

Returns:
reference to the plugin object (VcsMercurialPlugin)

Hg.hasSubrepositories

hasSubrepositories()

Public method to check, if the project might have sub-repositories.

Returns:
flag indicating the existence of sub-repositories (boolean)

Hg.hgAddSubrepository

hgAddSubrepository()

Public method to add a sub-repository.

Hg.hgAnnotate

hgAnnotate(name)

Public method to show the output of the hg annotate command.

name
file name to show the annotations for (string)

Hg.hgBackout

hgBackout(name)

Public method used to backout an earlier changeset from the Mercurial repository.

name
directory name (string or list of strings)

Hg.hgBisect

hgBisect(name, subcommand)

Public method to perform bisect commands.

name
file/directory name (string)
subcommand
name of the subcommand (string, one of 'good', 'bad', 'skip' or 'reset')

Hg.hgBranch

hgBranch(name)

Public method used to create a branch in the Mercurial repository.

name
file/directory name to be branched (string)

Hg.hgBundle

hgBundle(name)

Public method to create a changegroup file.

name
file/directory name (string)

Hg.hgCopy

hgCopy(name, project)

Public method used to copy a file/directory.

name
file/directory name to be copied (string)
project
reference to the project object
Returns:
flag indicating successful operation (boolean)

Hg.hgCreateIgnoreFile

hgCreateIgnoreFile(name, autoAdd=False)

Public method to create the ignore file.

name
directory name to create the ignore file in (string)
autoAdd
flag indicating to add it automatically (boolean)
Returns:
flag indicating success

Hg.hgEditConfig

hgEditConfig(name)

Public method used to edit the repository configuration file.

name
file/directory name (string)

Hg.hgEditUserConfig

hgEditUserConfig()

Public method used to edit the user configuration file.

Hg.hgExport

hgExport(name)

Public method to export patches to files.

name
directory name of the project to export from (string)

Hg.hgExtendedDiff

hgExtendedDiff(name)

Public method used to view the difference of a file/directory to the Mercurial 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)

Hg.hgForget

hgForget(name)

Public method used to remove a file from the Mercurial repository.

This will not remove the file from the project directory.

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

Hg.hgGetBranchesList

hgGetBranchesList(repodir)

Public method to get the list of branches.

repodir
directory name of the repository (string)
Returns:
list of branches (list of string)

Hg.hgGetTagsList

hgGetTagsList(repodir)

Public method to get the list of tags.

repodir
directory name of the repository (string)
Returns:
list of tags (list of string)

Hg.hgGraft

hgGraft(path)

Public method to copy changesets from another branch.

path
directory name of the project (string)
Returns:
flag indicating that the project should be reread (boolean)

Hg.hgGraftContinue

hgGraftContinue(path)

Public method to continue copying changesets from another branch.

path
directory name of the project (string)
Returns:
flag indicating that the project should be reread (boolean)

Hg.hgIdentify

hgIdentify(name)

Public method to identify the current working directory.

name
file/directory name (string)

Hg.hgIdentifyBundle

hgIdentifyBundle(name)

Public method used to identify a changegroup file.

name
directory name on which to base the changegroup (string)

Hg.hgImport

hgImport(name)

Public method to import a patch file.

name
directory name of the project to import into (string)
Returns:
flag indicating, that the import contained an add, a delete or a change to the project file (boolean)

Hg.hgIncoming

hgIncoming(name)

Public method used to view the log of incoming changes from the Mercurial repository.

name
file/directory name to show the log of (string)

Hg.hgInfo

hgInfo(ppath, mode="heads")

Public method to show information about the heads of the repository.

ppath
local path to get the repository infos (string)
mode=
mode of the operation (string, one of heads, parents, tip)

Hg.hgListTagBranch

hgListTagBranch(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)

Hg.hgLogBrowser

hgLogBrowser(path)

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

path
file/directory name to show the log of (string)

Hg.hgNormalizeURL

hgNormalizeURL(url)

Public method to normalize a url for Mercurial.

url
url string (string)
Returns:
properly normalized url for mercurial (string)

Hg.hgOutgoing

hgOutgoing(name)

Public method used to view the log of outgoing changes from the Mercurial repository.

name
file/directory name to show the log of (string)

Hg.hgPhase

hgPhase(name, data=None)

Public method to change the phase of revisions.

name
directory name of the project to export from (string)
data
tuple giving phase data (list of revisions, phase, flag indicating a forced operation) (list of strings, string, boolean)
Returns:
flag indicating success (boolean)

Hg.hgPreviewBundle

hgPreviewBundle(name)

Public method used to view the log of incoming changes from a changegroup file.

name
directory name on which to base the changegroup (string)

Hg.hgPull

hgPull(name)

Public method used to pull changes from a remote Mercurial repository.

name
directory name of the project to be pulled to (string)
Returns:
flag indicating, that the update contained an add or delete (boolean)

Hg.hgPush

hgPush(name, force=False, newBranch=False)

Public method used to push changes to a remote Mercurial repository.

name
directory name of the project to be pushed from (string)
force=
flag indicating a forced push (boolean)
newBranch=
flag indicating to push a new branch (boolean)

Hg.hgRecover

hgRecover(name)

Public method to recover an interrupted transaction.

name
file/directory name (string)

Hg.hgRemoveSubrepositories

hgRemoveSubrepositories()

Public method to remove sub-repositories.

Hg.hgResolve

hgResolve(name)

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

name
file/directory name to be resolved (string)

Hg.hgRevert

hgRevert(name)

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

name
file/directory name to be reverted (string)
Returns:
flag indicating, that the update contained an add or delete (boolean)

Hg.hgRollback

hgRollback(name)

Public method used to rollback the last transaction.

name
directory name (string or list of strings)

Hg.hgServe

hgServe(name)

Public method used to serve the project.

name
directory name (string)

Hg.hgShowBranch

hgShowBranch(name)

Public method used to show the current branch the working directory.

name
file/directory name (string)

Hg.hgShowConfig

hgShowConfig(name)

Public method to show the combined configuration.

name
file/directory name (string)

Hg.hgShowPaths

hgShowPaths(name)

Public method to show the path aliases for remote repositories.

name
file/directory name (string)

Hg.hgUnbundle

hgUnbundle(name)

Public method to apply changegroup files.

name
directory name (string)
Returns:
flag indicating, that the update contained an add or delete (boolean)

Hg.hgVerify

hgVerify(name)

Public method to verify the integrity of the repository.

name
file/directory name (string)

Hg.isExtensionActive

isExtensionActive(extensionName)

Public method to check, if an extension is active.

extensionName
name of the extension to check for (string)
Returns:
flag indicating an active extension (boolean)

Hg.vcsAdd

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

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

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

Hg.vcsAddBinary

vcsAddBinary(name, isDir=False)

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

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

Hg.vcsAddTree

vcsAddTree(path)

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

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

Hg.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)
Returns:
the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error

Hg.vcsCheckout

vcsCheckout(vcsDataDict, projectDir, noDialog=False)

Public method used to check the project out of a Mercurial repository (clone).

vcsDataDict
dictionary of data required for the checkout
projectDir
project directory to create (string)
noDialog
flag indicating quiet operations
Returns:
flag indicating an execution without errors (boolean)

Hg.vcsCleanup

vcsCleanup(name)

Public method used to cleanup the working directory.

name
directory name to be cleaned up (string)

Hg.vcsCommandLine

vcsCommandLine(name)

Public method used to execute arbitrary mercurial commands.

name
directory name of the working directory (string)

Hg.vcsCommit

vcsCommit(name, message, noDialog=False, closeBranch=False)

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

name
file/directory name to be committed (string or list of strings)
message
message for this operation (string)
noDialog
flag indicating quiet operations
closeBranch=
flag indicating a close branch commit (boolean)

Hg.vcsConvertProject

vcsConvertProject(vcsDataDict, project)

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

vcsDataDict
dictionary of data required for the conversion
project
reference to the project object

Hg.vcsDiff

vcsDiff(name)

Public method used to view the difference of a file/directory to the Mercurial 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)

Hg.vcsExists

vcsExists()

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

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

Hg.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)
Returns:
flag indicating an execution without errors (boolean)

Hg.vcsGetProjectBrowserHelper

vcsGetProjectBrowserHelper(browser, project, isTranslationsBrowser=False)

Public method to instantiate 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)
Returns:
the project browser helper object

Hg.vcsGetProjectHelper

vcsGetProjectHelper(project)

Public method to instantiate a helper object for the project.

project
reference to the project object
Returns:
the project helper object

Hg.vcsImport

vcsImport(vcsDataDict, projectDir, noDialog=False)

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

vcsDataDict
dictionary of data required for the import
projectDir
project directory (string)
noDialog
flag indicating quiet operations
Returns:
flag indicating an execution without errors (boolean) and a flag indicating the version controll status (boolean)

Hg.vcsInit

vcsInit(vcsDir, noDialog=False)

Public method used to initialize the mercurial repository.

The initialization is done, when a project is converted into a Mercurial controlled project. Therefore we always return TRUE without doing anything.

vcsDir
name of the VCS directory (string)
noDialog
flag indicating quiet operations (boolean)
Returns:
always TRUE

Hg.vcsInitConfig

vcsInitConfig(project)

Public method to initialize the VCS configuration.

This method ensures, that an ignore file exists.

project
reference to the project (Project)

Hg.vcsLog

vcsLog(name)

Public method used to view the log of a file/directory from the Mercurial repository.

name
file/directory name to show the log of (string)

Hg.vcsMerge

vcsMerge(name)

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

name
file/directory name to be merged (string)

Hg.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
Returns:
flag indicating successfull operation (boolean)

Hg.vcsName

vcsName()

Public method returning the name of the vcs.

Returns:
always 'Mercurial' (string)

Hg.vcsNewProjectOptionsDialog

vcsNewProjectOptionsDialog(parent=None)

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

parent
parent widget (QWidget)

Hg.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)

Hg.vcsRegisteredState

vcsRegisteredState(name)

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

name
filename to check (string)
Returns:
a combination of canBeCommited and canBeAdded

Hg.vcsRemove

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

Public method used to remove a file/directory from the Mercurial 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
Returns:
flag indicating successfull operation (boolean)

Hg.vcsRepositoryInfos

vcsRepositoryInfos(ppath)

Public method to retrieve information about the repository.

ppath
local path to get the repository infos (string)
Returns:
string with ready formated info for display (string)

Hg.vcsShutdown

vcsShutdown()

Public method used to shutdown the Mercurial interface.

Hg.vcsStatus

vcsStatus(name)

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

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

Hg.vcsSwitch

vcsSwitch(name)

Public method used to switch a working directory to a different revision.

name
directory name to be switched (string)
Returns:
flag indicating, that the switch contained an add or delete (boolean)

Hg.vcsTag

vcsTag(name)

Public method used to set the tag in the Mercurial repository.

name
file/directory name to be tagged (string)

Hg.vcsUpdate

vcsUpdate(name, noDialog=False, revision=None)

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

name
file/directory name to be updated (string or list of strings)
noDialog
flag indicating quiet operations (boolean)
revision=
revision to update to (string)
Returns:
flag indicating, that the update contained an add or delete (boolean)
Up