gitpush-tool 0.3.1__tar.gz → 0.3.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.
- {gitpush_tool-0.3.1/gitpush_tool.egg-info → gitpush_tool-0.3.2}/PKG-INFO +1 -1
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/README.md +1 -1
- gitpush_tool-0.3.2/gitpush/__init__.py +1 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush/cli.py +21 -1
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2/gitpush_tool.egg-info}/PKG-INFO +1 -1
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/setup.py +1 -1
- gitpush_tool-0.3.1/gitpush/__init__.py +0 -1
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/LICENSE +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/MANIFEST.in +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush/__doc__.py +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush_tool.egg-info/SOURCES.txt +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush_tool.egg-info/dependency_links.txt +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush_tool.egg-info/entry_points.txt +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/gitpush_tool.egg-info/top_level.txt +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/pyproject.toml +0 -0
- {gitpush_tool-0.3.1 → gitpush_tool-0.3.2}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2"
|
|
@@ -317,6 +317,22 @@ def gh_authenticated():
|
|
|
317
317
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
318
318
|
return False
|
|
319
319
|
|
|
320
|
+
|
|
321
|
+
def is_local_ahead() -> bool:
|
|
322
|
+
try:
|
|
323
|
+
result = subprocess.run(
|
|
324
|
+
["git", "rev-list", "--left-right", "--count", "origin/main...HEAD"],
|
|
325
|
+
capture_output=True, text=True, check=True
|
|
326
|
+
)
|
|
327
|
+
behind_ahead = result.stdout.strip().split()
|
|
328
|
+
if len(behind_ahead) == 2:
|
|
329
|
+
behind, ahead = map(int, behind_ahead)
|
|
330
|
+
return ahead > 0
|
|
331
|
+
return False
|
|
332
|
+
except subprocess.CalledProcessError:
|
|
333
|
+
return False
|
|
334
|
+
|
|
335
|
+
|
|
320
336
|
def authenticate_with_gh():
|
|
321
337
|
"""Authenticate user with GitHub CLI"""
|
|
322
338
|
print("\n🔑 GitHub authentication required.")
|
|
@@ -437,7 +453,11 @@ def standard_git_push(commit_message, branch, remote, force=False, tags=False):
|
|
|
437
453
|
else:
|
|
438
454
|
print("ℹ️ No commit message provided. Pushing only staged changes.")
|
|
439
455
|
|
|
440
|
-
|
|
456
|
+
if is_local_ahead():
|
|
457
|
+
push_cmd = ["git", "push"]
|
|
458
|
+
else:
|
|
459
|
+
push_cmd = ["git", "push", "origin", "main"]
|
|
460
|
+
|
|
441
461
|
if force:
|
|
442
462
|
push_cmd.append("--force-with-lease")
|
|
443
463
|
print("⚠️ Using safe force push (--force-with-lease).")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.1"
|
|
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
|