Commit 7bf91ad2 authored by Matthias Putz's avatar Matthias Putz

working init for win+linux

parent 9da5bff1
This diff is collapsed.
......@@ -537,8 +537,8 @@ class Remote(object):
self.url = self._Get('url')
self.review = self._Get('review')
self.projectname = self._Get('projectname')
self.fetch = map(RefSpec.FromString,
self._Get('fetch', all_keys=True))
self.fetch = list(map(RefSpec.FromString,
self._Get('fetch', all_keys=True)))
self._review_url = None
def _InsteadOf(self):
......@@ -657,7 +657,7 @@ class Remote(object):
self._Set('url', self.url)
self._Set('review', self.review)
self._Set('projectname', self.projectname)
self._Set('fetch', map(str, self.fetch))
self._Set('fetch', list(map(str, self.fetch)))
def _Set(self, key, value):
key = 'remote.%s.%s' % (self.name, key)
......
......@@ -130,11 +130,11 @@ class XmlManifest(object):
try:
if os.path.lexists(self.manifestFile):
os.remove(self.manifestFile)
if portable.isLinux():
src = 'manifests/%s' % name
else:
src = self.manifestProject.relpath + '/%s' % name
portable.os_link(src, self.manifestFile)
#if portable.isLinux():
src = 'manifests/%s' % name
#else:
# src = self.manifestProject.relpath + '/%s' % name
portable.os_link('./.repo/%s' % src, self.manifestFile)
except OSError as e:
raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e)))
......
......@@ -22,19 +22,20 @@ def pathToWindows(path):
def os_link(src, dst):
if isLinux():
os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst)
# requires src in relation to dst
src = os.path.relpath(src, os.path.dirname(dst))
os.symlink(src, dst)
else:
dst = pathToLinux(dst)
#subprocess.call(["ln", "-s", src, dst])
# ln in MinGW does not create hard links? - it copies
# python internal link
if os.path.isdir(src):
src = os.path.relpath(src, os.path.dirname(dst))
src = pathToWindows(src)
# symlink does create soft links in windows for directories
#os.symlink(src, dst, True)
dst = pathToWindows(dst)
# symlink does create soft links in windows for directories => use mklink
# call windows cmd tool 'mklink' from git bash (mingw)
subprocess.Popen('cmd /c mklink /J %s %s' % (dst, src))
else:
# requires paths in relation to current dir (not in relation to target file)
src = pathToLinux(src)
os.link(src, dst)
\ No newline at end of file
......@@ -1949,6 +1949,11 @@ class Project(object):
if not os.path.exists(dotgit):
os.makedirs(dotgit)
# create dir - since on Linux a broken link will be created, which is not allowed on windows
rr_cache = os.path.join(self.gitdir, 'rr-cache')
if not os.path.exists(rr_cache):
os.makedirs(rr_cache)
for name in ['config',
'description',
'hooks',
......@@ -1958,7 +1963,8 @@ class Project(object):
'packed-refs',
'refs',
'rr-cache',
'svn']:
#'svn'
]:
try:
src = os.path.join(self.gitdir, name)
dst = os.path.join(dotgit, name)
......@@ -1980,9 +1986,6 @@ class Project(object):
if GitCommand(self, cmd).Wait() != 0:
raise GitError("cannot initialize work tree")
rr_cache = os.path.join(self.gitdir, 'rr-cache')
if not os.path.exists(rr_cache):
os.makedirs(rr_cache)
self._CopyFiles()
......
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