noc.core.gridvcs.base

Module Contents

class noc.core.gridvcs.base.GridVCS(repo)

Bases: object

T_FILE = F
T_BDIFF = b
T_BSDIFF4 = B
ENCODING = utf-8
DEFAULT_COMPRESS = z
get_delta(self, src, dst)

Calculate strings delta :param src: Source string :param dst: Destination string :return: (<type>, delta)

classmethod apply_delta(cls, type, src, delta)

Apply delta :param type: Delta type :param src: Source string :param delta: Delta :return: Patched string

static apply_delta_F(src, delta)

Raw string :param src: :param delta: :return:

static apply_delta_b(src, delta)

Mercurial mdiff. Slow python implementation ported from Mercurial 0.4. For legacy installations support only :param src: :param delta: :return:

static apply_delta_B(src, delta)

BSDIFF4 diff :param src: :param delta: :return:

classmethod compress(cls, data, method=None)
classmethod decompress(cls, data, method=None)
static compress_z(data)
static decompress_z(data)
put(self, object, data, ts=None)

Save data :param object: Object id :param data: Data to store :param ts: Timestamp :return:

get(self, object, revision=None)

Get data :param object: Object id :param revision: Revision instance :return: Revision text

delete(self, object)

Delete object’s data and history :param object: :return:

iter_revisions(self, object, reverse=False)

Get object’s revision :param object: :return: List of Revisions

find_revision(self, object, revision)
Parameters:
  • object
  • revision – Revision id
Returns:

static _unified_diff(src, dst)

Returns unified diff between src and dest

Parameters:
  • src – Source text
  • dst – Destination text
Returns:

Unified diff text

diff(self, object, rev1, rev2)

Get unified diff between revisions :param object: :param rev1: :param rev2: :return:

mdiff(self, obj1, rev1, obj2, rev2)

Get unified diff between multiple object’s revisions

Parameters:
  • obj1
  • rev1
  • obj2
  • rev2
Returns:

ensure_collection(self)