Skip to content

Commit

Permalink
Remove format-patch tag argument
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jul 16, 2024
1 parent ba72287 commit 516222e
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions upstream_utils/upstream_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,29 +485,21 @@ def rebase(self, new_tag):
file=sys.stderr,
)

def format_patch(self, tag=None):
def format_patch(self):
"""Generates patch files for the upstream repository and moves them into
the patch directory.
Keyword argument:
tag -- The tag of the commit of the upstream repository the patch
commits were applied onto. If None (the default), the root tag will be
used.
"""
self.open_repo(
err_msg_if_absent='There\'s nothing to run format-patch on. Run the "clone" and "rebase" commands first.'
)

if tag is None:
tag = self.get_root_tag()
script_tag = tag.removeprefix("upstream_utils_root-")
else:
script_tag = tag
root_tag = self.get_root_tag()
script_tag = root_tag.removeprefix("upstream_utils_root-")

start_commit = tag
start_commit = root_tag
if self.pre_patch_commits > 0:
commits_since_tag_output = subprocess.run(
["git", "log", "--format=format:%h", f"{tag}..HEAD"],
["git", "log", "--format=format:%h", f"{start_commit}..HEAD"],
capture_output=True,
).stdout
commits_since_tag = commits_since_tag_output.count(b"\n") + 1
Expand Down Expand Up @@ -593,12 +585,6 @@ def main(self, argv=sys.argv[1:]):
"format-patch",
help="Generates patch files for the upstream repository and moves them into the upstream_utils patch directory",
)
parser_format_patch.add_argument(
"new_tag",
nargs="?",
default=None,
help="The tag for the commit before the patches",
)

subparsers.add_parser(
"copy-upstream-to-thirdparty",
Expand All @@ -617,7 +603,7 @@ def main(self, argv=sys.argv[1:]):
elif args.subcommand == "rebase":
self.rebase(args.new_tag)
elif args.subcommand == "format-patch":
self.format_patch(args.new_tag)
self.format_patch()
elif args.subcommand == "copy-upstream-to-thirdparty":
self.copy_upstream_to_thirdparty()

Expand Down

0 comments on commit 516222e

Please sign in to comment.