403Webshell
Server IP : 217.160.0.141  /  Your IP : 216.73.217.7
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : p8818224 ( 2623854)
PHP Version : 8.2.35
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/usr/share/doc/python3-dulwich/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/usr/share/doc/python3-dulwich/examples/rename-branch.py
#!/usr/bin/python3
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

import argparse

from dulwich.client import get_transport_and_path_from_url
from dulwich.objects import ZERO_SHA
from dulwich.pack import pack_objects_to_data

parser = argparse.ArgumentParser()
parser.add_argument("url", type=str)
parser.add_argument("old_ref", type=str)
parser.add_argument("new_ref", type=str)
args = parser.parse_args()

client, path = get_transport_and_path_from_url(args.url)


def generate_pack_data(*args, **kwargs):
    return pack_objects_to_data([])


def update_refs(refs):
    sha = refs[args.old_ref.encode("utf-8")]
    return {args.old_ref.encode("utf-8"): ZERO_SHA, args.new_ref.encode("utf-8"): sha}


client.send_pack(path, update_refs, generate_pack_data)
print(f"Renamed {args.old_ref} to {args.new_ref}")

Youez - 2016 - github.com/yon3zu
LinuXploit