Skip to content

github_repos_backup_tools v0.7.0

Choose a tag to compare

@smartlegionlab smartlegionlab released this 24 Feb 08:05
· 111 commits to master since this release
13daa1a

What's New:

GitHub Repositories Backup Tools v0.7.0

1. Enhanced Repository Cloning Mechanism

  • Problem:
    • Cloning repositories occasionally failed due to network timeouts, unstable connections, or large repository sizes. This led to incomplete or corrupted clones, requiring manual intervention.
  • Solution:
    • Implemented a robust retry mechanism for cloning and updating repositories. If a clone operation fails due to a timeout or other errors, the application automatically retries the operation after a short delay.
    • Added a fallback mechanism: if a repository cannot be cloned after multiple attempts, it is marked as failed, and the user is notified.
    • Improved the git pull functionality to ensure that existing repositories are updated correctly, even in cases of merge conflicts or network issues.

2. Error Handling and Recovery

  • Problem:
    • The application previously lacked proper error handling, which made it difficult to diagnose and recover from failures during cloning or updating.
  • Solution:
    • Added comprehensive error handling for Git operations (e.g., git clone, git pull). Errors are now logged and displayed to the user with clear messages.
    • Implemented a cleanup mechanism: if a repository or gist fails to clone or update, the application removes any partially cloned files to avoid leaving the system in an inconsistent state.
    • Added a retry loop for failed operations, ensuring that transient issues (e.g., network glitches) do not cause permanent failures.

3. Improved User Interface

  • Problem:
    • The previous user interface lacked clarity and did not provide sufficient feedback during long-running operations, making it difficult for users to understand the application's progress.
  • Solution:
    • Enhanced the console output with detailed progress updates, including the current step, the number of repositories/gists processed, and the status of each operation (e.g., "Cloning repository X/Y").
    • Added visual indicators (e.g., success/failure icons) to make it easier to identify which operations completed successfully and which failed.
    • Improved the formatting of messages and added separators (e.g., ---) to make the output more readable and structured.

4. Timeout Management

  • Problem:
    • Git operations sometimes hung indefinitely due to network issues or large repositories, causing the application to become unresponsive.
  • Solution:
    • Added configurable timeouts for Git operations (git clone, git pull). If an operation exceeds the timeout, it is automatically aborted, and the application retries or marks it as failed.

5. Code Refactoring and Maintainability

  • Problem:
    • The codebase had significant duplication and did not fully adhere to SOLID principles, making it difficult to maintain and extend.
  • Solution:
    • Refactored the code to reduce duplication and improve modularity. For example, the logic for cloning repositories and gists was consolidated into a single method with reusable components.
    • Improved adherence to SOLID principles by separating concerns (e.g., moving Git operations into a dedicated utility class) and using dependency injection for better testability.

************************************************************************************************************************************************************
------------------------------------------------------------- Github Repositories Backup Tools -------------------------------------------------------------
Getting a token from a .config.ini file...
✅ Token successfully received!
Token is valid: Yes
------------------------------------------------------------------------------------------------------------------------------------------------------------
Getting user login...
✅ Login: smartlegionlab
------------------------------------------------------------------------------------------------------------------------------------------------------------
Parsing arguments:

✅ Clone repositories: Yes
✅ Clone gists: Yes
✅ Make archive: Yes
✅ Shutdown: No
------------------------------------------------------------------------------------------------------------------------------------------------------------
Forming a path to the directory:
Path: /home/john_doe/john_doe_github_backup

------------------------------------------------------------------ Cloning repositories:  ------------------------------------------------------------------
Target directory: /home/john_doe/john_doe_github_backup/repositories
Getting repositories...
Found 10 repositories.

------------------------------------------------------------------ Cloning repositories:  ------------------------------------------------------------------

--------------------------------------
1/10: Cloning: repo1
--------------------------------------
✅ Repository cloned successfully: /home/john_doe/john_doe_github_backup/repositories/repo1
--------------------------------------
1/10: Cloning: repo2
⚠ Pull operation timed out: 
/home/john_doe/john_doe_github_backup/repositories/repo2
⚠ Pull failed. Removing and recloning: 
/home/john_doe/john_doe_github_backup/repositories/ repo2
✅ Repository cloned successfully: 
/home/john_doe/john_doe_github_backup/repositories/repo2
--------------------------------------