Workdir Api

open(path, dont_try=())
Parameters:path – a local path to the worktree preferable a py.path.local instance

open a scm workdir

It uses the backend metadata to find the correct backend and won’t import unnecessary backends to keep the import time low

checkout(source, target)

create a light checkout of the given source

clone(source, target)

create a heavy checkout/clone of the given source

class WorkDir(path, create=False, source=None)[source]

Basic Workdir API

Parameters:
  • path – base path
  • create
commit(paths=(), message=None, user=None)[source]
Parameters:
  • path – the paths
  • message – the commit message
  • user – optional author name

commits the given paths/files with the given commit message and author

diff(paths=())[source]

given a list of paths it will return a diff

process_paths(paths)[source]

preprocess given paths

status(paths=(), recursive=True)[source]
Parameters:
  • path (sequence of string) – the filenames
  • recursive (bool) – proceed recursive for directories

yield a list of Path instances tagged with status informations

update(paths=(), revision=None)[source]
Parameters:revision – the target revision may not actually work for vcs’s with tricky workdir revision setups

updates the workdir to either the closest head or or the given revision

class WorkDirWithParser(path, create=False, source=None)[source]

extension of the workdir class to support parsing needs

cache(paths=(), recursive=False)[source]

return a mapping of name to cached states only necessary for messed up vcs’s

cache_impl(paths=False, recursive=False)[source]

creates a list of vcs specific cache items only necessary by messed up vcs’s

in case of doubt - dont touch ^^

parse_cache_items(items)[source]

parses vcs specific cache items to a list of (name, state) tuples

parse_status_item(item, cache)[source]

parse a single status item meant to be overridden

parse_status_items(items, cache)[source]

default implementation

for each item in items invoke:

self.parse_status_item(item, cache)

Note

a more complex parser might need to overwrite

status(paths=(), recursive=True)[source]

yield a list of Path instances tagged with status informations

status_impl(paths=False, recursive=False)[source]

yield a list of vcs specific listing items

class StatedPath(name, state='normal', base=None)[source]

stores status informations about files

>>> StatedPath('a.txt')
<normal 'a.txt'>
>>> StatedPath('a.txt', 'changed')
<changed 'a.txt'>