git-commitflow 1.1.0__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/PKG-INFO +3 -2
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow/__init__.py +25 -14
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow/git_commitflow.py +12 -9
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow/readline_manager.py +19 -13
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/PKG-INFO +3 -2
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/setup.py +1 -1
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/LICENSE +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/README.md +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow/cache_file.py +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow/helpers.py +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/SOURCES.txt +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/dependency_links.txt +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/entry_points.txt +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/requires.txt +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/git_commitflow.egg-info/top_level.txt +0 -0
- {git_commitflow-1.1.0 → git_commitflow-1.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: git-commitflow
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: A git add/commit/push helper
|
|
5
5
|
Home-page: https://github.com/jamescherti/git-commitflow
|
|
6
6
|
Author: James Cherti
|
|
@@ -27,6 +27,7 @@ Dynamic: classifier
|
|
|
27
27
|
Dynamic: description
|
|
28
28
|
Dynamic: description-content-type
|
|
29
29
|
Dynamic: home-page
|
|
30
|
+
Dynamic: license-file
|
|
30
31
|
Dynamic: requires-dist
|
|
31
32
|
Dynamic: requires-python
|
|
32
33
|
Dynamic: summary
|
|
@@ -29,28 +29,29 @@ import colorama
|
|
|
29
29
|
from .git_commitflow import GitCommitFlow
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def
|
|
33
|
-
"""
|
|
34
|
-
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
|
|
35
|
-
format="%(asctime)s %(name)s: %(message)s")
|
|
36
|
-
colorama.init()
|
|
32
|
+
def flush_stdin():
|
|
33
|
+
"""Clear any pending input from the standard input buffer.
|
|
37
34
|
|
|
35
|
+
This function ensures that no stale or unintended data remains in stdin
|
|
36
|
+
before reading user input interactively. On Windows, it uses the msvcrt
|
|
37
|
+
module to discard characters from the input buffer. On POSIX-compliant
|
|
38
|
+
systems (e.g., Linux, macOS...), it uses select to check for available
|
|
39
|
+
input without blocking and either discards the data by reading or flushes
|
|
40
|
+
it using termios.tcflush if stdin is a terminal.
|
|
41
|
+
"""
|
|
38
42
|
try:
|
|
39
|
-
import platform # pylint: disable=import-outside-toplevel
|
|
40
43
|
if os.name == "nt":
|
|
41
44
|
import msvcrt # pylint: disable=import-outside-toplevel
|
|
42
45
|
|
|
43
|
-
# Check if there
|
|
46
|
+
# For Windows systems, Check if there is any pending input in the
|
|
47
|
+
# buffer Discard characters one at a time until the buffer is empty
|
|
44
48
|
while msvcrt.kbhit():
|
|
45
|
-
# Read and discard one character at a time
|
|
46
49
|
msvcrt.getch()
|
|
47
|
-
elif os.name == "posix"
|
|
48
|
-
# For Unix-like systems, check if there's any pending input in
|
|
49
|
-
# stdin without blocking
|
|
50
|
+
elif os.name == "posix":
|
|
50
51
|
import select # pylint: disable=import-outside-toplevel
|
|
51
52
|
|
|
52
|
-
#
|
|
53
|
-
#
|
|
53
|
+
# For Unix-like systems, check if there's any pending input in
|
|
54
|
+
# stdin without blocking
|
|
54
55
|
stdin, _, _ = select.select([sys.stdin], [], [], 0)
|
|
55
56
|
if stdin:
|
|
56
57
|
if sys.stdin.isatty():
|
|
@@ -61,10 +62,20 @@ def git_commitflow_cli():
|
|
|
61
62
|
tcflush(sys.stdin.fileno(), TCIFLUSH)
|
|
62
63
|
else:
|
|
63
64
|
# Read and discard input (in chunks)
|
|
64
|
-
sys.stdin.read(1024)
|
|
65
|
+
while sys.stdin.read(1024):
|
|
66
|
+
pass
|
|
65
67
|
except ImportError:
|
|
66
68
|
pass
|
|
67
69
|
|
|
70
|
+
|
|
71
|
+
def git_commitflow_cli():
|
|
72
|
+
"""The git-commitflow command-line interface."""
|
|
73
|
+
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
|
|
74
|
+
format="%(asctime)s %(name)s: %(message)s")
|
|
75
|
+
colorama.init()
|
|
76
|
+
|
|
77
|
+
flush_stdin()
|
|
78
|
+
|
|
68
79
|
try:
|
|
69
80
|
GitCommitFlow().main()
|
|
70
81
|
except subprocess.CalledProcessError as main_proc_err:
|
|
@@ -372,22 +372,25 @@ class GitCommitFlow:
|
|
|
372
372
|
|
|
373
373
|
print(f"Author: {Fore.YELLOW + git_author + Fore.RESET} ")
|
|
374
374
|
print("Branch:", Fore.YELLOW + self.branch + Fore.RESET)
|
|
375
|
-
print("Git message: ", end="")
|
|
376
375
|
|
|
377
|
-
commit_message = self.git_config_get("custom.commit-message").strip()
|
|
378
|
-
previous_message = ""
|
|
379
|
-
if commit_message:
|
|
380
|
-
|
|
381
|
-
|
|
376
|
+
# commit_message = self.git_config_get("custom.commit-message").strip()
|
|
377
|
+
# previous_message = ""
|
|
378
|
+
# if commit_message:
|
|
379
|
+
# print(Fore.YELLOW + commit_message + Fore.RESET)
|
|
380
|
+
|
|
381
|
+
if self.amount_commits > 0:
|
|
382
382
|
previous_message = \
|
|
383
383
|
"\n".join(
|
|
384
384
|
self._run("git --no-pager log -1 --pretty=%B")).rstrip()
|
|
385
|
-
print(
|
|
385
|
+
print("Previous git message: ",
|
|
386
|
+
Fore.YELLOW + previous_message + Fore.RESET)
|
|
387
|
+
self.readline_manager.append_to_history(previous_message)
|
|
386
388
|
|
|
387
|
-
commit_message = self.prompt_git_commit_message(commit_message)
|
|
389
|
+
# commit_message = self.prompt_git_commit_message(commit_message)
|
|
390
|
+
commit_message = self.prompt_git_commit_message("")
|
|
388
391
|
|
|
389
392
|
# TODO: move this to a function
|
|
390
|
-
logging.debug("[DEBUG] Previous message: %s", previous_message)
|
|
393
|
+
# logging.debug("[DEBUG] Previous message: %s", previous_message)
|
|
391
394
|
logging.debug("[DEBUG] Commit message: %s", commit_message)
|
|
392
395
|
|
|
393
396
|
return commit_message
|
|
@@ -21,18 +21,16 @@
|
|
|
21
21
|
|
|
22
22
|
import logging
|
|
23
23
|
import readline
|
|
24
|
-
import sys
|
|
25
24
|
from pathlib import Path
|
|
26
|
-
from typing import List, Optional, Set, Union
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
class ReadlineSimpleCompleter:
|
|
30
|
-
def __init__(self, options:
|
|
28
|
+
def __init__(self, options: list[str]):
|
|
31
29
|
"""Initialize with a sorted list of options."""
|
|
32
30
|
self.complete_with = sorted(options)
|
|
33
|
-
self.matches:
|
|
31
|
+
self.matches: list[str] = []
|
|
34
32
|
|
|
35
|
-
def complete(self, _, state: int)
|
|
33
|
+
def complete(self, _, state: int):
|
|
36
34
|
"""Return the next possible completion for 'text'."""
|
|
37
35
|
if state == 0:
|
|
38
36
|
orig_line = readline.get_line_buffer()
|
|
@@ -46,13 +44,13 @@ class ReadlineSimpleCompleter:
|
|
|
46
44
|
|
|
47
45
|
|
|
48
46
|
class ReadlineManager:
|
|
49
|
-
def __init__(self, history_file
|
|
47
|
+
def __init__(self, history_file=None,
|
|
50
48
|
history_length=-1):
|
|
51
49
|
"""Manage readline settings, history, and input."""
|
|
52
50
|
self.history_file = Path(history_file) if history_file else None
|
|
53
|
-
self.keywords
|
|
51
|
+
self.keywords = set()
|
|
54
52
|
self.history_length = history_length
|
|
55
|
-
self.history = []
|
|
53
|
+
# self.history = []
|
|
56
54
|
self._init_history()
|
|
57
55
|
|
|
58
56
|
def _init_history(self):
|
|
@@ -64,7 +62,7 @@ class ReadlineManager:
|
|
|
64
62
|
readline.set_history_length(self.history_length)
|
|
65
63
|
|
|
66
64
|
# History
|
|
67
|
-
|
|
65
|
+
self.read_history_file()
|
|
68
66
|
|
|
69
67
|
# Keywords
|
|
70
68
|
# if self.history_file and self.history_file.exists():
|
|
@@ -77,7 +75,8 @@ class ReadlineManager:
|
|
|
77
75
|
logging.debug("[DEBUG] History loaded")
|
|
78
76
|
|
|
79
77
|
def append_to_history(self, string):
|
|
80
|
-
self.history.append(string)
|
|
78
|
+
# self.history.append(string)
|
|
79
|
+
readline.add_history(string)
|
|
81
80
|
|
|
82
81
|
# # Truncate history
|
|
83
82
|
# if self.history_length >= 0 \
|
|
@@ -90,7 +89,12 @@ class ReadlineManager:
|
|
|
90
89
|
# with open(self.history_file, "a", encoding="utf-8") as fhandler:
|
|
91
90
|
# fhandler.write(f"{string}\n")
|
|
92
91
|
|
|
93
|
-
def
|
|
92
|
+
def read_history_file(self):
|
|
93
|
+
"""Read the current readline history to the specified file."""
|
|
94
|
+
if self.history_file:
|
|
95
|
+
readline.read_history_file(self.history_file)
|
|
96
|
+
|
|
97
|
+
def save_history_file(self):
|
|
94
98
|
"""Save the current readline history to the specified file."""
|
|
95
99
|
if self.history_file:
|
|
96
100
|
logging.debug("[DEBUG] History saved")
|
|
@@ -99,10 +103,12 @@ class ReadlineManager:
|
|
|
99
103
|
def readline_input(self, prompt: str,
|
|
100
104
|
default: str = "",
|
|
101
105
|
required: bool = False,
|
|
102
|
-
complete_with
|
|
106
|
+
complete_with=None) -> str:
|
|
103
107
|
"""
|
|
104
108
|
Prompt for input with optional readline autocompletion and command
|
|
105
109
|
history saving.
|
|
110
|
+
|
|
111
|
+
:complete_with: A list of strings to complete with.
|
|
106
112
|
"""
|
|
107
113
|
all_keywords = self.keywords | \
|
|
108
114
|
set(complete_with if complete_with else {})
|
|
@@ -128,7 +134,7 @@ class ReadlineManager:
|
|
|
128
134
|
break
|
|
129
135
|
finally:
|
|
130
136
|
if save_history and self.history_file:
|
|
131
|
-
self.
|
|
137
|
+
self.save_history_file()
|
|
132
138
|
|
|
133
139
|
return default if value == "" else value
|
|
134
140
|
finally:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: git-commitflow
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: A git add/commit/push helper
|
|
5
5
|
Home-page: https://github.com/jamescherti/git-commitflow
|
|
6
6
|
Author: James Cherti
|
|
@@ -27,6 +27,7 @@ Dynamic: classifier
|
|
|
27
27
|
Dynamic: description
|
|
28
28
|
Dynamic: description-content-type
|
|
29
29
|
Dynamic: home-page
|
|
30
|
+
Dynamic: license-file
|
|
30
31
|
Dynamic: requires-dist
|
|
31
32
|
Dynamic: requires-python
|
|
32
33
|
Dynamic: summary
|
|
@@ -23,7 +23,7 @@ from setuptools import find_packages, setup
|
|
|
23
23
|
|
|
24
24
|
setup(
|
|
25
25
|
name="git-commitflow",
|
|
26
|
-
version="1.1.
|
|
26
|
+
version="1.1.2",
|
|
27
27
|
packages=find_packages(),
|
|
28
28
|
description="A git add/commit/push helper",
|
|
29
29
|
long_description=((Path(__file__).parent.resolve().joinpath("README.md"))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|