fix: file save start_branch as a body attribute · python-gitlab/python-gitlab@1001d93

Original file line numberDiff line numberDiff line change

@@ -29,6 +29,7 @@ class ProjectFile(SaveMixin, ObjectDeleteMixin, RESTObject):

2929

file_path: str

3030

manager: ProjectFileManager

3131

content: str # since the `decode()` method uses `self.content`

32+

start_branch: str | None = None

3233
3334

def decode(self) -> bytes:

3435

"""Returns the decoded content of the file.

@@ -41,7 +42,11 @@ def decode(self) -> bytes:

4142

# NOTE(jlvillal): Signature doesn't match SaveMixin.save() so ignore

4243

# type error

4344

def save( # type: ignore[override]

44-

self, branch: str, commit_message: str, **kwargs: Any

45+

self,

46+

branch: str,

47+

commit_message: str,

48+

start_branch: str | None = None,

49+

**kwargs: Any,

4550

) -> None:

4651

"""Save the changes made to the file to the server.

4752

@@ -50,6 +55,7 @@ def save( # type: ignore[override]

5055

Args:

5156

branch: Branch in which the file will be updated

5257

commit_message: Message to send with the commit

58+

start_branch: Name of the branch to start the new branch from

5359

**kwargs: Extra options to send to the server (e.g. sudo)

5460
5561

Raises:

@@ -58,6 +64,7 @@ def save( # type: ignore[override]

5864

"""

5965

self.branch = branch

6066

self.commit_message = commit_message

67+

self.start_branch = start_branch

6168

self.file_path = utils.EncodedId(self.file_path)

6269

super().save(**kwargs)

6370