commit - 1997f839a022252a607d6dff033bdd52f62fff41
commit + c67d2ed684ab9c2b5511746a244f0c1e9854ae0e
blob - 0bf0e1f3ab41a828ded9c8b28fe5df0c454dfb69
blob + 85c2a5bf2041f9546f86bc088dff9040204ad870
--- NEWS
+++ NEWS
0.20.47 UNRELEASED
+ * Add -b argument to ``dulwich clone``.
+ (Jelmer Vernooij)
+
* On Windows, provide a hint about developer mode
when creating symlinks fails due to a permission
error. (Jelmer Vernooij, #1005)
blob - 4ccf991c68199e54a231d3c462ef64b02c8a6462
blob + 184bd9c95a90510d9482bd0027e10c392371b32d
--- dulwich/cli.py
+++ dulwich/cli.py
parser.add_option(
"--depth", dest="depth", type=int, help="Depth at which to fetch"
)
+ parser.add_option(
+ "-b", "--branch", dest="branch", type=str,
+ help=("Check out branch instead of branch pointed to by remote "
+ "HEAD"))
options, args = parser.parse_args(args)
if args == []:
else:
target = None
- porcelain.clone(source, target, bare=options.bare, depth=options.depth)
+ porcelain.clone(source, target, bare=options.bare, depth=options.depth,
+ branch=options.branch)
class cmd_commit(Command):
blob - 7082e3ef4a4dd03cbf99f179474c09e060f75f4e
blob + a8b70fc9b178e51d95019231a9060d91f04c3180
--- dulwich/client.py
+++ dulwich/client.py
class LocalGitClient(GitClient):
"""Git Client that just uses a local Repo."""
- def __init__(self, thin_packs=True, report_activity=None, config=None):
+ def __init__(self, thin_packs=True, report_activity=None,
+ config: Optional[Config] = None):
"""Create a new LocalGitClient instance.
Args:
blob - 2a397a75c225d04b76d94183dc20829ddd6d475d
blob + 479c2d1e381ac7a33f2c2ef2b156665d3aa17ac4
--- dulwich/porcelain.py
+++ dulwich/porcelain.py
get_transport_and_path,
)
from dulwich.config import (
+ Config,
ConfigFile,
StackedConfig,
read_submodules,
checkout=None,
errstream=default_bytes_err_stream,
outstream=None,
- origin="origin",
- depth=None,
- branch=None,
- config=None,
+ origin: Optional[str] = "origin",
+ depth: Optional[int] = None,
+ branch: Optional[Union[str, bytes]] = None,
+ config: Optional[Config] = None,
**kwargs
):
"""Clone a local or remote git repository.
if target is None:
target = source.split("/")[-1]
+
+ if isinstance(branch, str):
+ branch = branch.encode(DEFAULT_ENCODING)
mkdir = not os.path.exists(target)
return fetch_result
-def ls_remote(remote, config=None, **kwargs):
+def ls_remote(remote, config: Optional[Config] = None, **kwargs):
"""List the refs in a remote.
Args: