Package pybaz :: Class WorkingTree
[frames] | no frames]

Class WorkingTree

source code

object --+                        
         |                        
basestring --+                    
             |                    
           str --+                
                 |                
 pathname.PathName --+            
                     |            
      pathname.DirName --+        
                         |        
                SourceTree --+    
                             |    
                ArchSourceTree --+
                                 |
                                WorkingTree

Working source tree, Arch source tree which can be modified.



Instance Methods
 
__init__(self, root)
Create WorkingTree object with the given root path.
 
add_log_version(self, version)
Add a patch log version to the project tree.
 
add_pristine(self, revision)
Ensure that the project tree has a particular pristine revision.
 
add_tag(self, file)
 
changes(self, revision=None, output=None)
Uncommited changes in this tree.
 
commit(self, log=None, strict=False, seal=False, fix=False, out_of_date_ok=False, file_list=None, version=None, just_commit=False)
Archive a changeset-based revision.
 
del_file(self, file)
 
del_tag(self, file)
 
delete(self, file)
 
find_pristine(self, revision)
Path to a pristine tree for the given revision.
 
has_changes(self)
Are there uncommited changes is this source tree?...
 
import_(self, log=None)
Archive a full-source base-0 revision.
 
iter_commit(self, log=None, strict=False, seal=False, fix=False, out_of_date_ok=False, file_list=None, version=None, just_commit=False, stderr_too=False)
Archive a changeset-based revision, returning an iterator.
 
iter_pristines(self)
Pristines present in that source tree.
 
iter_star_merge(self, from_=None, reference=None, forward=False, diff3=False)
Merge mutually merged branches.
 
log_for_merge(self)
Standard arch log of newly merged patches.
 
log_message(self, create=True)
Default log-message object used by import and commit.
 
move_file(self, src, dest)
 
move_tag(self, src, dest)
 
redo(self, patch=None, keep=False, quiet=False)
Redo changes in a project tree.
 
remove_log_version(self, version)
Remove a patch log version from the project tree.
 
replay(self)
Replay changesets into this working tree.
 
resolved(self, all=False)
 
set_tagging_method(self, method)
 
set_tree_version(self, version)
 
star_merge(self, from_=None, reference=None, forward=False, diff3=False)
Merge mutually merged branches.
 
sync_tree(self, revision)
Adds the patchlogs in the given revision to the current tree.
 
undo(self, revision=None, output=None, quiet=False, throw_away=False)
Undo and save changes in a project tree.
 
update(self)
Apply delta of new revisions in the archive.

Inherited from ArchSourceTree: check_is_tree_root, file_find, get_tag, get_tagging_method, get_tree, get_tree_version, inventory, iter_inventory, iter_inventory_ids, iter_log_versions, iter_logs

Inherited from pathname.PathName: __div__, __repr__, abspath, basename, dirname, realpath, splitname

Inherited from str: __add__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __getnewargs__, __getslice__, __gt__, __hash__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __rmod__, __rmul__, __str__, capitalize, center, count, decode, encode, endswith, expandtabs, find, index, isalnum, isalpha, isdigit, islower, isspace, istitle, isupper, join, ljust, lower, lstrip, partition, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Static Methods

Inherited from SourceTree: __new__

Properties
  tagging_method
  tree_version
Default version of the tree, also called tree-version.

Inherited from ArchSourceTree: tree_revision

Inherited from object: __class__

Method Details

__init__(self, root)
(Constructor)

 
Create WorkingTree object with the given root path.

Root must be a directory containing a valid Arch source tree
outside of the revision library.

Overrides: object.__init__

add_pristine(self, revision)

 
Ensure that the project tree has a particular pristine revision.

:param revision: revision to add a pristine for.
:type revision: `Revision`

changes(self, revision=None, output=None)

 
Uncommited changes in this tree.

:param revision: produce the changeset between this revision
    and the tree. If ``revision`` is ``None``, use the
    tree-revision.
:type revision: `Revision`, None
:param output: absolute path of the changeset to produce.
:type output: string
:return: changeset between ``revision`` and the tree.
:rtype: Changeset
:raise errors.TreeVersionError: no valid default version set.
:raise IOError: unable to read the ++default-version file.

commit(self, log=None, strict=False, seal=False, fix=False, out_of_date_ok=False, file_list=None, version=None, just_commit=False)

 
Archive a changeset-based revision.

:keyword version: version in which to commit the revision.
    Defaults to the `tree_version`.
:type version: `Version`, str
:keyword log: Log message for this revision. Defaults to the log
    message file of the tree-version (the file created by
    ``tla make-log``.
:type log: `LogMessage`
:param strict: perform a strict tree-lint before commiting.
:type strict: bool
:param seal: create a ``version-0`` revision.
:type seal: bool
:param fix: create a ``versionfix`` revision.
:type fix: bool
:param out_of_date_ok: commit even if the tree is out of
    date.
:type out_of_date_ok: bool
:param file_list: Only commit changes to those files,
    specified relative to the tree-root.
:type file_list: iterable of str, with at least one item.
:param just_commit: only create new revision, do not add ancillary data
    like cachedrevs or ancestry files.
:type just_commit: bool

The --summary and --log-message options to tla are mere CLI
convenience features and are not directly supported.

:see: `WorkingTree.iter_commit`

find_pristine(self, revision)

 
Path to a pristine tree for the given revision.

:param revision: find a pristine for that revision.
:type revision: `Revision`
:rtype: `ArchSourceTree`
:raise errors.NoPristineFoundError: no pristine tree was found
    for the given revision.

has_changes(self)

 
Are there uncommited changes is this source tree?

:rtype: bool

import_(self, log=None)

 
Archive a full-source base-0 revision.

If log is specified, it must be a LogMessage object or a file
name as a string. If omitted, the default log message file of
the tree is used.

The --summary, --log-message and --setup options to tla are
mere CLI convenience features and are not directly supported.

iter_commit(self, log=None, strict=False, seal=False, fix=False, out_of_date_ok=False, file_list=None, version=None, just_commit=False, stderr_too=False)

 
Archive a changeset-based revision, returning an iterator.


:keyword version: version in which to commit the revision.
    Defaults to the `tree_version`.
:type version: `Version`, str
:keyword log: Log message for this revision. Defaults to the log
    message file of the tree-version (the file created by
    ``tla make-log``.
:type log: `LogMessage`
:keyword strict: perform a strict tree-lint before commiting.
:type strict: bool
:keyword seal: create a ``version-0`` revision.
:type seal: bool
:keyword fix: create a ``versionfix`` revision.
:type fix: bool
:keyword out_of_date_ok: commit even if the tree is out of
    date.
:type out_of_date_ok: bool
:keyword file_list: Only commit changes to those files,
    specified relative to the tree-root.
:type file_list: iterable of str, with at least one item.
:param just_commit: only create new revision, do not add ancillary data
    like cachedrevs or ancestry files.
:type just_commit: bool
:param stderr_too: iterate over stderr output as well as stdout.
:type stderr_too: bool
:rtype: iterator of `TreeChange`, `Chatter` or str

:warning: ``stderr_too=True`` is only supported with the
PyArchSpawningStrategy. Using it will cause a ArgumentError with the
TwistedSpawningStrategy. That will be fixed when the process handling
subsystem is replaced by Gnarly.

The --summary and --log-message options to tla are mere CLI
convenience features and are not directly supported.

:see: `WorkingTree.commit`

iter_pristines(self)

 
Pristines present in that source tree.

:return: Revisions which have pristine trees in that source tree.
:rtype: iterable of `Revision`

iter_star_merge(self, from_=None, reference=None, forward=False, diff3=False)

 
Merge mutually merged branches.

:param `from_`: branch to merge changes from, ``None`` means the
    ``tree-version``.
:type `from_`: None, `Version`, `Revision`, or str
:param reference: reference version for the merge, ``None``
    means the ``tree-version``.
:type reference: None, `Version` or str
:param forward: ignore already applied patch hunks.
:type forward: bool
:param diff3: produce inline conflict markers instead of
    ``.rej`` files.
:type diff3: bool
:raise errors.NamespaceError: ``from_`` or ``reference`` is
    not a valid version or revision name.
:rtype: `ChangesetApplication`

log_for_merge(self)

 
Standard arch log of newly merged patches.

:rtype: str

log_message(self, create=True)

 
Default log-message object used by import and commit.

If `create` is False, and the standard log file does not already
exists, return None. If `create` is True, use ``tla make-log`` if
needed.

redo(self, patch=None, keep=False, quiet=False)

 
Redo changes in a project tree.

Apply patch to the project tree and delete patch.

If patch is provided, it must be a Changeset object. Else, the highest
numbered ,,undo-N directory in the project tree root is used.

If keep is true, the patch directory is not deleted.

star_merge(self, from_=None, reference=None, forward=False, diff3=False)

 
Merge mutually merged branches.

:bug: if the merge causes a conflict, a RuntimeError is
    raised. You should not rely on this behaviour as it is
    likely to change in the future. If you want to support
    conflicting merges, use `iter_star_merge` instead.

:param `from_`: branch to merge changes from, ``None`` means the
    ``tree-version``.
:type `from_`: None, `Version`, `Revision`, or str
:param reference: reference version for the merge, ``None``
    means the ``tree-version``.
:type reference: None, `Version` or str
:param forward: ignore already applied patch hunks.
:type forward: bool
:param diff3: produce inline conflict markers instead of
    ``.rej`` files.
:type diff3: bool
:raise errors.NamespaceError: ``from_`` or ``reference`` is
    not a valid version or revision name.

sync_tree(self, revision)

 
Adds the patchlogs in the given revision to the current tree.

Create a temporary source tree for ``revision``, then add all the
patchlogs present in that tree to the current tree. No content
is touched besides the patchlogs.

:param revision: revision to synchronize with.
:type revision: `Version`, `Revision` or str
:raise errors.NamespaceError: ``revision`` is not a valid
    version or revision name.

undo(self, revision=None, output=None, quiet=False, throw_away=False)

 
Undo and save changes in a project tree.

Remove local changes since revision and optionally save them
as a changeset.

:keyword revision: revision to revert to. Default to the last
    revision of the tree-version for which a patchlog is present.
:type revision: `Revision`, str
:keyword output: name of the output changeset directory. Must
    not already exist. Default to an automatic ,,undo-N name
    in the working tree.
:type output: str
:keyword quiet: OBSOLETE. Incremental output is always discarded.
:type quiet: bool
:keyword throw_away: discard the output changeset and return
    ``None``. Must not be used at the same time as ``output``.
:type throw_away: bool
:return: changeset restoring the undone changes,
    or None if ``throw_away``.
:rtype: `Changeset`, None

update(self)

 
Apply delta of new revisions in the archive.

Apply delta(A,B) on this working tree, where A and B are both
revisions of the tree version, A is the latest whose patchlog
is present in the tree and B is the latest present in the
archive.


Property Details

tagging_method

Get Method:
unreachable.get_tagging_method(self)
Set Method:
pybaz.WorkingTree.set_tagging_method(self, method)

tree_version

Default version of the tree, also called tree-version.

:raise errors.TreeVersionError: no valid default version set.
:raise IOError: unable to read the ++default-version file.

Get Method:
unreachable.get_tree_version(self) - Default version of the tree, also called tree-version.
Set Method:
pybaz.WorkingTree.set_tree_version(self, version)