can now read and write simple sfcf measurements
This commit is contained in:
parent
5ec34ad98b
commit
c3aa7577fb
7 changed files with 408 additions and 0 deletions
31
backlogger/git_tools.py
Normal file
31
backlogger/git_tools.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import os
|
||||
import datalad.api as dl
|
||||
|
||||
|
||||
def move_submodule(repo_path, old_path, new_path):
|
||||
"""
|
||||
Move a submodule to a new location.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
old_path: str
|
||||
The old path of the module.
|
||||
new_path: str
|
||||
The new path of the module.
|
||||
"""
|
||||
|
||||
os.rename(repo_path + "/" + old_path, repo_path + "/" + new_path)
|
||||
with open(repo_path + '/.gitmodules', 'r') as fp:
|
||||
lines = fp.readlines()
|
||||
|
||||
for line in lines:
|
||||
if line.startswith('\tpath'):
|
||||
line = line.replace(old_path, new_path)
|
||||
break
|
||||
if line.startswith('[submodule "projects/tmp"]'):
|
||||
line = line.replace(old_path, new_path)
|
||||
break
|
||||
with open(repo_path + '/.gitmodules', 'w') as fp:
|
||||
fp.writelines(lines)
|
||||
dl.save(repo_path, message="Move module from " + old_path + " to " + new_path, dataset=repo_path)
|
Loading…
Add table
Add a link
Reference in a new issue