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

refactored

parent ddccb22e
......@@ -3,12 +3,13 @@
<component name="ChangeListManager">
<list default="true" id="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/main.py" afterPath="$PROJECT_DIR$/main.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/portable.py" afterPath="$PROJECT_DIR$/portable.py" />
</list>
<ignored path="git-repo.iws" />
<ignored path=".idea/workspace.xml" />
<file path="/Dummy.txt" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363590315380" ignored="false" />
<file path="/main.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363600781772" ignored="false" />
<file path="/portable.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363275619057" ignored="false" />
<file path="/main.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363601178273" ignored="false" />
<file path="/portable.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363601362487" ignored="false" />
<file path="/a.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363252132925" ignored="false" />
<file path="/a.dummy" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363594579797" ignored="false" />
<file path="/git_config.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363276044335" ignored="false" />
......@@ -82,10 +83,10 @@
<splitter split-orientation="horizontal" split-proportion="0.684111">
<split-first>
<leaf>
<file leaf-file-name="main.py" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="main.py" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state line="417" column="0" selection-start="12997" selection-end="12997" vertical-scroll-proportion="0.39823008">
<state line="143" column="7" selection-start="4420" selection-end="4420" vertical-scroll-proportion="0.0">
<folding>
<element signature="e#625#662#0" expanded="true" />
</folding>
......@@ -122,10 +123,10 @@
</provider>
</entry>
</file>
<file leaf-file-name="portable.py" pinned="false" current="false" current-in-tab="false">
<file leaf-file-name="portable.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/portable.py">
<provider selected="true" editor-type-id="text-editor">
<state line="12" column="4" selection-start="123" selection-end="123" vertical-scroll-proportion="0.0">
<state line="30" column="0" selection-start="447" selection-end="447" vertical-scroll-proportion="0.74336284">
<folding />
</state>
</provider>
......@@ -213,7 +214,6 @@
<list>
<option value="$PROJECT_DIR$/manifest_xml.py" />
<option value="$PROJECT_DIR$/subcmds/sync.py" />
<option value="$PROJECT_DIR$/portable.py" />
<option value="$PROJECT_DIR$/git_command.py" />
<option value="$PROJECT_DIR$/git_config.py" />
<option value="$PROJECT_DIR$/subcmds/cherry_pick.py" />
......@@ -223,6 +223,7 @@
<option value="$PROJECT_DIR$/tests/linux-pager.py" />
<option value="$PROJECT_DIR$/project.py" />
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/portable.py" />
</list>
</option>
</component>
......@@ -653,13 +654,13 @@
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="JetGradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32821077" sideWeight="0.48399147" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32821077" sideWeight="0.481857" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="SBT Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.30406147" sideWeight="0.9375667" order="3" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32821077" sideWeight="0.5122732" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32821077" sideWeight="0.5144077" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32924107" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
......@@ -754,12 +755,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/portable.py</url>
<line>28</line>
<line>33</line>
<option name="timeStamp" value="17" />
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>432</line>
<line>421</line>
<option name="timeStamp" value="18" />
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
......@@ -799,12 +800,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>158</line>
<line>147</line>
<option name="timeStamp" value="40" />
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>414</line>
<line>403</line>
<option name="timeStamp" value="42" />
</line-breakpoint>
</breakpoints>
......@@ -903,13 +904,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/portable.py">
<provider selected="true" editor-type-id="text-editor">
<state line="12" column="4" selection-start="123" selection-end="123" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="44" column="4" selection-start="1226" selection-end="1226" vertical-scroll-proportion="0.05235602">
......@@ -937,13 +931,20 @@
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state line="417" column="0" selection-start="12997" selection-end="12997" vertical-scroll-proportion="0.39823008">
<state line="143" column="7" selection-start="4420" selection-end="4420" vertical-scroll-proportion="0.0">
<folding>
<element signature="e#625#662#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/portable.py">
<provider selected="true" editor-type-id="text-editor">
<state line="30" column="0" selection-start="447" selection-end="447" vertical-scroll-proportion="0.74336284">
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
......
......@@ -45,17 +45,6 @@ from pager import _SelectPager
from subcmds import all_commands
# TODO workaround: disabled git pager since ideally it would fork to use less as pager
if portable.isLinux():
# will be set to less automatically, but let it be the default
#os.environ['GIT_PAGER'] = 'less'
pass
else:
os.environ['GIT_PAGER'] = 'less'
global_options = optparse.OptionParser(
usage="repo [-p|--paginate|--no-pager] COMMAND [ARGS]"
)
......@@ -152,7 +141,7 @@ class _Repo(object):
print("repo was not configured, run _Config(argv) before calling _Run(..)")
return 1
if portable.isLinux() and _UsePager(name, cmd, gopts, copts):
if _UsePager(name, cmd, gopts, copts):
config = cmd.manifest.globalConfig
RunPager(config)
......@@ -456,7 +445,7 @@ def _Main(argv):
repo._Config(argv)
# intercept here if on Windows and Pager is required
if not portable.isLinux():
if not portable.isPosix():
if _WindowsPager(repo):
# everything was already done; so exit
exit(0);
......
......@@ -13,34 +13,39 @@ SYNC_REPO_PROGRAM = False
def stream2str(stream):
return str(stream, encoding='UTF-8')
def isLinux():
def isUnix():
if platform.system() == "Windows":
return False
else:
return True
def pathToLinux(path):
def isPosix():
return platform.system() != "Windows"
def toUnixPath(path):
return path.replace('\\', '/')
def pathToWindows(path):
def toWindowsPath(path):
return path.replace('/', '\\')
def os_link(src, dst):
if isLinux():
if isUnix():
# requires src in relation to dst
src = os.path.relpath(src, os.path.dirname(dst))
os.symlink(src, dst)
else:
dst = pathToLinux(dst)
dst = toUnixPath(dst)
#subprocess.call(["ln", "-s", src, dst])
# ln in MinGW does not create hard links? - it copies
if os.path.isdir(src):
src = pathToWindows(src)
dst = pathToWindows(dst)
src = toWindowsPath(src)
dst = toWindowsPath(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)
src = toUnixPath(src)
os.link(src, dst)
\ 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