gitpush-tool 0.1.2__tar.gz → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A CLI tool to simplify Git push operations with intelligent defaults and options.
5
5
  Home-page: https://github.com/yourusername/gitpush_tool
6
6
  Author: Ganesh Sonawane
@@ -117,6 +117,7 @@ To push all local tags:
117
117
  gitpush_tool --tags
118
118
  ```
119
119
 
120
+ <<<<<<< HEAD
120
121
  ### Creating and Pushing to a New GitHub Repository
121
122
 
122
123
  To create a new GitHub repository and push your code in one command:
@@ -124,6 +125,8 @@ To create a new GitHub repository and push your code in one command:
124
125
  ```bash
125
126
  gitpush_tool "Initial commit" --new-repo my-new-repo --description "My awesome project"
126
127
 
128
+ =======
129
+ >>>>>>> d1625633dae3f9eec5bfc0bc8727dd2f8bd2e98c
127
130
  ### Help
128
131
 
129
132
  To view all available commands and options:
@@ -92,6 +92,7 @@ To push all local tags:
92
92
  gitpush_tool --tags
93
93
  ```
94
94
 
95
+ <<<<<<< HEAD
95
96
  ### Creating and Pushing to a New GitHub Repository
96
97
 
97
98
  To create a new GitHub repository and push your code in one command:
@@ -99,6 +100,8 @@ To create a new GitHub repository and push your code in one command:
99
100
  ```bash
100
101
  gitpush_tool "Initial commit" --new-repo my-new-repo --description "My awesome project"
101
102
 
103
+ =======
104
+ >>>>>>> d1625633dae3f9eec5bfc0bc8727dd2f8bd2e98c
102
105
  ### Help
103
106
 
104
107
  To view all available commands and options:
@@ -0,0 +1 @@
1
+ __version__ = "0.1.3"
@@ -4,6 +4,13 @@ import sys
4
4
  import requests
5
5
  from getpass import getpass
6
6
 
7
+ import os
8
+ import argparse
9
+ import sys
10
+ import requests
11
+ from getpass import getpass
12
+ import json
13
+
7
14
  def create_github_repo(repo_name, private=False, description=""):
8
15
  """Create a new GitHub repository using the GitHub API"""
9
16
  # Get GitHub token from environment or prompt
@@ -14,12 +21,17 @@ def create_github_repo(repo_name, private=False, description=""):
14
21
  with open(token_path, 'r') as f:
15
22
  token = f.read().strip()
16
23
  else:
17
- token = getpass("Enter your GitHub personal access token: ")
24
+ token = getpass("Enter your GitHub personal access token (requires repo scope): ")
18
25
 
26
+ if not token:
27
+ print("❌ GitHub token is required to create a repository")
28
+ return None
29
+
19
30
  headers = {
20
31
  "Authorization": f"token {token}",
21
32
  "Accept": "application/vnd.github.v3+json"
22
33
  }
34
+
23
35
  data = {
24
36
  "name": repo_name,
25
37
  "description": description,
@@ -33,10 +45,34 @@ def create_github_repo(repo_name, private=False, description=""):
33
45
  headers=headers,
34
46
  json=data
35
47
  )
36
- response.raise_for_status()
37
- return response.json()["html_url"]
48
+
49
+ # More detailed error handling
50
+ if response.status_code == 401:
51
+ print("❌ Authentication failed. Please check your GitHub token:")
52
+ print("- Make sure the token has the 'repo' scope")
53
+ print("- Ensure the token hasn't expired")
54
+ return None
55
+ elif response.status_code == 422:
56
+ error_data = response.json()
57
+ if 'errors' in error_data:
58
+ for error in error_data['errors']:
59
+ if error.get('field') == 'name' and 'already exists' in error.get('message', ''):
60
+ print(f"❌ Repository '{repo_name}' already exists on your account")
61
+ return None
62
+ print(f"❌ Validation error: {error_data.get('message', 'Unknown error')}")
63
+ return None
64
+ elif response.status_code != 201:
65
+ print(f"❌ Failed to create repository (HTTP {response.status_code}): {response.text}")
66
+ return None
67
+
68
+ repo_url = response.json()["html_url"]
69
+ print(f"✅ Successfully created repository: {repo_url}")
70
+ return repo_url
71
+
38
72
  except requests.exceptions.RequestException as e:
39
- print(f"❌ Failed to create repository: {e}")
73
+ print(f"❌ Failed to create repository: {str(e)}")
74
+ if "Max retries exceeded" in str(e):
75
+ print("⚠️ Network connection problem detected")
40
76
  return None
41
77
 
42
78
  def run():
@@ -101,4 +137,4 @@ def run():
101
137
  push_cmd += f" origin {args.branch}"
102
138
 
103
139
  print(f"🚀 Running: {push_cmd}")
104
- os.system(push_cmd)
140
+ os.system(push_cmd)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpush-tool
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: A CLI tool to simplify Git push operations with intelligent defaults and options.
5
5
  Home-page: https://github.com/yourusername/gitpush_tool
6
6
  Author: Ganesh Sonawane
@@ -117,6 +117,7 @@ To push all local tags:
117
117
  gitpush_tool --tags
118
118
  ```
119
119
 
120
+ <<<<<<< HEAD
120
121
  ### Creating and Pushing to a New GitHub Repository
121
122
 
122
123
  To create a new GitHub repository and push your code in one command:
@@ -124,6 +125,8 @@ To create a new GitHub repository and push your code in one command:
124
125
  ```bash
125
126
  gitpush_tool "Initial commit" --new-repo my-new-repo --description "My awesome project"
126
127
 
128
+ =======
129
+ >>>>>>> d1625633dae3f9eec5bfc0bc8727dd2f8bd2e98c
127
130
  ### Help
128
131
 
129
132
  To view all available commands and options:
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
 
4
4
  setup(
5
5
  name="gitpush-tool",
6
- version="0.1.2",
6
+ version="0.1.3",
7
7
  packages=find_packages(),
8
8
  install_requires=[],
9
9
  entry_points={
@@ -1 +0,0 @@
1
- __version__ = "0.1.2"
File without changes
File without changes
File without changes