Skip to content

Commit f94550b

Browse files
Merge pull request #126 from felipealfonsog/development
Updates
2 parents 980f163 + 32efb14 commit f94550b

File tree

1 file changed

+15
-54
lines changed

1 file changed

+15
-54
lines changed

src/src-std/gitsync.py

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ def print_credits():
4040
print("-" * 50)
4141
print("_" * 50)
4242

43-
44-
def check_repositories(base_path, exclude_suffix="-aur"):
43+
def check_repositories(base_path):
4544
for root, dirs, _ in os.walk(base_path):
46-
dirs[:] = [d for d in dirs if not d.endswith(exclude_suffix)]
4745
for d in dirs:
4846
repo_path = os.path.join(root, d)
4947
if os.path.isdir(os.path.join(repo_path, ".git")):
@@ -86,9 +84,6 @@ def update_repositories(base_path):
8684
else:
8785
print(f"Failed to update repository. Error: {process.stderr}\n")
8886

89-
90-
91-
9287
def find_and_create_pr(base_path):
9388
pr_created = False # Flag to track if a PR was created
9489
pr_number = None # Store the PR number to merge it later
@@ -214,65 +209,31 @@ def find_and_create_pr(base_path):
214209
break # Exit after the first failed attempt
215210
except subprocess.CalledProcessError as e:
216211
print(f"Error while creating pull request in {repo_path}: {e}")
217-
break # Exit after the first failed attempt
218-
else:
219-
print(f"No new commits detected for {repo_path} between {current_branch} and origin/{default_branch}. Skipping PR creation.")
220-
221-
# Handle repos that require a commit before PR
222-
if not diff_result.stdout.strip():
223-
repos_missing_commits.append(repo_path)
224-
225-
# Output missing commit repositories
226-
if repos_missing_commits:
227-
print("\nThe following repositories require commits before creating a PR:")
228-
for repo in repos_missing_commits:
229-
print(f"- {repo}")
230-
231-
if not pr_created:
232-
print("\nNo pull requests were created. Check the repository status for possible issues.")
233-
else:
234-
print("\nPull request was created and attempted to merge successfully.")
235-
236-
237-
212+
continue
238213

239214
def main():
240215
print_header()
241-
base_path = os.getcwd()
242-
216+
print("Welcome to the GitSync tool!\n")
217+
218+
base_path = input("Enter the base path to check repositories: ")
219+
243220
while True:
244-
print("\nOptions:")
245-
print("1. Check repositories and push changes")
246-
print("2. Update repositories")
247-
print("3. Find and create pull requests")
248-
print("4. Show credits")
249-
print("5. Exit")
250-
251-
option = input("Enter option number (default is 2): ").strip() or "2"
221+
print("\nChoose an option:")
222+
print("1. Check repositories for changes")
223+
print("2. Update all repositories")
224+
print("3. Find repositories and create PR")
225+
print("4. Exit")
226+
227+
option = input("Enter your choice: ").strip()
252228

253229
if option == "1":
254-
exclude_dirs = input("Do you want to exclude directories with the '-aur' suffix? (Press Enter for Yes, N for No, default is Yes): ").strip().lower()
255-
if exclude_dirs != "n":
256-
check_repositories(base_path)
257-
else:
258-
check_repositories(base_path, exclude_suffix="")
259-
230+
check_repositories(base_path)
260231
elif option == "2":
261232
update_repositories(base_path)
262-
263233
elif option == "3":
264234
find_and_create_pr(base_path)
265-
266235
elif option == "4":
267-
print_credits()
268-
269-
elif option == "5":
270-
print("Exiting program. Goodbye!")
236+
print("Goodbye!")
271237
break
272-
273238
else:
274239
print("Invalid option. Please try again.")
275-
276-
if __name__ == "__main__":
277-
main()
278-

0 commit comments

Comments
 (0)