Mercurial > libervia-backend
comparison sat/tools/utils.py @ 2568:8e204f0d3193
tools(utils): fixed path handling in getRepositoryData
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 04 Apr 2018 09:21:00 +0200 |
parents | 26edcf3a30eb |
children | 18e2ca5f798e |
comparison
equal
deleted
inserted
replaced
2567:ecb14a6036ae | 2568:8e204f0d3193 |
---|---|
134 import subprocess | 134 import subprocess |
135 KEYS=("node", "node_short", "branch", "date", "tag") | 135 KEYS=("node", "node_short", "branch", "date", "tag") |
136 ori_cwd = os.getcwd() | 136 ori_cwd = os.getcwd() |
137 | 137 |
138 if is_path: | 138 if is_path: |
139 repos_root = module | 139 repos_root = os.path.abspath(module) |
140 else: | 140 else: |
141 repos_root = os.path.dirname(module.__file__) | 141 repos_root = os.path.abspath(os.path.dirname(module.__file__)) |
142 | 142 |
143 hg_path = find_executable('hg') | 143 hg_path = find_executable('hg') |
144 | 144 |
145 if hg_path is not None: | 145 if hg_path is not None: |
146 os.chdir(repos_root) | 146 os.chdir(repos_root) |
176 # .hg/dirstate method | 176 # .hg/dirstate method |
177 log.debug(u"trying dirstate method") | 177 log.debug(u"trying dirstate method") |
178 if is_path: | 178 if is_path: |
179 os.chdir(repos_root) | 179 os.chdir(repos_root) |
180 else: | 180 else: |
181 os.chdir(os.path.relpath('..', repos_root)) | 181 os.chdir(os.path.abspath(os.path.join('..', repos_root))) |
182 try: | 182 try: |
183 with open('.hg/dirstate') as hg_dirstate: | 183 with open('.hg/dirstate') as hg_dirstate: |
184 hg_data['node'] = hg_dirstate.read(20).encode('hex') | 184 hg_data['node'] = hg_dirstate.read(20).encode('hex') |
185 hg_data['node_short'] = hg_data['node'][:12] | 185 hg_data['node_short'] = hg_data['node'][:12] |
186 except IOError: | 186 except IOError: |