Metadata-Version: 1.1
Name: python-git
Version: 4.4
Summary: Automate boring git tasks
Home-page: https://github.com/chidimo/python-git
Author: Chidi Orji
Author-email: orjichidi95@gmail.com
License: MIT
Download-URL: https://github.com/chidimo/python-git/archive/master.zip
Description: # Python-Git
        
        Automate the boring git stuff with python
        
        ## Motivation
        
        Whenever I wanted to see the status of all my git repos I have to fire up the
        `git-cmd.exe` shell on windows, navigate to each folder and then do a `git status`.
        I have to do this both at home and at work.
        
        But I got quickly tired of it. So I decided to make this tool to give me a quick
        report so I can see what is ahead and what's behind and what's ahead at a glance.
        In short, what needs attention so as to avoid those troubling merge conflicts.
        
        ## Requirements
        
        Other thing you need is a computer with `git` either accessible from the command line (which means its in your system path) or as a standalone file somewhere in your system.
        If you're working without installation rights, you can use a portable `git` and `python-git` will work just fine.
        
        You can get a portable git version from [here](https://git-scm.com/download/win)
        
        Just unzip it and place it somewhere on your disk. Later (during initialization), you'll need to tell `python-git` where this file is located.
        
        ## Installation
          
              pip install python-git
        
        ## Setup
        
        1. To setup, you need to look for the location of `pygit` on your system. If you're using anaconda it would likely be in `C:\ProgramData\Anaconda3\Lib\site-packages\pygit`. then issue the command
        
        Open a terminal and run `workwith` to setup
        
        The output of `workwith --help` is shown below
        
        ```cmd
        usage: Pygit. Initialize working directories for python-git
               [-h] [-v {0,1}] [-r RULES [RULES ...]] [-g GITPATH]
               [-m MASTERDIRECTORY] [-s SIMPLEDIRECTORY [SIMPLEDIRECTORY ...]]
               [-t STATUSDIRECTORY]
        
        optional arguments:
          -h, --help            show this help message and exit
          -v {0,1}, --verbosity {0,1}
                                turn verbosity ON/OFF
          -r RULES [RULES ...], --rules RULES [RULES ...]
                                Set a list of string patterns for folders to skip
                                during setup
          -g GITPATH, --gitPath GITPATH
                                Full pathname to git executable. cmd or bash.
          -m MASTERDIRECTORY, --masterDirectory MASTERDIRECTORY
                                Full pathname to directory holding any number of git
                                repos.
          -s SIMPLEDIRECTORY [SIMPLEDIRECTORY ...], --simpleDirectory SIMPLEDIRECTORY [SIMPLEDIRECTORY ...]
                                A list of full pathnames to any number of individual
                                git repos.
          -t STATUSDIRECTORY, --statusDirectory STATUSDIRECTORY
                                Full pathname to directory for writing out status
                                message.
        ```
        
           `$ python <full_installation_path>\main.py`.
        
         <!-- For finding files in your system I recommend [everything](https://www.voidtools.com/) -->
        
        ## Usage
        
        1. Activate python environment on command line.
        
           `import pygit # should return nothing if all goes well`
        
        <!-- 1. Now you need to specify exactly two things:
        
              1. where your git repos are
              1. where your `git-cmd.exe` is located.
        
        1. The location of your `git` repositories. You may do this by passing it a list of strings on the command line. Each string represents a full path name to single directory. You may also just provide a single directory which holds multiple git repositories and `pygit` will grab all the repositories for your. If you have a master directory that holds multiple `git` repositories, `pygit` can also take the full path name of this master directory and then index the git repositories it finds there. It won't index those directories that are not git repos. It is also possible to tell `pygit` not to index certain directories by specifying the starting string of the directory name. This is referred to as a `rule`. Directories matching such rules will not be touched.
        1. The location of a `git-cmd.exe` executable. This only applies if `git` is not accessible from your system `cmd`. That is, `git` is not in your system path. More on this below. -->
        
        ## My personal setup
        
           `python "C:\ProgramData\Anaconda3\Lib\site-packages\pygit\main.py" -g "C:\Program Files\Git\git-cmd.exe" -m "D:\git"`
        
        In case things change (perhaps you moved folders around or you add a new git repo) and you want to reset your folders just redo the initialization step
        
              pygit.show_repos()
        
        show all git repos in the format shown immediately below
        
              repository_id: repository_name: repository_full_path
        
              pygit.load(repo_id_or_name) # load a repo
        
        where `repo_id` is a string-valued id assigned to that particular repo. The first value in the `show_repos` command's output.
        
        The `load(input_string)` command returns a `Commands` object for that repo, which provides a gateway for issuing git commands on the repository
        
        Operations that can be performed on `Commands` object are shown below.
        
        ```python
           r = pygit.load_repo(repo_id_or_name)
           r.fetch() # perform fetch
           r.status() # see status
           r.add_all() # stage all changes for commit
           r.commit(message='chore: minor changes') # commit changes. Press enter to accept default message
           r.push() # perform push action
           r.pull() # perform pull request
           r.add_commit() # add and commit at once
        ```
        
        ### Batch Operations
        
        The following batch operations on indexed repos are available.
        
              pygit.load_multiple(*args) # load a set of repos
              pygit.load_multiple("2", "5") # load only repo 2 and 5
        
        returns a  `generator`  of  `Commands`  objects for repositories 2 and 5. Afterwards you can iterate over the repos like below
        
        ```python
           for each in pygit.load_multiple("2", "5"):
              each.add_commit()
        ```
        
              pygit.all_status()
        
        performs a `status` command on all indexed repos. The result is written to a markdown file.
        Carries a timestamp of the time the command was issued. Call it a snapshot of your repo status if you will. Items which are out of sync with their remote counterpart are also highlighted as needing attention.
        
              pygit.pull_all()
        
        perform a `pull` request on all indexed repos at once. It returns `None`.
        
              pygit.push_all()
        
        performs a `push` action on all indexed repos at once. It returns `None`.
        
              pygit.load_all()
        
        returns a  `generator`  of  `Commands`  object for each indexed repo.
        
        ## To do
        
        1. Refactor `initialize()` function
        1. Add `git-bash.exe`
        1. Implement `Commands.branch()`
        1. Refactor tests
        1. Auto-run test after importation to make sure every other thing works fine.
        1. Define an update function that updates the repo dictionaries for the case when a new repo is added but the overall directory structure remains unchanged.
        
        ## Update git check locations
        
        1. C:\Program Files\Git\cmd\git.exe
        1. C:\Program Files (x86)\Git\cmd\git.exe
        1. C:\Program Files\Git\cmd\git.exe
        1. C:\Users\Chidimma\AppData\Local\Programs\Git\cmd\git.exe
        
Keywords: automate boring git and github tasks
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3.6
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Utilities
