Skip to content

Commit 7458040

Browse files
committed
init
1 parent 3e8bf1d commit 7458040

18 files changed

+2263
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
out
3+
/!out/.notempty

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "deps/gitinspector"]
2+
path = deps/gitinspector
3+
url = https://github.com/hbt/gitinspector
4+
[submodule "deps/git_stats"]
5+
path = deps/git_stats
6+
url = https://github.com/hbt/git_stats

Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM ubuntu:16.04
2+
3+
#// TODO(hbt) ENHANCE optimize
4+
5+
RUN apt-get update && apt-get install -y git
6+
RUN apt-get update && apt-get install -y python python-pip
7+
8+
RUN mkdir /deps && cd /deps && \
9+
git clone https://github.com/frost-nzcr4/find_forks
10+
11+
RUN cd /deps/find_forks && pip install -r requirements-prod.txt
12+
13+
#// TODO(hbt) NEXT testing rm
14+
RUN mkdir /tests && cd /tests && git clone https://github.com/hbt/mouseless
15+
16+
RUN apt-get install -y curl gawk autoconf automake bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline6-dev libssl-dev
17+
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.3
18+
19+
RUN cd /deps && git clone https://github.com/hbt/github-backup
20+
21+
#// TODO(hbt) NEXT optimize
22+
23+
RUN /bin/bash -l -c "rvm use 2.1.3"
24+
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
25+
RUN /bin/bash -l -c "cd /deps/github-backup && bundle"
26+
#RUN /bin/bash -l -c "ruby /deps/github-backup/bin/github-backup -u frost-nzcr4 -r find_forks -o /deps -f "
27+
#https://github.com/frost-nzcr4/find_forks
28+
29+
30+
#RUN cd /deps && git clone https://github.com/hbt/github-backup
31+
#RUN cd /deps/github-backup && bundle
32+
33+
RUN apt-get install -y php
34+
35+
RUN cd / && git clone https://github.com/hbt/gitinspector
36+
37+
RUN apt-get install -y locales
38+
39+
40+
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
41+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
42+
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
43+
locale-gen en_US.UTF-8
44+
45+
ENV LANG en_US.UTF-8
46+
ENV LANGUAGE en_US:en
47+
ENV LC_ALL en_US.UTF-8
48+
49+
RUN cd /deps && git clone https://github.com/hbt/git_stats
50+
RUN /bin/bash -l -c "rvm use 2.1.3 && cd /deps/git_stats && bundle"
51+
52+
ENV PATH="/git-forks-analysis/bin:${PATH}"
53+
ADD . /git-forks-analysis
54+
ADD ./config/php.ini /etc/php/7.0/cli/php.ini
55+
56+
57+
#// TODO(hbt) NEXT testing rm
58+
#RUN find-forks-recursively -u frost-nzcr4 -r find_forks -o /deps -f
59+
#RUN cd /tests/mouseless && find-forks
60+

README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,72 @@
11
# git-forks-analysis
2-
Analyze forks network to find hidden gems
2+
3+
Analyze forks network to find interesting forks, commits, file changes.
4+
5+
6+
## Why build it?
7+
8+
* Frustration with navigation forks graph / network on GitHub
9+
* Too many forks with nothing interesting and noisy commits
10+
* Wanting to find changes made to a file, function or a set of lines across the network to avoid duplicating the work (fixing similar bugs or building similar features)
11+
12+
## How does it work?
13+
14+
* Gets all forks and all branches into a single repository
15+
* Make available git data mining tools such as `gitinspector` and `git_stats`. Use the tools in this repository as they have been modified to work across all branches
16+
* View other `Tips` below on how to search across the forks network using Git commands
17+
18+
19+
[//]: # (// TODO(hbt) ENHANCE simplify Config)
20+
21+
22+
// TODO(hbt) NEXT add instructions
23+
24+
## How to install it?
25+
26+
// TODO(hbt) NEXT add submodules init -- test from scratch
27+
```bash
28+
29+
git clone https://github.com/hbt/git-forks-analysis
30+
docker-compose pull hbtlabs/git-forks-analysis
31+
32+
```
33+
34+
## How to use it?
35+
36+
// TODO(hbt) ENHANCE check code highlight
37+
38+
To generate HTML visualization of forks
39+
40+
```
41+
42+
cd bin
43+
44+
./analyze-forks username repository
45+
46+
# retrieve all direct forks for https://github.com/hbt/mouseless
47+
./analyze-forks hbt mouseless
48+
49+
# retrieve all forks recursively (the whole network) https://github.com/frost-nzcr4/find_forks -- purposefully chose a small repo to avoid running this by mistake
50+
./analyze-forks-deep frost-nzcr4 find_forks
51+
52+
```
53+
54+
view generated html files in `out` directory for:
55+
56+
- gitinspector in /out/repo.html e.g /out/mouseless.html
57+
- quick_stats in /out/repo/quick_stats/index.html e.g /opt/mouseless/quick_stats/index.html
58+
59+
60+
Calling the `gitinspector` directly via CLI
61+
62+
```bash
63+
64+
./bin/gitinspector /out/mouseless
65+
./bin/gitinspector --grading=true /out/mouseless
66+
./bin/gitinspector --grading=true --format=html /out/mouseless
67+
68+
```
69+
70+
71+
72+

bin/analyze-forks

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/scripts/analyze-forks.php" git-forks-analysis "$@"
4+

bin/analyze-forks-deep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/scripts/analyze-forks-deep.php" git-forks-analysis "$@"
4+

bin/find-forks

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
if [ ! -f /.dockerenv ]; then
4+
echo "Skipping. Not in docker container";
5+
fi
6+
7+
python /deps/find_forks

bin/find-forks-recursively

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [ ! -f /.dockerenv ]; then
4+
echo "Skipping. Not in docker container";
5+
fi
6+
7+
rm -rf /root/.ssh
8+
cp -R /root/.ssh2 /root/.ssh
9+
chmod 600 /root/.ssh/config
10+
chown -R root:root /root/.ssh
11+
12+
params=$@
13+
bash -l -c "rvm use 2.1.3 && ruby --version && ruby /deps/github-backup/bin/github-backup $params"

bin/gitinspector

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker-compose -f $(dirname $0)/../docker-compose.yml run --rm --workdir /out --entrypoint "/git-forks-analysis-src/deps/gitinspector/gitinspector.py" git-forks-analysis "$@"
4+

0 commit comments

Comments
 (0)