Ggit.OId

Fields

None

Methods

class

new_from_raw (raw)

class

new_from_string (str)

compare (b)

copy ()

equal (b)

free ()

has_prefix (prefix)

hash ()

is_zero ()

to_string ()

Details

class Ggit.OId

Represents a unique ID of any object.

classmethod new_from_raw(raw)
Parameters:

raw (bytes) – the raw input bytes to be copied.

Returns:

a newly allocated Ggit.OId or None on error.

Return type:

Ggit.OId or None

Creates a new Ggit.OId from a raw oid.

classmethod new_from_string(str)
Parameters:

str (str) – input hex string; must be pointing at the start of the hex sequence and have at least the number of bytes needed for an oid encoded in hex (40 bytes).

Returns:

a newly allocated Ggit.OId or None on error.

Return type:

Ggit.OId or None

Parses a hex formatted object id into a Ggit.OId.

compare(b)
Parameters:

b (Ggit.OId) – second Ggit.OId.

Returns:

<0, 0, >0 if a < b, a == b, a > b.

Return type:

int

Compare two Ggit.OId structures.

copy()
Returns:

a newly allocated Ggit.OId.

Return type:

Ggit.OId or None

Copies self into a newly allocated Ggit.OId.

equal(b)
Parameters:

b (Ggit.OId) – a Ggit.OId.

Returns:

True if self and b are equal, False otherwise

Return type:

bool

Compares two Ggit.OId for equality.

free()

Frees self.

has_prefix(prefix)
Parameters:

prefix (str) – a prefix.

Returns:

True if the id has the given prefix, False otherwise.

Return type:

bool

Check whether the object id has a given prefix. Note that the prefix is specified in hexadecimal ASCII.

hash()
Returns:

the hash value

Return type:

int

Computes a hash value for a git object identifier.

is_zero()
Returns:

True if the oid contains only zeros, False otherwise.

Return type:

bool

Get whether the oid contains only zeros.

to_string()
Returns:

a newly allocated string representing self or None.

Return type:

str or None

Converts self into a readable string.