Skip to content

Commit

Permalink
Merge pull request #582 from Elvish-Hunter/python_vc_removal
Browse files Browse the repository at this point in the history
wmltools: removal of git wrapper functions
  • Loading branch information
Elvish-Hunter committed Jan 22, 2016
2 parents e999a1c + 79f6b4d commit 48459ba
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 334 deletions.
43 changes: 0 additions & 43 deletions data/tools/wesnoth/wmltools.py
Expand Up @@ -933,47 +933,4 @@ def resolve_unit_image(namespace, subdir, resource):
# And this is for code that does syntax transformation
baseindent = " "

## Version-control hooks begin here.
#
# Not tested since the git transition

vcdir = ".git"

def vcmove(src, dst):
"Move a file under version control. Only applied to unmodified files."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git mv %s %s" % (src, dst)
else:
return "echo 'cannot move %s to %s, .git is missing'" % (src, dst)

def vcunmove(src, dst):
"Revert the result of a previous move (before commit)."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git checkout %s" % dst # Revert the add at the destination
return "git rm " + dst # Remove the moved copy
return "git checkout %s" % src # Revert the deletion
else:
return "echo 'cannot unmove %s from %s, .git is missing'" % (src, dst)

def vcdelete(src):
"Delete a file under version control."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git rm %s" % src
else:
return "echo 'cannot undelete %s, .git is missing'" % src

def vcundelete(src):
"Revert the result of a previous delete (before commit)."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git checkout %s" % src # Revert the deletion
else:
return "echo 'cannot undelete %s, .git is missing'" % src

#
## Version-control hooks end here

# wmltools.py ends here
43 changes: 0 additions & 43 deletions data/tools/wesnoth/wmltools3.py
Expand Up @@ -928,47 +928,4 @@ def resolve_unit_image(namespace, subdir, resource):
# And this is for code that does syntax transformation
baseindent = " "

## Version-control hooks begin here.
#
# Not tested since the git transition

vcdir = ".git"

def vcmove(src, dst):
"Move a file under version control. Only applied to unmodified files."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git mv %s %s" % (src, dst)
else:
return "echo 'cannot move %s to %s, .git is missing'" % (src, dst)

def vcunmove(src, dst):
"Revert the result of a previous move (before commit)."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git checkout %s" % dst # Revert the add at the destination
return "git rm " + dst # Remove the moved copy
return "git checkout %s" % src # Revert the deletion
else:
return "echo 'cannot unmove %s from %s, .git is missing'" % (src, dst)

def vcdelete(src):
"Delete a file under version control."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git rm %s" % src
else:
return "echo 'cannot undelete %s, .git is missing'" % src

def vcundelete(src):
"Revert the result of a previous delete (before commit)."
(path, base) = os.path.split(src)
if os.path.exists(os.path.join(path, ".git")):
return "git checkout %s" % src # Revert the deletion
else:
return "echo 'cannot undelete %s, .git is missing'" % src

#
## Version-control hooks end here

# wmltools.py ends here
5 changes: 2 additions & 3 deletions data/tools/wmllint-1.4
Expand Up @@ -2281,10 +2281,9 @@ if __name__ == '__main__':
# FIXME: We should make some effort to rename mask files.
if not revert and not diffs:
if not fn.endswith(".map") and not fn.endswith(".mask") and is_map(fn):
mover = vcmove(fn, fn + ".map")
print(mover)
print('wmllint: renaming "%s" to "%s"' % (fn, fn + ".map"))
if not dryrun:
os.system(mover)
os.rename(fn, fn + ".map")
elif fn in is_main and os.path.isdir(fn.replace('.cfg', '')):
main = fn.replace('.cfg', '/_main.cfg')
if os.path.exists(main):
Expand Down
245 changes: 0 additions & 245 deletions data/tools/wmlmove

This file was deleted.

0 comments on commit 48459ba

Please sign in to comment.