Commit 238c8f80 authored by Matthias Putz's avatar Matthias Putz

linkin fix

parent 7df87662
...@@ -46,6 +46,8 @@ from pager import _SelectPager ...@@ -46,6 +46,8 @@ from pager import _SelectPager
from subcmds import all_commands from subcmds import all_commands
from repo_trace import REPO_TRACE, IsTrace, Trace
global_options = optparse.OptionParser(usage="repo [-p|--paginate|--no-pager|--piped-into-less] COMMAND [ARGS]") global_options = optparse.OptionParser(usage="repo [-p|--paginate|--no-pager|--piped-into-less] COMMAND [ARGS]")
global_options.add_option('-p', '--paginate', global_options.add_option('-p', '--paginate',
...@@ -412,6 +414,8 @@ def _WindowsPager(repo): ...@@ -412,6 +414,8 @@ def _WindowsPager(repo):
args2 = args[argsSplit+1:] args2 = args[argsSplit+1:]
pager = _SelectPager(cmd.manifest.globalConfig) pager = _SelectPager(cmd.manifest.globalConfig)
shellCommand = [python, thisScript] + args1 + ['--', '--piped-into-pager', '--no-pager'] + args2 + ['|', pager] shellCommand = [python, thisScript] + args1 + ['--', '--piped-into-pager', '--no-pager'] + args2 + ['|', pager]
if IsTrace():
Trace(' '.join(shellCommand))
subprocess.call(shellCommand, shell=True) subprocess.call(shellCommand, shell=True)
return True return True
else: else:
......
...@@ -10,6 +10,8 @@ import subprocess ...@@ -10,6 +10,8 @@ import subprocess
import sys import sys
import stat import stat
from repo_trace import REPO_TRACE, IsTrace, Trace
SYNC_REPO_PROGRAM = False SYNC_REPO_PROGRAM = False
SUBPROCESSES = [] SUBPROCESSES = []
...@@ -45,19 +47,21 @@ def os_link(src, dst): ...@@ -45,19 +47,21 @@ def os_link(src, dst):
src = os.path.relpath(src, os.path.dirname(dst)) src = os.path.relpath(src, os.path.dirname(dst))
os.symlink(src, dst) os.symlink(src, dst)
else: else:
dst = toUnixPath(dst) src = os.path.relpath(src, os.path.dirname(dst))
#subprocess.call(["ln", "-s", src, dst])
# ln in MinGW does not create hard links? - it copies
if os.path.isdir(src):
src = toWindowsPath(src) src = toWindowsPath(src)
dst = toWindowsPath(dst) dst = toWindowsPath(dst)
# symlink does create soft links in windows for directories => use mklink # ln in MinGW does not create hard links? - it copies
# call windows cmd tool 'mklink' from git bash (mingw) # call windows cmd tool 'mklink' from git bash (mingw)
subprocess.Popen('cmd /c mklink /J %s %s' % (dst, src), stdout=subprocess.PIPE) if os.path.isdir(src):
cmd = 'cmd /c mklink /D "%s" "%s"' % (dst, src)
if IsTrace():
Trace(cmd)
subprocess.Popen(cmd, stdout=subprocess.PIPE)
else: else:
# requires paths in relation to current dir (not in relation to target file) cmd = 'cmd /c mklink "%s" "%s"' % (dst, src)
src = toUnixPath(src) if IsTrace():
os.link(src, dst) Trace(cmd)
subprocess.Popen(cmd, stdout=subprocess.PIPE)
def removeReadOnlyFilesHandler(fn, path, excinfo): def removeReadOnlyFilesHandler(fn, path, excinfo):
removeReadOnlyFiles(fn, path) removeReadOnlyFiles(fn, path)
......
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