suite-py 1.43.3__py3-none-any.whl → 1.44.0__py3-none-any.whl
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.
- suite_py/__version__.py +1 -1
- suite_py/cli.py +7 -2
- suite_py/commands/create_branch.py +7 -6
- suite_py/lib/handler/git_handler.py +13 -5
- suite_py/lib/logger.py +1 -1
- {suite_py-1.43.3.dist-info → suite_py-1.44.0.dist-info}/METADATA +2 -2
- {suite_py-1.43.3.dist-info → suite_py-1.44.0.dist-info}/RECORD +9 -9
- {suite_py-1.43.3.dist-info → suite_py-1.44.0.dist-info}/WHEEL +0 -0
- {suite_py-1.43.3.dist-info → suite_py-1.44.0.dist-info}/entry_points.txt +0 -0
suite_py/__version__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.44.0"
|
suite_py/cli.py
CHANGED
|
@@ -228,12 +228,17 @@ def bump(obj: Context, project: Optional[str] = None, version: Optional[str] = N
|
|
|
228
228
|
"create-branch", help="Create local branch and set the YouTrack card in progress"
|
|
229
229
|
)
|
|
230
230
|
@click.option("--card", type=click.STRING, help="YouTrack card number (ex. PRIMA-123)")
|
|
231
|
+
@click.option(
|
|
232
|
+
"--autostash",
|
|
233
|
+
is_flag=True,
|
|
234
|
+
help="Stash uncommitted changes before creating the branch and reapply them afterward",
|
|
235
|
+
)
|
|
231
236
|
@click.pass_obj
|
|
232
237
|
@catch_exceptions
|
|
233
|
-
def cli_create_branch(obj, card):
|
|
238
|
+
def cli_create_branch(obj, card, autostash):
|
|
234
239
|
from suite_py.commands.create_branch import CreateBranch
|
|
235
240
|
|
|
236
|
-
obj.call(CreateBranch, card=card).run()
|
|
241
|
+
obj.call(CreateBranch, card=card, autostash=autostash).run()
|
|
237
242
|
|
|
238
243
|
|
|
239
244
|
@main.command("lock", help="Lock project on staging or prod")
|
|
@@ -11,16 +11,17 @@ from suite_py.lib.handler.youtrack_handler import YoutrackHandler
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class CreateBranch:
|
|
14
|
-
def __init__(self, project, card, config, tokens):
|
|
14
|
+
def __init__(self, project, card, config, tokens, autostash=False):
|
|
15
15
|
self._project = project
|
|
16
16
|
self._card = card
|
|
17
17
|
self._config = config
|
|
18
18
|
self._youtrack = YoutrackHandler(config, tokens)
|
|
19
19
|
self._git = GitHandler(project, config)
|
|
20
|
+
self._autostash = autostash
|
|
20
21
|
|
|
21
22
|
@metrics.command("create-branch")
|
|
22
23
|
def run(self):
|
|
23
|
-
if not self._git.is_detached() and self._git.is_dirty():
|
|
24
|
+
if not self._git.is_detached() and self._git.is_dirty() and not self._autostash:
|
|
24
25
|
# Default behaviour is to pull when not detached.
|
|
25
26
|
# Can't do that with uncommitted changes.
|
|
26
27
|
logger.error("You have some uncommitted changes, I can't continue")
|
|
@@ -37,7 +38,7 @@ class CreateBranch:
|
|
|
37
38
|
)
|
|
38
39
|
sys.exit(-1)
|
|
39
40
|
|
|
40
|
-
self._checkout_branch(issue)
|
|
41
|
+
self._checkout_branch(issue, self._autostash)
|
|
41
42
|
|
|
42
43
|
user = self._youtrack.get_current_user()
|
|
43
44
|
self._youtrack.assign_to(issue["id"], user["login"])
|
|
@@ -94,7 +95,7 @@ class CreateBranch:
|
|
|
94
95
|
)
|
|
95
96
|
return []
|
|
96
97
|
|
|
97
|
-
def _checkout_branch(self, issue):
|
|
98
|
+
def _checkout_branch(self, issue, autostash=False):
|
|
98
99
|
default_parent_branch_name = self._config.user.get(
|
|
99
100
|
"default_parent_branch", self._git.current_branch_name()
|
|
100
101
|
)
|
|
@@ -118,9 +119,9 @@ class CreateBranch:
|
|
|
118
119
|
|
|
119
120
|
logger.error(f"Invalid branch name: {full_branch_name}. Try again?")
|
|
120
121
|
|
|
121
|
-
self._git.checkout(parent_branch_name)
|
|
122
|
+
self._git.checkout(parent_branch_name, autostash=autostash)
|
|
122
123
|
|
|
123
|
-
self._git.checkout(full_branch_name, new=True)
|
|
124
|
+
self._git.checkout(full_branch_name, new=True, autostash=autostash)
|
|
124
125
|
|
|
125
126
|
|
|
126
127
|
# Normalize a string into a valid segment(ie. the part of the branch name between the /)
|
|
@@ -32,7 +32,7 @@ class GitHandler:
|
|
|
32
32
|
check=True,
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
def checkout(self, branch, new=False):
|
|
35
|
+
def checkout(self, branch, new=False, autostash=False):
|
|
36
36
|
try:
|
|
37
37
|
if new:
|
|
38
38
|
subprocess.run(
|
|
@@ -51,7 +51,7 @@ class GitHandler:
|
|
|
51
51
|
stderr=subprocess.DEVNULL,
|
|
52
52
|
)
|
|
53
53
|
if not self.is_detached(): # Skip pulling if detached
|
|
54
|
-
self.pull(rebase=True)
|
|
54
|
+
self.pull(rebase=True, autostash=autostash)
|
|
55
55
|
except CalledProcessError as e:
|
|
56
56
|
logger.error(f"Error during command execution: {e}")
|
|
57
57
|
sys.exit(-1)
|
|
@@ -99,12 +99,16 @@ class GitHandler:
|
|
|
99
99
|
logger.error(f"Error during command execution: {e}")
|
|
100
100
|
sys.exit(-1)
|
|
101
101
|
|
|
102
|
-
def pull(self, rebase=False):
|
|
102
|
+
def pull(self, rebase=False, autostash=False):
|
|
103
103
|
with Halo(text=f"Pulling {self._repo}...", spinner="dots", color="magenta"):
|
|
104
104
|
try:
|
|
105
105
|
if rebase:
|
|
106
106
|
subprocess.run(
|
|
107
|
-
|
|
107
|
+
(
|
|
108
|
+
["git", "pull", "--rebase", "--autostash"]
|
|
109
|
+
if autostash
|
|
110
|
+
else ["git", "pull", "--rebase"]
|
|
111
|
+
),
|
|
108
112
|
cwd=self._path,
|
|
109
113
|
check=True,
|
|
110
114
|
stdout=subprocess.DEVNULL,
|
|
@@ -112,7 +116,11 @@ class GitHandler:
|
|
|
112
116
|
)
|
|
113
117
|
else:
|
|
114
118
|
subprocess.run(
|
|
115
|
-
|
|
119
|
+
(
|
|
120
|
+
["git", "pull", "--autostash"]
|
|
121
|
+
if autostash
|
|
122
|
+
else ["git", "pull"]
|
|
123
|
+
),
|
|
116
124
|
cwd=self._path,
|
|
117
125
|
check=True,
|
|
118
126
|
stdout=subprocess.DEVNULL,
|
suite_py/lib/logger.py
CHANGED
|
@@ -17,7 +17,7 @@ def setup(verbose):
|
|
|
17
17
|
level=level,
|
|
18
18
|
format=LOG_FORMAT,
|
|
19
19
|
datefmt="[%X]",
|
|
20
|
-
handlers=[RichHandler(rich_tracebacks=True, markup=False)],
|
|
20
|
+
handlers=[RichHandler(rich_tracebacks=True, markup=False, show_path=False)],
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
logger = logging.getLogger(LOGGER_NAME)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: suite-py
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.44.0
|
|
4
4
|
Summary:
|
|
5
5
|
Author: larrywax, EugenioLaghi, michelangelomo
|
|
6
6
|
Author-email: devops@prima.it
|
|
@@ -28,7 +28,7 @@ Requires-Dist: pytest (>=7.0.0)
|
|
|
28
28
|
Requires-Dist: python-dateutil (>=2.8.2)
|
|
29
29
|
Requires-Dist: requests (>=2.26.0)
|
|
30
30
|
Requires-Dist: requests-toolbelt (>=0.9.1)
|
|
31
|
-
Requires-Dist: rich (==
|
|
31
|
+
Requires-Dist: rich (==14.0.0)
|
|
32
32
|
Requires-Dist: semver (>=3.0.4,<4.0.0)
|
|
33
33
|
Requires-Dist: termcolor (>=1.1.0)
|
|
34
34
|
Requires-Dist: truststore (>=0.7,<0.11) ; python_version >= "3.10"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
suite_py/__init__.py,sha256=REmi3D0X2G1ZWnYpKs8Ffm3NIj-Hw6dMuvz2b9NW344,142
|
|
2
|
-
suite_py/__version__.py,sha256=
|
|
3
|
-
suite_py/cli.py,sha256=
|
|
2
|
+
suite_py/__version__.py,sha256=fiCLjqBGflgPWZM_qDeXGcyyghbv6o7PQ0Ka8nfg4Ko,49
|
|
3
|
+
suite_py/cli.py,sha256=Oo5YJFGXS2xJ7bLhDebqG4-hUdc6kqnO_kpXyNtIE8U,10448
|
|
4
4
|
suite_py/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
suite_py/commands/ask_review.py,sha256=yN__Ac-fiZBPShjRDhyCCQZGfVlQE16KozoJk4UtiNw,3788
|
|
6
6
|
suite_py/commands/bump.py,sha256=oFZU1hPfD11ujFC5G7wFyQOf2alY3xp2SO1h1ldjf3s,5406
|
|
7
7
|
suite_py/commands/check.py,sha256=jCX59g6DgTA55yD_75mgcqJ5zCjRwl_eIRGDeUFjUWY,3316
|
|
8
8
|
suite_py/commands/common.py,sha256=aWCEvO3hqdheuMUmZcHuc9EGZPQTk7VkzkHJk283MxQ,566
|
|
9
9
|
suite_py/commands/context.py,sha256=6dssSqoABPb9gLmL3Y7W2iAGxrY_oma665X8zrSkNNQ,1079
|
|
10
|
-
suite_py/commands/create_branch.py,sha256=
|
|
10
|
+
suite_py/commands/create_branch.py,sha256=6sveTtOg_0lQl-MYizcnnyYyAunA_dXunQAxv7szllE,4577
|
|
11
11
|
suite_py/commands/login.py,sha256=A59e1HsbN7Ocv2L_2H0Eb7MZK7AzLkLb72QxBthnIqU,258
|
|
12
12
|
suite_py/commands/merge_pr.py,sha256=fXIE8mT9MjvvpqE-uVdXGBVFGhn0eQzcBxNr-N8SyAY,5171
|
|
13
13
|
suite_py/commands/open_pr.py,sha256=e6IT6f8L_HKsOEtrGHZQ2HWrFwmvIgXGNCK_TU0WE9k,7009
|
|
@@ -22,7 +22,7 @@ suite_py/lib/handler/aws_handler.py,sha256=dRvRDicikfRbuFtCLPbevaX-yC-fO4LwXFdyq
|
|
|
22
22
|
suite_py/lib/handler/captainhook_handler.py,sha256=R30_Vvh2ck7fM5fwbpm3UV_FtlQr2xnx6RJpkG1Gn14,2983
|
|
23
23
|
suite_py/lib/handler/changelog_handler.py,sha256=-ppnRl3smBA_ys8tPqXmytS4eyntlwfawC2fiXFcwlw,4818
|
|
24
24
|
suite_py/lib/handler/frequent_reviewers_handler.py,sha256=EIJX5FEMWzrxuXS9A17hu1vfxgJSOHSBX_ahCEZ2FVA,2185
|
|
25
|
-
suite_py/lib/handler/git_handler.py,sha256=
|
|
25
|
+
suite_py/lib/handler/git_handler.py,sha256=8UVttqo65CTg5LCvOBTDXb_sNxLKUrpevCGiohp42Is,13099
|
|
26
26
|
suite_py/lib/handler/github_handler.py,sha256=xnBATLOTnOLpiYE29WwUrtDr7hxusfId9a1KbfK1OyA,2952
|
|
27
27
|
suite_py/lib/handler/metrics_handler.py,sha256=-Tp62pFIiYsBkDga0nQG3lWU-gxH68wEjIIIJeU1jHk,3159
|
|
28
28
|
suite_py/lib/handler/okta_handler.py,sha256=UiRcBDmFkMFi9H7Me1QaruC8yPI5fFbnLGzOf3kfxG0,2805
|
|
@@ -30,7 +30,7 @@ suite_py/lib/handler/pre_commit_handler.py,sha256=nwqVgC-KnUjn7NVIHZ0VmDdUfp6Q1i
|
|
|
30
30
|
suite_py/lib/handler/prompt_utils.py,sha256=vgk1O7h-iYEAZv1sXtMh8xIgH1djI398rzxRIgZWZcg,2474
|
|
31
31
|
suite_py/lib/handler/version_handler.py,sha256=DXTx4yCAbFVC6CdMqPJ-LiN5YM-dT2zklG8POyKTP5A,6774
|
|
32
32
|
suite_py/lib/handler/youtrack_handler.py,sha256=eTGBBXjlN_ay1cawtnZ2IG6l78dDyKdMN1x6PxcvtA0,7499
|
|
33
|
-
suite_py/lib/logger.py,sha256=
|
|
33
|
+
suite_py/lib/logger.py,sha256=aL870R69enNL9K8mQrMFgSAVUPXXgkvaVp6xTprCBWA,1029
|
|
34
34
|
suite_py/lib/metrics.py,sha256=urTBVzIc1Ys6OHPOO32fLPPRcQU45tzM3XMJ7mUl5dc,1629
|
|
35
35
|
suite_py/lib/oauth.py,sha256=tE3MgCnYhW6ZIbkyeUohFTOUvnBsrJXfHN8XsAVQNXk,5077
|
|
36
36
|
suite_py/lib/requests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -39,7 +39,7 @@ suite_py/lib/requests/session.py,sha256=P32H3cWnCWunu91WIj2iDM5U3HzaBglg60VN_C9J
|
|
|
39
39
|
suite_py/lib/symbol.py,sha256=z3QYBuNIwD3qQ3zF-cLOomIr_-C3bO_u5UIDAHMiyTo,60
|
|
40
40
|
suite_py/lib/tokens.py,sha256=4DbsHDFLIxs40t3mRw_ZyhmejZQ0Bht7iAL8dTCTQd4,5458
|
|
41
41
|
suite_py/templates/login.html,sha256=fJLls2SB84oZTSrxTdA5q1PqfvIHcCD4fhVWfyco7Ig,861
|
|
42
|
-
suite_py-1.
|
|
43
|
-
suite_py-1.
|
|
44
|
-
suite_py-1.
|
|
45
|
-
suite_py-1.
|
|
42
|
+
suite_py-1.44.0.dist-info/METADATA,sha256=LQEYIeWjqofnR6bGCSnt6vhSRebuZ4__hAbYpPugky8,1250
|
|
43
|
+
suite_py-1.44.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
44
|
+
suite_py-1.44.0.dist-info/entry_points.txt,sha256=dVKLC-9Infy-dHJT_MkK6LcDjOgBCJ8lfPkURJhBjxE,46
|
|
45
|
+
suite_py-1.44.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|