0

I am trying to be Pythonic. Thus, I have this code:

import git
import uuid

repo = git.Repo(...)
u = repo.create_remote(uuid.uuid4(), 'https://github.com/...')

If I wasn't trying to be pythonic, I could do this:

repo.git.push(u.name, refspec, '--force-with-lease')

...but I am trying to be Pythonic. How do I do a --force-with-lease push using this (git.remote.Remote) object?

u.push(refspec, help=needed)

It looks like I can say:

u.push(refspec, force=True)

...but I don't think that uses a lease?

Matthew
  • 2,593
  • 22
  • 25

1 Answers1

2

After having a quick look at the source code of GitPython, I would guess that it turns _ into - when interpreting the **kwargs. I think the correct way should be:

u.push(refspec, force_with_lease=True)

Based on: function dashify(), which is called from function transform_kwarg().

alfunx
  • 3,080
  • 1
  • 12
  • 23