如何将 --force-with-lease 与 (GitPython) git.remote.Remote 一起使用?
How to use --force-with-lease with (GitPython) git.remote.Remote?
我正在努力成为 Pythonic。因此,我有这个代码:
import git
import uuid
repo = git.Repo(...)
u = repo.create_remote(uuid.uuid4(), 'https://github.com/...')
如果我不是想要成为 pythonic,我可以这样做:
repo.git.push(u.name, refspec, '--force-with-lease')
...但我 是 试图成为 Pythonic。如何使用此 (git.remote.Remote
) 对象进行 --force-with-lease
推送?
u.push(refspec, help=needed)
看来我可以说:
u.push(refspec, force=True)
...但我不认为它使用租约?
快速查看GitPython的源代码后,我猜测它在解释**kwargs
时将_
变成了-
。我觉得正确的做法应该是:
u.push(refspec, force_with_lease=True)
基于:function dashify()
, which is called from function transform_kwarg()
.
我正在努力成为 Pythonic。因此,我有这个代码:
import git
import uuid
repo = git.Repo(...)
u = repo.create_remote(uuid.uuid4(), 'https://github.com/...')
如果我不是想要成为 pythonic,我可以这样做:
repo.git.push(u.name, refspec, '--force-with-lease')
...但我 是 试图成为 Pythonic。如何使用此 (git.remote.Remote
) 对象进行 --force-with-lease
推送?
u.push(refspec, help=needed)
看来我可以说:
u.push(refspec, force=True)
...但我不认为它使用租约?
快速查看GitPython的源代码后,我猜测它在解释**kwargs
时将_
变成了-
。我觉得正确的做法应该是:
u.push(refspec, force_with_lease=True)
基于:function dashify()
, which is called from function transform_kwarg()
.