Giter Site home page Giter Site logo

git2json's People

Contributors

asmeurer avatar ciupicri avatar mydeveloperday avatar stonebig avatar svisser avatar tarmstrong avatar tavish-stripe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

git2json's Issues

Its not possible to pass other arguments to the log

I don't always want the json log for the whole tree or for a particular date but between 2 sha1's or 2 tags

git2json --git-dir ....   V1_0_TAG...HEAD
git2json --git-dir ....   V1_0_TAG...V1_1_TAG

or sometimes you might just want to log 1 specific directory

git2json --git-dir ....    src/bin/gtest
git2json --git-dir ....    .

Could this be added? maybe

git2json  --revisions=V1_0_TAG...HEAD
git2json  --srcdir=.

I realize you needing to control the arguments to git log, but perhaps allow passing additional arguments

git2json --args="V1_0_TAG...HEAD ."

Since not working?

git2json --since 2018-01-01
usage: git2json [-h] [--git-dir GIT_DIR]
git2json: error: unrecognized arguments: --since 2018-01-01

Also other date formats and "this year" (which git log supports) don't work. -h also doesn't mention since. Installed today via pip, maybe that version is outdated?

git2json crashes in rare case parse_message_line returns None

OS - Linux crunchbang 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux
Python - 2.7.2

I went to take git2json for a spin on a repository with a long commit log to see how it would work.

I chose the Rails repository, which contains the following commit:

commit e04818d1b8de44d47003031791f142182320ed89
tree 3f56c6c53f914a2ed882e32a8a3438be619f8f17
parent 6cbec586731b7c5f293f2a7b6c7330c7181acdfe
author Jeremy Kemper <[email protected]> 1348081584 -0700
committer Jeremy Kemper <[email protected]> 1348081584 -0700

    Revert "Make sure :environment task is executed before db:schema:load or db:structure:load
"

    Breaks db:setup because it tries to load the environment before creating the database.

    This reverts commit 5ca11fefce6d83f5db399aa4412f1f1a0d42b2e6.

2   2   activerecord/lib/active_record/railties/databases.rake

I was unable to determine why, but, for some reason, there is a carriage return character between load and ".

So calling splitlines() on

'''    Revert "Make sure :environment task is executed before db:schema:load or db:structure:load
"
    Yip yip yip
''' 

we get:

['    Revert "Make sure :environment task is executed before db:schema:load or db:structure:load', '"', '    Yip yip yip']

But if you pass parse_message_line a string like '"', it will return None, and join cannot handle lists with None in them.

>>> l = ['fee', 'foo', 'fi', None] 
>>> "\n".join(l)
TypeError: sequence item 3: expected string, NoneType found

TypeError: sequence item 1: expected str instance, NoneType found

$ git clone https://github.com/fabioparra/TypeScript.git; cd TypeScript
$ git checkout bc691ef78ec
$ ipython3
from git2json.parser import parse_commits
from git2json import run_git_log
list(parse_commits(run_git_log('.git')))

TypeError                                 Traceback (most recent call last)
<ipython-input-4-a4fe5c202781> in <module>()
----> 1 list(parse_commits(run_git_log('.git')))

~/.virtualenvs/bayesian/lib/python3.6/site-packages/git2json/parser.py in parse_commits(data)
     47         full_commit = rc.groups()[0]
     48         parts = RE_COMMIT.match(full_commit).groupdict()
---> 49         parsed_commit = parse_commit(parts)
     50         yield parsed_commit
     51 

~/.virtualenvs/bayesian/lib/python3.6/site-packages/git2json/parser.py in parse_commit(parts)
     71         parse_message_line(msgline)
     72         for msgline in
---> 73         parts['message'].splitlines()
     74     )
     75     commit['changes'] = [

TypeError: sequence item 1: expected str instance, NoneType found

Better error messages when invalid git-dir specified

If I run git2json in my home directory, this happens:

tavish@temeraire:~ $ git2json
fatal: Not a git repository (or any parent up to mount parent /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[null]

If I run it with --git-dir specified, but not to the .git folder, I get this:

tavish@temeraire:~ $ git2json --git-dir=code/git2json
fatal: Not a git repository: 'code/git2json'
[null]

These should 1) print a good error message 2) have a non-zero exit status 3) not output anything to stdout.

Originally reported in #2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.