| Server IP : 216.92.14.13 / Your IP : 216.73.217.126 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/python3-dulwich/tutorial/ |
Upload File : |
Porcelain
=========
The ``porcelain`` is the higher level interface, built on top of the lower
level implementation covered in previous chapters of this tutorial. The
``dulwich.porcelain`` module in Dulwich is aimed to closely resemble
the Git command-line API that you are familiar with.
Basic concepts
--------------
The porcelain operations are implemented as top-level functions in the
``dulwich.porcelain`` module. Most arguments can either be strings or
more complex Dulwich objects; e.g. a repository argument will either take
a string with a path to the repository or an instance of a ``Repo`` object.
Initializing a new repository
-----------------------------
>>> from dulwich import porcelain
>>> repo = porcelain.init("myrepo")
Clone a repository
------------------
>>> porcelain.clone("git://github.com/jelmer/dulwich", "dulwich-clone")
Commit changes
--------------
>>> r = porcelain.init("testrepo")
>>> open("testrepo/testfile", "w").write("data")
>>> porcelain.add(r, "testfile")
>>> porcelain.commit(r, b"A sample commit")
Push changes
------------
>>> tr = porcelain.init("targetrepo")
>>> r = porcelain.push("testrepo", "targetrepo", "master")