Permalink
Browse files

Minor cleanup involving action logging (dont log deleted repo). Bug i…

…n api wrapper function
  • Loading branch information...
pingali committed Apr 23, 2016
1 parent 4031a6c commit b6d1074d95da530abd1d6dc13f7cd669ad2e5637
Showing with 25 additions and 19 deletions.
  1. +10 −1 HISTORY.rst
  2. +1 −1 dgitcore/__init__.py
  3. +6 −5 dgitcore/api.py
  4. +1 −1 dgitcore/contrib/repomanagers/gitmanager.py
  5. +1 −1 dgitcore/datasets/common.py
  6. +5 −2 dgitcore/helper.py
  7. +1 −8 tests/test_api.py
View
@@ -3,7 +3,16 @@
History
-------
-0.1.0 (2015-11-15)
+0.1.7 (2016-04-23)
+---------------------
+
+* API
+* Bug fixes
+* Added auto mode
+
+...
+
+0.1.0 (2016-02-26)
---------------------
* Boostrapping
View
@@ -4,5 +4,5 @@
import pkgutil
-__version__ = "0.1.6"
+__version__ = "0.1.7"
__path__ = pkgutil.extend_path(__path__, __name__)
View
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+import os, sys
import dgitcore
from dgitcore import datasets, plugins, config
from dgitcore.config import get_config
@@ -12,17 +13,17 @@ def api_call_action(func):
"""
API wrapper documentation
"""
- def inner(*args, **kwargs):
- func(*args, **kwargs)
- return inner
- return inner
+ def _inner(*args, **kwargs):
+ return func(*args, **kwargs)
+ _inner.__name__ = func.__name__
+ _inner.__doc__ = func.__doc__
+ return _inner
def _reexport(mod):
__all__.extend(mod.__all__)
for var in mod.__all__:
base = getattr(mod, var)
f = api_call_action(base)
- f.__doc__ = base.__doc__
globals()[var] = f
@@ -385,8 +385,8 @@ def drop(self, repo, args=[]):
# Clean up the rootdir
rootdir = repo.rootdir
- print("Cleaning repo directory: {}".format(rootdir))
if os.path.exists(rootdir):
+ print("Cleaning repo directory: {}".format(rootdir))
shutil.rmtree(rootdir)
# Cleanup the local version of the repo (this could be on
@@ -189,7 +189,6 @@ def commit(repo, args=[]):
"""
return generic_repo_cmd(repo, 'commit', args)
-@log_repo_action
def drop(repo, args=[]):
"""
Drop the repository (new to dgit)
@@ -409,6 +408,7 @@ def init(username, reponame, setup,
args = ['-a', '-m', 'Bootstrapped the repo']
repo.run('commit', args)
+
return repo
def clone(url):
View
@@ -234,8 +234,11 @@ def log_repo_action(func):
Log all repo actions to .dgit/log.json
"""
- def inner(*args, **kwargs):
+ def _inner(*args, **kwargs):
result = func(*args, **kwargs)
log_action(func, result, *args, **kwargs)
return result
- return inner
+
+ _inner.__name__ = func.__name__
+ _inner.__doc__ = func.__doc__
+ return _inner
View
@@ -125,7 +125,6 @@ def test_start_group1():
"""
pass
-
def test_create_repo():
"""
Init repo
@@ -147,8 +146,6 @@ def test_create_repo():
path = os.path.join(rootdir, suffix)
assert os.path.exists(path)
- print("Completed create repo")
-
def test_sh_command():
"""
@@ -206,17 +203,14 @@ def test_repo_drop():
"""
repos = api.list_repos()
- print(repos)
assert len(repos) == 3
repo = basic_repo_lookup('simple1')
rootdir = repo.rootdir
- api.drop(repo)
-
+ response = api.drop(repo)
assert not os.path.exists(rootdir)
repos = api.list_repos()
- print(repos)
assert len(repos) == 2
@@ -248,7 +242,6 @@ def test_simple_add_files():
# Create a temp file and add it
(fd, filename) = tempfile.mkstemp()
try:
- print("Adding ", filename)
api.add(repo, [filename], ".")
# Check if the file exists in git

0 comments on commit b6d1074

Please sign in to comment.