dulwich.objectspec module

Object specification.

exception dulwich.objectspec.AmbiguousShortId(prefix, options)

Bases: Exception

The short id is ambiguous.

dulwich.objectspec.parse_commit(repo, committish)

Parse a string referring to a single commit.

Parameters
  • repo – A` Repo` object

  • commitish – A string referring to a single commit.

Returns: A Commit object :raises KeyError: When the reference commits can not be found :raises ValueError: If the range can not be parsed

dulwich.objectspec.parse_commit_range(repo, committishs)

Parse a string referring to a range of commits.

Parameters
  • repo – A Repo object

  • committishs – A string referring to a range of commits.

Returns: An iterator over Commit objects :raises KeyError: When the reference commits can not be found :raises ValueError: If the range can not be parsed

dulwich.objectspec.parse_object(repo, objectish)

Parse a string referring to an object.

Parameters
  • repo – A Repo object

  • objectish – A string referring to an object

Returns: A git object :raises KeyError: If the object can not be found

dulwich.objectspec.parse_ref(container, refspec)

Parse a string referring to a reference.

Parameters
  • container – A RefsContainer object

  • refspec – A string referring to a ref

Returns: A ref :raises KeyError: If the ref can not be found

dulwich.objectspec.parse_refs(container, refspecs)

Parse a list of refspecs to a list of refs.

Parameters
  • container – A RefsContainer object

  • refspecs – A list of refspecs or a string

Returns: A list of refs :raises KeyError: If one of the refs can not be found

dulwich.objectspec.parse_reftuple(lh_container, rh_container, refspec, force=False)

Parse a reftuple spec.

Parameters
  • lh_container – A RefsContainer object

  • hh_container – A RefsContainer object

  • refspec – A string

Returns: A tuple with left and right ref :raises KeyError: If one of the refs can not be found

dulwich.objectspec.parse_reftuples(lh_container, rh_container, refspecs: Union[bytes, List[bytes], List[Tuple[bytes, bytes]]], force: bool = False)

Parse a list of reftuple specs to a list of reftuples.

Parameters
  • lh_container – A RefsContainer object

  • hh_container – A RefsContainer object

  • refspecs – A list of refspecs or a string

  • force – Force overwriting for all reftuples

Returns: A list of refs :raises KeyError: If one of the refs can not be found

dulwich.objectspec.parse_tree(repo, treeish)

Parse a string referring to a tree.

Parameters
  • repo – A Repo object

  • treeish – A string referring to a tree

Returns: A git object :raises KeyError: If the object can not be found

dulwich.objectspec.scan_for_short_id(object_store, prefix)

Scan an object store for a short id.

dulwich.objectspec.to_bytes(text)