From b919010b0459b2540fb609c5d1aad0b8dc0fab01 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sun, 1 Jun 2008 21:44:29 -0400 Subject: put version stuff back. --- lib/git/__init__.py | 5 +---- setup.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/git/__init__.py b/lib/git/__init__.py index 54f77baf..f38dd220 100644 --- a/lib/git/__init__.py +++ b/lib/git/__init__.py @@ -1,10 +1,7 @@ import os import inspect -# grab the version information -v = open(os.path.join(os.path.dirname(__file__), '..', '..', 'VERSION')) -__version__ = v.readline().strip() -v.close() +__version__ = 'svn' from git.actor import Actor from git.blob import Blob diff --git a/setup.py b/setup.py index 6386f2fb..eda1906b 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ class sdist(_sdist): if hasattr(os, 'link') and path.exists(dest): os.unlink(dest) self.copy_file(orig, dest) - # _stamp_version(dest) + _stamp_version(dest) def _stamp_version(filename): found, out = False, [] -- cgit v1.2.3 From 277be842bf30848e7292a931169bd4c8ff726dee Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 1 Jun 2008 12:58:32 -0700 Subject: style: follow PEP 8 in git/cmd.py Keyword args shouldn't use spaces around the equals sign per PEP 8. Signed-off-by: David Aguilar --- lib/git/cmd.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/git/cmd.py b/lib/git/cmd.py index ac449e91..8c996070 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -51,11 +51,11 @@ class Git(MethodMissingMixin): return self.git_dir def execute(self, command, - istream = None, - with_status = False, - with_stderr = False, - with_exceptions = False, - with_raw_output = False, + istream=None, + with_status=False, + with_stderr=False, + with_exceptions=False, + with_raw_output=False, ): """ Handles executing the command on the shell and consumes and returns @@ -96,10 +96,10 @@ class Git(MethodMissingMixin): # Start the process proc = subprocess.Popen(command, - cwd = self.git_dir, - stdin = istream, - stderr = stderr, - stdout = subprocess.PIPE + cwd=self.git_dir, + stdin=istream, + stderr=stderr, + stdout=subprocess.PIPE ) # Wait for the process to return -- cgit v1.2.3 From bf2083922b7bccc31917bf9cdb74e3d4892c2600 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 1 Jun 2008 12:52:53 -0700 Subject: style: remove spaces around parens per PEP8 Signed-off-by: David Aguilar --- test/git/test_git.py | 6 ++++++ test/testlib/helper.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/git/test_git.py b/test/git/test_git.py index 61b90a5f..e452e68b 100644 --- a/test/git/test_git.py +++ b/test/git/test_git.py @@ -55,3 +55,9 @@ class TestGit(object): def test_it_handles_large_input(self): output = self.git.execute(["cat", "/bin/bash"]) assert_true(len(output) > 4096) # at least 4k + + @patch(Git, 'execute') + def test_it_ignores_false_kwargs(self, git): + # this_should_not_be_ignored=False implies it *should* be ignored + output = self.git.version(pass_this_kwarg=False) + assert_true("pass_this_kwarg" not in git.call_args[1]) diff --git a/test/testlib/helper.py b/test/testlib/helper.py index 0e3f6bf5..ccc7f0ac 100644 --- a/test/testlib/helper.py +++ b/test/testlib/helper.py @@ -3,7 +3,7 @@ import os GIT_REPO = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) def fixture_path(name): - test_dir = os.path.dirname( os.path.dirname(__file__) ) + test_dir = os.path.dirname(os.path.dirname(__file__)) return os.path.join(test_dir, "fixtures", name) def fixture(name): -- cgit v1.2.3 From edf9fc528277a53ec37d1bd79fb4f8608cce11ae Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 31 May 2008 23:01:17 -0700 Subject: Git: guard against passing False to git commands git does not accept commands of the form: git cmd --xx=False or git cmd -xFalse This patch prevents transform_kwargs from producing command lines with those values. This adds some flexibility/syntactic sugar for callers since they can then assume that kwargs with a False value are not passed to git commands. Signed-off-by: David Aguilar --- lib/git/cmd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git/cmd.py b/lib/git/cmd.py index 8c996070..afa13e2c 100644 --- a/lib/git/cmd.py +++ b/lib/git/cmd.py @@ -132,12 +132,12 @@ class Git(MethodMissingMixin): if len(k) == 1: if v is True: args.append("-%s" % k) - else: + elif type(v) is not bool: args.append("-%s%s" % (k, v)) else: if v is True: args.append("--%s" % dashify(k)) - else: + elif type(v) is not bool: args.append("--%s=%s" % (dashify(k), v)) return args -- cgit v1.2.3 From 57a561cda141a0fed3129f4f3488e3b91805e638 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 1 Jun 2008 23:04:57 -0700 Subject: tests: removed an obsolete comment in test_it_ignores_false_kwargs Signed-off-by: David Aguilar --- test/git/test_git.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/git/test_git.py b/test/git/test_git.py index e452e68b..82644b6d 100644 --- a/test/git/test_git.py +++ b/test/git/test_git.py @@ -58,6 +58,5 @@ class TestGit(object): @patch(Git, 'execute') def test_it_ignores_false_kwargs(self, git): - # this_should_not_be_ignored=False implies it *should* be ignored output = self.git.version(pass_this_kwarg=False) assert_true("pass_this_kwarg" not in git.call_args[1]) -- cgit v1.2.3 From 9aa93b5890acb152c5824a8f75c221cf1addfd1b Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Mon, 2 Jun 2008 09:46:48 -0400 Subject: changed svn to git. This makes more sense. I tried trunk, master, edge. --- lib/git/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git/__init__.py b/lib/git/__init__.py index f38dd220..7de5088a 100644 --- a/lib/git/__init__.py +++ b/lib/git/__init__.py @@ -1,7 +1,7 @@ import os import inspect -__version__ = 'svn' +__version__ = 'git' from git.actor import Actor from git.blob import Blob diff --git a/setup.py b/setup.py index eda1906b..db22b2ac 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def _stamp_version(filename): f = open(filename, 'r') for line in f: if '__version__ =' in line: - line = line.replace("'svn'", "'%s'" % VERSION) + line = line.replace("'git'", "'%s'" % VERSION) found = True out.append(line) f.close() -- cgit v1.2.3