forked from gil9red/SimplePyScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappend_to_remote_repo.py
More file actions
46 lines (32 loc) · 967 Bytes
/
Copy pathappend_to_remote_repo.py
File metadata and controls
46 lines (32 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def create_random_file(repo):
import uuid
file_name = str(uuid.uuid4())
import os
full_file_name = os.path.join(repo.working_tree_dir, file_name)
with open(full_file_name, 'w') as f:
import random
import string
text = "".join(random.choice(string.ascii_letters + string.digits) for _ in range(64))
f.write(text)
return file_name, file_name
if __name__ == '__main__':
from common import get_repo, print_log
repo = get_repo()
print(repo)
print()
print_log()
print()
new_file_name = create_random_file(repo)[1]
message = 'Create: ' + new_file_name
print(message)
repo.index.add([new_file_name])
# # or:
# repo.index.add(['*'])
# repo.git.add(new_file_name)
# repo.git.add('-A')
repo.index.commit(message)
# repo.remotes.origin.pull()
repo.remotes.origin.push()