Giter VIP home page Giter VIP logo

gitdummy's Introduction

GitDummy v3

Ever wanted to include your private repository contributions to your contribution panel? Well now you can. This script will read from existing repositories and transcribe all of the commit messages into dummy repositories that you can then add publicly to your GitHub account. This script transfers no source code, only commit stubs and their associated dates. This script can be ran multiple times and will update the dummy repo as you go.

Step 1: Create the JSON array of your repositories (repos.json):

[
    {
        "target_repo"         : ["/home/brian/myrepo","/home/brian/myrepo-old"],
        "target_email"        : ["[email protected]","[email protected]"],
        "dummy_repo"          : "/home/brian/dummy_myrepo",
        "dummy_repo_data"     : "/home/brian/dummy_myrepo/data",
        "dummy_email"         : "[email protected]",
        "dummy_name"          : "Brian Seymour",
        "dummy_readme"        : "This public repository reflects the commits from a private repo (minus the actual code)",
        "dummy_ext"           : ".js",
        "dummy_code"          : "'use strict';",
        "hide_commits"        : false,
        "random_file_name"    : false,
        "auto_push"           : true,
        "force"               : false,
        "remote"              : "https://github.com/yourname/dummy_repo"
    },
    {
        "target_repo"         : ["/home/brian/myotherprivaterepo"],
        "target_email"        : ["[email protected]"],
        "dummy_repo"          : "/home/brian/dummy_myotherprivaterepo",
        "dummy_repo_data"     : "/home/brian/dummy_myotherprivaterepo/data",
        "dummy_email"         : "[email protected]",
        "dummy_name"          : "Brian Seymour",
        "dummy_readme"        : "This public repository reflects the commits from a private repo (minus the actual code)",
        "dummy_ext"           : "",
        "dummy_code"          : "",
        "dummy_commit_message": "Example other commit message",
        "hide_commits"        : true,
        "random_file_name"    : true,
        "auto_push"           : true,
        "force"               : true,
        "remote"              : "https://github.com/yourname/dummy_privaterepo"
    }
]
Where is your Git repo (target_repo)

Here you must provide the absolute path to the Git repo that you want to transcribe from. The directory must exist and contain a .git folder inside.

Which email address should commits be checked against (target_email)

Here you must provide the email address the script should search for in the repo being transcribed from. This makes it so only your commits will come out and into the repo being transcribed to.

Where should the dummy repo be created (dummy_repo)

Here you must provide the absolute path to the folder you want the script to transcribe to. The directory must not exist.

Where should the dummy files be created? (dummy_repo_data)

Need Files to add... and is used to help with language statistics. To use random file names just set "random_file_name" to true.

Which email address should be used in the dummy commits (dummy_email)

Here you must provide a new email address the dummy commits will be made as. This will most likely be your GitHub email address so GitHub can properly associate the commits with your account.

Which name should be used in the dummy commits (dummy_name)

Here you must provide the name the dummy commits will be made as. This really has no bearing, but, it should be your name.

What should your readme file contain? (dummy_readme)

Here you must provide the actual text to the readme file associated to that specific repo

What the file extension for the dummy files be?

Recommend using whatever primary language your private repo is...

Code Sample that reflects the language your private repo is

Needs to be a short snippet of code reflective of the language your private github repo is

Whether or not to expose the commit messages (hide_commits)

You may not want to show the commit messages in your dummy repo. If this is the case, set this to true and a simple "private commit message" commit message will be put instead. To change this message just set "dummy_commit_message" (optional).

Whether or not to run a git push origin master at the end (auto_push)

If this is set to true, you'll be prompted for your repo credentials for the push.

Whether or not to run a git push origin master --force at the end (force)

If this is set to true, you'll be prompted for your repo credentials for the push. (use this if you're re-doing a run from scratch)

Which remote repo should the dummy repo be pushed to (remote)

Here you must provide the GitHub URL that your dummy repo resides at.

Step 2: Run the script as many times as you'd like

python gitdummy.py

Change Log

Version 3.12 (April 2015)

  • Added random file name to completely hide commit data (LeonardoCardoso)
  • UTF-8 support (sepehr)

Version 3.11 (March 2015)

  • Filename truncation to abide by OS imposed 255 char limit (nicolelehrer)

Version 3.1 (February 2015)

  • Python 3 support (ebrian)
  • Custom readme content per repo (omarfouad)
  • Clean up and bug fixes (oehokie)

Version 3 (December 2014)

  • Added Language Statistics (oehokie)
  • Compatible with older versions of git cli (oehokie)
  • Arrays for email and targets instead of multiple entries (oehokie)

Version 2 (November 2014)

  • JSON based repo transcription (ebrian)
  • Removed single run limitation (ebrian)

Version 1 (October 2014)

  • Private commit messages (w2pc)
  • Single repo transcription (ebrian)

gitdummy's People

Contributors

francisco-maciel avatar itsgoofer avatar kiangkuang avatar leonardocardoso avatar martzcodes avatar nicolelehrer avatar realtux avatar scoutman57 avatar sepehr avatar truhlikfredy 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  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  avatar  avatar  avatar

gitdummy's Issues

TypeError: Type str doesn't support the buffer API

After running

python gitdummy.py

I get the following error:

since:
Traceback (most recent call last):
    File "gitdummy.py", line 102, in <module>
    log_split = log_output.split('\n')
TypeError: Type str doesn't support the buffer API

I'm running Python 3.4.2

Auto Credentials

Hi, how are you guys doing?
Is there anyway auto send credentials?
So we don't have to input the credentials every-time.

Successful push but no data

I feel sure that I've setup the json file correctly and when I run the python command there are no errors. Everything looks successful but when I look at the repositories on Github, it shows only one commit.

Here is my json:

[
    {
        "target_repo"       : ["/Users/Kyla/Sites/success-academy"],
        "target_email"      : ["hi@kyla"],
        "dummy_repo"        : "/Users/Kyla/Sites/success-academy-stats",
        "dummy_repo_data"   : "/Users/Kyla/Sites/success-academy-stats/data",
        "dummy_email"       : "hi@kyla",
        "dummy_name"        : "Kyla Medina",
        "dummy_readme"      : "Repository Statistics",
        "dummy_ext"         : ".js",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "auto_push"         : true,
        "force"             : false,
        "remote"            : "https://github.com/kylamedina/success-academy-stats"
    },
    {
        "target_repo"       : ["/Users/Kyla/Sites/projectfolder"],
        "target_email"      : ["hi@kyla"],
        "dummy_repo"        : "/Users/Kyla/Sites/wooftale-mobile-stats",
        "dummy_repo_data"   : "/Users/Kyla/Sites/wooftale-mobile-stats/data",
        "dummy_email"       : "hi@kyla",
        "dummy_name"        : "Kyla Medina",
        "dummy_readme"      : "Repository Statistics",
        "dummy_ext"         : ".js",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "auto_push"         : true,
        "force"             : false,
        "remote"            : "https://github.com/kylamedina/wooftale-mobile-stats"
    },
    {
        "target_repo"       : ["/Users/Kyla/Sites/secondprojectfolder"],
        "target_email"      : ["hi@kyla"],
        "dummy_repo"        : "/Users/Kyla/Sites/wooftale-site-stats",
        "dummy_repo_data"   : "/Users/Kyla/Sites/wooftale-site-stats/data",
        "dummy_email"       : "hi@kyla",
        "dummy_name"        : "Kyla Medina",
        "dummy_readme"      : "Repository Statistics",
        "dummy_ext"         : ".js",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "auto_push"         : true,
        "force"             : false,
        "remote"            : "https://github.com/kylamedina/wooftale-site-stats"
    }
]

Here is my terminal output:

since:
Log Split Length: 2300
Username for 'https://github.com': kylamedina
Password for 'https://[email protected]':
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 284 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/kylamedina/success-academy-stats
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
since:
Log Split Length: 2800
Username for 'https://github.com': kylamedina
Password for 'https://[email protected]':
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 284 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/kylamedina/wooftale-mobile-stats
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
since:
Log Split Length: 280
Username for 'https://github.com': kylamedina
Password for 'https://[email protected]':
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 284 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/kylamedina/wooftale-site-stats
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Can't rerun the python script

Whenever I run the python script I get the following message
...
Your branch is up-to-date with 'origin/master'.

Untracked files:
.DS_Store
commits/-4ffd501.js

nothing added to commit but untracked files present
fatal: remote origin already exists.
Branch master set up to track remote branch master from origin.
Everything up-to-date
since: Tue Jan 13 00:57:20 2015 +0100
Log Split Length: 1
Traceback (most recent call last):
File "gitdummy.py", line 121, in
if len(commits) > 0:
NameError: name 'commits' is not defined
...

I had to delete to remove these files from the working directory (of the dummy repo) to make it work. Also I can't get to run the script for multiple repos at the same time. Sometimes the repos get mixed together, committing to the wrong repo.

Calling „python gitdummy.py” causes output error

Calling 'python gitdummy.py' causes output error:

Traceback (most recent call last):
  File "gitdummy.py", line 15, in <module>
    if os.path.isdir(repo['dummy_repo'].strip()):
TypeError: string indices must be integers

No longer works

This script doesn't work anymore. It completes successfully, however the history does not get added.

I have private repos I commit to on another Github account and want the history to transfer over, but I don't see it updated on my history. However, in my dummy repo, the commits are there.

So again, the script works, but the history is not added any longer.

"Invalid \escape" issue - Using iCloud Directory

Hello. First off I'd like to say that gitdummy looks great and I can't wait to get everything up and running! Nice work!

Unfortunately it seems that there's an error on line 3 of my repos.json. I store my private repository in an iCloud folder on my mac. The path is correct (I've tested in terminal multiple times) but after running the python gitdummy.py command it seems that there is an "Invalid \escape" error.

Any suggestions? I have posted my repos.json and the terminal output below.

repos.json
`

[

{

    "target_repo"         : ["/Users/stefanzier/Library/Mobile\ Documents/com\~apple\~CloudDocs/fitpin-info"],

    "target_email"        : ["[email protected]"],
    "dummy_repo"          : "/Users/stefanzier/Desktop/public-fitpin-repo",
    "dummy_repo_data"     : "/Users/stefanzier/Desktop/public-fitpin-repo/data",
    "dummy_email"         : "[email protected]",
    "dummy_name"          : "Stefan Zier",
    "dummy_readme"        : "This public repository reflects the commits from a private repo (minus the actual code)",
    "dummy_ext"           : ".js",
    "dummy_code"          : "'use strict';",
    "hide_commits"        : false,
    "random_file_name"    : true,
    "auto_push"           : true,
    "force"               : true,
    "remote"              : "https://github.com/stefanzier/public-fitpin-repo"
}

]
`

Terminal Output:
Traceback (most recent call last): File "gitdummy.py", line 15, in <module> repos = json.load(open('repos.json')) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 291, in load **kw) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 380, in raw_decode obj, end = self.scan_once(s, idx) ValueError: Invalid \escape: line 3 column 67 (char 74)

Thank you!

dummy_myrepo "File Not Found Error"

Hi, I am trying to use this nice program on windows and Python3.
Problem is, I get a FileNotFoundError from

$ python gitdummy.py
Traceback (most recent call last):
  File "gitdummy.py", line 73, in <module>
    os.mkdir(repo['dummy_repo'])
FileNotFoundError: [WinError 3] ▒▒▒▒▒▒ ▒▒θ▒ ã▒▒ ▒▒ ▒▒▒▒▒ϴ▒: '~/Documents/dummy_myrepo'

What am I doing wrong??

TypeError: 'str' does not support the buffer interface

TypeError when random_file_name is set to true on Python 3.4.3:

since:
Log Split Length: 319
Traceback (most recent call last):
  File "gitdummy.py", line 140, in <module>
    commit['filename'] = base64.urlsafe_b64encode(uuid.uuid4().bytes).replace('=
', '')
TypeError: 'str' does not support the buffer interface

Unknown Option -C

I'm receiving this error when running:

python gitdummy.py
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
Traceback (most recent call last):
  File "gitdummy.py", line 41, in <module>
    '--pretty=format:%an||||%ae||||%ad||||%s'
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['git', '-C', u'PATHTOMYTARGET', 'log', '--reverse', '--pretty=format:%an||||%ae||||%ad||||%s']' returned non-zero exit status 129

Issues and Pull Requests

Since issues and PR's are also trackable in public graph, it would be a nice improvement for the next version. If only it's possible.

Not an issue: question regarding expected behaviour

I've run this expecting it to replay my private commits to the dummy repository at the times those commits were really made (so as to populate my contributions exactly as I see them), but they just added one single commit. Is this the expected behaviour?

Here's my repos.json:

[
    {
        "target_repo"       : ["/Users/kungfujam/git/mooc_analysis","/Users/kungfujam/git/TheBlog","/Users/kungfujam/git/mlpr1","/Users/kungfujam/git/exc1"],
        "target_email"      : ["[email protected]","[email protected]"],
        "dummy_repo"        : "/Users/kungfujam/git/private_dummy",
        "dummy_repo_data"   : "/Users/kungfujam/git/private_dummy/data",
        "dummy_email"       : "[email protected]",
        "dummy_name"        : "Dummy",
        "dummy_readme"      : "This public repository reflects the commits from a private repo (minus the actual code)",
        "dummy_ext"         : ".js",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "random_file_name"  : false,
        "auto_push"         : true,
        "force"             : false,
        "remote"            : "https://github.com/kungfujam/private_dummy"
    }
]

private view
public view

Getting error from the "dummy_repo_data" property.

Hi, Great repo BTW. Considering our Github accounts are our resume.

Given this repos.json

[
    {
        "target_repo"       : ["../js_for_lyfe/"],
        "target_email"      : ["[email protected]"],
        "dummy_repo"        : "../js_for_lyfe-mirror-repo/",
        "dummy_repo_data"   : "../js_for_lyfe-mirror-repo/data",
        "dummy_email"       : "[email protected]",
        "dummy_name"        : "Greg super",
        "dummy_readme"      : "This public repository reflects the commits from a private repo (minus the actual code)",
        "dummy_ext"         : ".js",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "auto_push"         : true,
        "force"             : false,
        "remote"            : "https://github.com/Duder-onomy/js_for_lyfe-mirror-repo.git"
    }
]

Getting this error:

since:
Log Split Length: 4
PRIVATE COMMIT MESSAGE: Commit message is private
Traceback (most recent call last):
  File "gitdummy.py", line 144, in <module>
    dummyfile = open(repo['dummy_repo_data'] + os.path.sep + commit['filename']+repo['dummy_ext'], 'w+')
IOError: [Errno 2] No such file or directory: u'../js_for_lyfe-mirror-repo/data/initial-commit-114f642.js'

I can confirm that both that directory and that file exist.

Is it because my repo paths are relative?

Working on windows machine

Hi,

Thanks for the repo. I have been trying to get this working on Windows but I get such an error:

C:\Users\oguzhangencoglu\SkyDrive\Oguz\GitHub\gitdummy>python gitdummy.py
since:
Traceback (most recent call last):
  File "gitdummy.py", line 92, in <module>
    '--pretty=format:%an||||%ae||||%ad||||%s||||%f-%h'
  File "C:\Users\oguzhangencoglu\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Users\oguzhangencoglu\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Users\oguzhangencoglu\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

My json file looks like this:

[
    {
        "target_repo"       : ["C:\\Users\\oguzhangencoglu\\SkyDrive\\Oguz\\Universite\\Research\\Digital Health Revolution (DHR) - Health Data Mining (HDM)\\Suomi24"],
        "target_email"      : ["[email protected]"],
        "dummy_repo"        : "C:\\Users\\oguzhangencoglu\\SkyDrive\\Oguz\\GitHub\\dummy_repo",
        "dummy_repo_data"   : "C:\\Users\\oguzhangencoglu\\SkyDrive\\Oguz\\GitHub\\dummy_repo\\data",
        "dummy_email"       : "[email protected]",
        "dummy_name"        : "Oguzhan Gencoglu",
        "dummy_readme"      : "This public repository reflects the commits from a private repo (minus the actual code)",
        "dummy_ext"         : "",
        "dummy_code"        : "'use strict';",
        "hide_commits"      : true,
        "random_file_name"  : false,
        "auto_push"         : false,
        "force"             : false,
        "remote"            : "https://github.com/ogencoglu/dummy_repo"
    }
]

Any help would be great.

Not working on Mac

Heyo
So i just found your project ( which looks awesome btw. ), however when I tried to run it on my mac I only get :

Traceback (most recent call last):
  File "./gitdummy.py", line 15, in <module>
    repos = json.load(open('repos.json'))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 5 column 95 (char 104)

Any ideas how I can make it work ?
Thx in advance

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.