[DEV] basic version with global mirror added only at the first sync

This commit is contained in:
Edouard DUPIN 2017-04-01 23:06:19 +02:00
parent badbafc4bf
commit f90e5bc535
4 changed files with 73 additions and 6 deletions

View File

@ -3,6 +3,12 @@ Lutin
`island` is a generic source downloader and syncronizer is a FREE software tool.
It is compatible with basic format of repo-git manifest. This project is created to be easyest to read with simple interface
(no internal git usage, but user level git usage) The main point to create the "fork" is the non-support of repo of relativity
in submodule of git (submodule reference with ../xxx.git) This point is really important when you want to have a rellocable
manifest and project with submodule. The simpl eexample is the atria-soft / generic-library / musicdsp that are availlable on
github, gitlab, bitbucket and personal server.
.. image:: https://badge.fury.io/py/island.png
:target: https://pypi.python.org/pypi/island
@ -61,6 +67,45 @@ Install pip on MacOs:
sudo easy_install pip
Usage
-----
Select a manifest:
island init http://github.com/atria-soft/manifest.git
Download and synchronize the sources:
island sync
Select all branch availlable in the worktree: (checkout origin/dev in dev branch and track it, do nothing if the branch does not exist)
island checkout dev
Show the status of the workspace
island status
TODO list
---------
- When sync checkout the new manifest
- status: show how many time late we are on the branch
- sync: filter the apply of this cmd
- create snapshot
- use a snapshot
- commit all change in a single commit name and date
- push all change in the origin branch
- stash/unstash all change
- permit to set the pasword when requested by git
- sync: show download progress
- support single project mirror
- support submodule mirror
- support project upstream
- support submodule add upstream
- push modilfication in all late mirorr (force mode optionnal) ==> for automatic server synchronisation in 4 lines
- a good documation of the format and the usage
- parallele download / sync / push ...
License (MPL v2.0)
---------------------

View File

@ -72,6 +72,18 @@ def execute(arguments):
debug.info("'" + str(ret) + "'")
debug.error("Clone repository does not work ... ")
continue
# add global mirror list
for mirror in elem.select_remote["mirror"]:
debug.verbose("Add global mirror: " + str(mirror))
cmd = "git remote add " + mirror["name"] + " " + mirror["fetch"] + "/" + elem.name
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
if ret != "" \
and ret != False:
# all is good, ready to get the system work corectly
debug.info("'" + str(ret) + "'")
debug.warning("Can not add global mirror ... ")
continue
debug.verbose("Add global mirror: " + str(mirror) + " (done)")
#debug.info("plop " + str(elem.select_remote.keys()))
# check submodule if requested:
if elem.select_remote["sync"] == True \
@ -153,8 +165,11 @@ def execute(arguments):
debug.info(" ==> sync submodule")
cmd = "git submodule sync"
ret = multiprocess.run_command_direct(cmd, cwd=git_repo_path)
if ret != "" \
and ret != False:
if ret[:31] == "Synchronizing submodule url for":
#all is good ...
debug.info(" " + ret)
elif ret != "" \
and ret != False:
# all is good, ready to get the system work corectly
debug.info("'" + ret + "'")
debug.error("Can not sync submodules ... ")

View File

@ -123,15 +123,16 @@ class Manifest():
mirror_fetch = ""
for attr_2 in child_2.attrib:
if attr_2 == "name":
mirror_name = child.attrib[attr_2]
mirror_name = child_2.attrib[attr_2]
elif attr_2 == "fetch":
mirror_fetch = child.attrib[attr_2]
mirror_fetch = child_2.attrib[attr_2]
while len(mirror_fetch) > 1 \
and ( mirror_fetch[-1] == "\\" \
or mirror_fetch[-1] == "/") :
mirror_fetch = mirror_fetch[:-1]
else:
debug.error("(l:" + str(child_2.sourceline) + ") Parsing the manifest : Unknow '" + child_2.tag + "' attibute : '" + attr_2 + "', availlable:[name,fetch]")
debug.debug("mirror: '" + mirror_name + "' '" + mirror_fetch + "'")
if mirror_name == "":
debug.error("(l:" + str(child_2.sourceline) + ") Missing mirrot 'name'")
if mirror_fetch == "":
@ -254,18 +255,22 @@ class Manifest():
tmp_default = copy.deepcopy(self.default)
else:
tmp_default = copy.deepcopy(self.default_base)
# debug.error(" self.default=" + str(self.default))
# add all local project
for elem in self.projects:
debug.verbose("parse element " + str(elem))
conf = RepoConfig()
conf.name = elem["name"]
conf.path = self._create_path_with_elem(elem)
# add default remote for the project (search in herited element)
for remote in self.remotes:
debug.verbose(" Local Remote: " + str(remote))
if remote["name"] == default["remote"]:
conf.remotes.append(remote)
if len(conf.remotes) == 0:
for remote in upper_remotes:
debug.verbose(" upper Remote: " + str(remote))
if remote["name"] == default["remote"]:
conf.remotes.append(remote)
if len(conf.remotes) == 0:
@ -275,14 +280,16 @@ class Manifest():
conf.select_remote = None
debug.debug(" remotes count: " + str(len(conf.remotes)))
for remote in conf.remotes:
debug.debug(" remote=" + str(remote))
debug.debug(" Ckeck remote : " + remote["name"] + " == " + default["remote"])
debug.verbose(" remote=" + str(remote))
debug.verbose(" default=" + str(default))
if remote["name"] == default["remote"]:
conf.select_remote = copy.deepcopy(remote)
debug.debug(" copy select=" + str(conf.select_remote))
# copy the submodule synchronisation
conf.select_remote["sync"] = default["sync"]
conf.select_remote["mirror"] = copy.deepcopy(default["mirror"])
break
if conf.select_remote == None:
debug.error("missing remote for project: " + str(conf.name))

View File

@ -16,7 +16,7 @@ def readme():
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
setup(name='island',
version='0.3.0',
version='0.3.2',
description='island generic source manager (like repo in simple mode)',
long_description=readme(),
url='http://github.com/HeeroYui/island',