簡體   English   中英

如何將 --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 )object 進行--force-with-lease推送?

u.push(refspec, help=needed)

看來我可以說:

u.push(refspec, force=True)

...但我不認為這使用租約?

在快速瀏覽了 GitPython 的源代碼之后,我猜想它在解釋**kwargs kwargs 時會變成_ - 我認為正確的方法應該是:

u.push(refspec, force_with_lease=True)

基於: function dashify() ,從function transform_kwarg()調用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM