Peter Simpson

Expert
Licensed User
Longtime User
I'm thinking about putting code on Github and using this library and my Quarts library (via a nice looking GUI and an icon in the notification area) to do everything for me synchronisation wise (which could be a bad idea). I'm not sure how many B4X developers use/upload their code to Github, but if there's a good few, and if they are interested, I might release this library.

I have a couple of issues that I still need to resolve, but so far so good. Whenever I get the chance to do so, I'll continue working on this library, but paid work comes first.

SS_JGit

Author:
Peter Simpson
Version: 1.0
  • JGit
    • Events:
      • Complete (Action As String, Success As Boolean, Info As Map)
      • Error (Action As String, Message As String)
      • Progress (Action As String, Percent As Int)
    • Functions:
      • AddAll
        Adds all new and changed files to the staging area.
      • CloneRepo (remoteUrl As String, localFolder As String, username As String, password As String)
        Clones a remote repository to a local folder asynchronously.
        remoteUrl is the URL of the remote repository.
        localFolder is the local path where the repository will be cloned.
        username is the authentication username.
        password is the authentication password.
      • Commit (message As String) As Boolean
        Commits staged changes to the local repository.
        message is the commit message describing the changes.
      • CreateRemoteRepository (name As String, description As String, isPrivate As Boolean, topics As List, token As String)
        Creates a new repository on GitHub with optional topics.
        name is the name of the new repository.
        description is a short description for the repo.
        isPrivate is set to true for a private repository.
        topics is a list of strings to be used as GitHub topics.
        token is your Personal Access Token (requires 'repo' scope).
      • CreateTag (tagName As String) As Boolean
        Creates a local tag on the current HEAD.
        tagName is the name of the tag (e.g. v1.0).
      • DeleteRemoteRepository (owner As String, repoName As String, token As String)
        Permanently deletes a repository from GitHub.
        This method automatically cleans display tags (e.g. " (Public)") from the repoName.
        owner is the owner of the repo.
        repoName is the name of the repo (can include display tags).
        token is your Personal Access Token (requires 'delete_repo' scope).
      • GetBlame (filePath As String) As List
        Performs a Blame (Annotate) on a file.
        Returns a List of Strings where each index corresponds to a line,
        providing the commit ID and author of that line.
      • GetCurrentBranch As String
        Returns the name of the currently active branch.
      • GetDiff (oldCommitId As String, newCommitId As String) As String
        Generates a diff between two commit IDs (or HEAD and a commit).
        Returns the diff as a String in standard unified format.
      • GetHeadCommit As String
        Returns the object ID of the current HEAD commit.
      • GetRemoteTopics (owner As String, repoName As String, token As String)
        Retrieves the list of topics for a GitHub repository.
        owner is GitHub username or organisation.
        repoName is repository name.
        token is personal Access Token (requires 'repo' scope for private repos).
        Raises raises GetTopics_complete with Info containing "Topics" as a List.
      • GetStatus As Map
        Returns a Map containing the current status of the repository.
        No event is raised by default to prevent event overwriting.
      • GetStatusEx (raiseEvent As Boolean) As Map
        Returns a Map containing the current status of the repository.
        If raiseEvent is true, it will raise a Complete event with action "GetStatus".
      • HasConflicts As Boolean
        Checks if the repository is currently in a conflicting state.
      • Initialize (EventName As String)
        Initialises the JGit engine.
        EventName is the event name prefix for callbacks.
      • InitRepo (folder As String) As Boolean
        Initialises a new Git repository in the specified folder.
        folder is the path where the repository will be created.
      • IsRepo (folder As String) As Boolean
        Checks if the specified folder contains a Git repository.
        folder is the path to check.
      • ListRepositories (username As String, token As String) As List
        Retrieves a list of repositories for a specific GitHub user.
        Returns a list containing Maps.
        username is the GitHub account name to query.
        token is your Personal Access Token (required for private repos).
      • OpenRepo (folder As String) As Boolean
        Opens an existing Git repository from the specified folder.
        folder is the path to the existing repository.
      • Pull (username As String, password As String) As Boolean
        Pulls changes from the remote repository.
        username is the authentication username.
        password is the authentication password.
      • Push (username As String, password As String) As Boolean
        Pushes local changes to the remote repository.
        This version also pushes tags to the remote.
        username is the authentication username.
        password is the authentication password (Personal Access Token for GitHub).
      • ResolveConflict (filePath As String)
        Manually marks a file as resolved after a merge conflict.
      • SetRemoteTopics (owner As String, repoName As String, topics As List, token As String)
        Replaces the topics (tags) for a GitHub repository.
        owner is the GitHub username or organization name.
        repoName is the name of the repository.
        topics is a list of strings to be applied as topics (this replaces existing topics).
        token is your Personal Access Token (requires 'repo' scope).
      • SetRemoteUrl (url As String)
        Configures the remote URL (origin) for the current repository.
        url is the GitHub clone URL.
I don't know...
 

tchart

Well-Known Member
Licensed User
Longtime User
You can also use my b4x_cba tool to push code to GitHub using a macro button or ide link - it’s written in C#. I do also have a wrapper for the GitHub library somewhere.
 

Peter Simpson

Expert
Licensed User
Longtime User
I've got the GitHub Desktop exe et al, but I want to create something from scratch, and so here is the beginning of that idea that is working great.

I have some more functions in mind to add, but I do not really need them, no probably not. I'll use SQLite for storing any necessary data, it will be fun.

When will I create this app using B4J. I do not know, as I currently have multiple paid client projects to complete first.

I try to create as many of my own tools using B4X as possible, within reason. This tool will be a really quick and simple to create, especially as I now have this library to do all the heavy lifting for me...
 
Last edited:

aeric

Expert
Licensed User
Longtime User
I think different users have different habit using git.
I don't immediately commit to the repo after I made changes.
After many failures of test, I only make commit with the version I happy with and want to keep.
Before I commit, I need to compare what the changes because I don't remember what are they.
Then I write a summary of what have changed for the description.
Without the feature for code comparison with red and green lines, it is not helpful for me to write the description and make commit.
 
Top