Commit 5a2b0c52 authored by Matthias Putz's avatar Matthias Putz

added repo.cmd for windows + made repo file self-contained + updated readme

parent 9699e19f
## Git-repo for Windows and Linux ## ## Git-repo for Windows and Linux ##
This is a portable version (Windows 7+, Unix) of the [git-repo](http://source.android.com/source/version-control.html) tool. This is a portable version (Windows 7+, Linux) of the [git-repo](http://source.android.com/source/version-control.html) tool.
Git-repo was developed by Google for their Android platform in order to manage multiple Git repositories with a single tool. Git-repo was developed by Google for their Android platform in order to manage multiple Git repositories with a single tool.
For example it is possible to view the changes of all configured git repositories with a single command: repo diff. For example it is possible to view the changes of all configured git repositories with a single command: repo diff.
Since the original git-repo tool is supposed to work only on Unix systems, therefore uses platform dependent features, Since the original git-repo tool is supposed to work only on Linux systems, therefore uses platform dependent features,
Windows users have no viable solution for handling huge progjects which include many git repositories. Windows users have no viable solution for handling huge progjects which include many git repositories.
The mainly used, platform dependet features are: symbolic links as well as the creation of new child processes with fork(). The mainly used, platform dependet features are: symbolic links as well as the creation of new child processes with fork().
### Requirements ### ### Requirements ###
* Git (especially Git Bash) * [Python 3+](http://python.org/download/releases/3.3.0/)
* Python 3+ * [Git](http://git-scm.com/)
* Windows 7+ (symbolic link support) or Unix like system * Windows 7+ or Linux
### Setup ###
### Getting started ### * Add to Windows environment variable PATH
* full additions (explained further on)
;C:\Python33C;\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;%USERPROFILE%
* Python3.3
* Git cmd folder
* Git bin folder
* repo script default path
* Start "Git Bash", Download repo script
curl https://github.com/esrlabs/git-repo/repo > ~/repo
curl https://github.com/esrlabs/git-repo/repo.cmd > ~/repo.cmd
WARNING: It is recommended to use the provided 'Git Bash' in Windows. ### Usage ###
For more detailed instructions regaring usage, visit [git-repo](http://source.android.com/source/version-control.html). For more detailed instructions regarding usage, visit [git-repo](http://source.android.com/source/version-control.html).
Since this version does not break any features of the original repo, the following instructions are exactly the same Since this version does not break any features of the original repo, the following instructions are exactly the same
found on the referenced Android git-repo tool page. found on the referenced Android [git-repo](http://source.android.com/source/version-control.html) tool page.
* setup a git repository (url refered to as $MANIFEST), containing a manifest file similar to Androids [default.xml](https://android.googlesource.com/platform/manifest/+/master/default.xml) * setup a git repository (url refered to as $MANIFEST), containing a manifest file similar to Androids [default.xml](https://android.googlesource.com/platform/manifest/+/master/default.xml)
* Clone this git repository to a preferred directory ($REPO) * Change to the root folder of your project
git clone https://github.com/esrlabs/git-repo.git
* Change to the root of the directory
* Initialize repo with the manifest url * Initialize repo with the manifest url
$REPO/repo init -u $MANIFEST repo init -u $MANIFEST
* Sync to get all repositories * Sync to get all repositories
$REPO/repo sync repo sync
* do stuff in git repositories..
* view diff, status, .. (in root folder)
* .. repo status
repo diff
\ No newline at end of file
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
import portable
# copied from portable
def stream2str(stream):
return str(stream, encoding='UTF-8')
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
print('git-repo is written for python3, your version is %s, please upgrade from www.python.org.' % sys.version) print('git-repo is written for python3, your version is %s, please upgrade from www.python.org.' % sys.version)
...@@ -262,7 +265,7 @@ def _CheckGitVersion(): ...@@ -262,7 +265,7 @@ def _CheckGitVersion():
file=sys.stderr) file=sys.stderr)
raise CloneFailure() raise CloneFailure()
ver_str = portable.stream2str(proc.stdout.read()).strip() ver_str = stream2str(proc.stdout.read()).strip()
proc.stdout.close() proc.stdout.close()
proc.wait() proc.wait()
...@@ -495,7 +498,7 @@ def _Verify(cwd, branch, quiet): ...@@ -495,7 +498,7 @@ def _Verify(cwd, branch, quiet):
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
cwd = cwd) cwd = cwd)
cur = portable.stream2str(proc.stdout.read()).strip() cur = stream2str(proc.stdout.read()).strip()
proc.stdout.close() proc.stdout.close()
proc.stderr.read() proc.stderr.read()
...@@ -668,7 +671,7 @@ def _SetDefaultsTo(gitdir): ...@@ -668,7 +671,7 @@ def _SetDefaultsTo(gitdir):
'HEAD'], 'HEAD'],
stdout = subprocess.PIPE, stdout = subprocess.PIPE,
stderr = subprocess.PIPE) stderr = subprocess.PIPE)
REPO_REV = portable.stream2str(proc.stdout.read()).strip() REPO_REV = stream2str(proc.stdout.read()).strip()
proc.stdout.close() proc.stdout.close()
proc.stderr.read() proc.stderr.read()
......
@bash -c "repo %*"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment