Skip to content

Commit 92a4771

Browse files
Merge branch 'release/1.0.2' into 1.0_master
2 parents 485e4ce + c3ec2cc commit 92a4771

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

anyvcs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with python-anyvcs. If not, see <http://www.gnu.org/licenses/>.
1717

18-
__version__ = '1.0.1'
18+
__version__ = '1.0.2'
1919

2020
def create(path, vcs):
2121
from common import UnknownVCSType

anyvcs/git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def cat(self, rev, path):
104104
path = type(self).cleanPath(path)
105105
ls = self.ls(rev, path, directory=True)
106106
assert len(ls) == 1
107-
if ls[0].type != 'f':
107+
if ls[0].get('type') != 'f':
108108
raise BadFileType(rev, path)
109109
cmd = [GIT, 'cat-file', 'blob', '%s:%s' % (rev, path)]
110110
return self._command(cmd)
@@ -117,7 +117,7 @@ def readlink(self, rev, path):
117117
path = type(self).cleanPath(path)
118118
ls = self.ls(rev, path, directory=True)
119119
assert len(ls) == 1
120-
if ls[0].type != 'l':
120+
if ls[0].get('type') != 'l':
121121
raise BadFileType(rev, path)
122122
return self._readlink(rev, path)
123123

anyvcs/hg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def cat(self, rev, path):
110110
path = type(self).cleanPath(path)
111111
ls = self.ls(rev, path, directory=True)
112112
assert len(ls) == 1
113-
if ls[0].type != 'f':
113+
if ls[0].get('type') != 'f':
114114
raise BadFileType(rev, path)
115115
cmd = [HG, 'cat', '-r', str(rev), path]
116116
return self._command(cmd)
@@ -119,7 +119,7 @@ def readlink(self, rev, path):
119119
path = type(self).cleanPath(path)
120120
ls = self.ls(rev, path, directory=True)
121121
assert len(ls) == 1
122-
if ls[0].type != 'l':
122+
if ls[0].get('type') != 'l':
123123
raise BadFileType(rev, path)
124124
return self._cat(str(rev), path)
125125

anyvcs/svn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def cat(self, rev, path):
184184
path = type(self).cleanPath(prefix + path)
185185
ls = self.ls(rev, path, directory=True)
186186
assert len(ls) == 1
187-
if ls[0].type != 'f':
187+
if ls[0].get('type') != 'f':
188188
raise BadFileType(rev, path)
189189
return self._cat(str(rev), path)
190190

@@ -199,7 +199,7 @@ def readlink(self, rev, path):
199199
path = type(self).cleanPath(prefix + path)
200200
ls = self.ls(rev, path, directory=True)
201201
assert len(ls) == 1
202-
if ls[0].type != 'l':
202+
if ls[0].get('type') != 'l':
203203
raise BadFileType(rev, path)
204204
return self._readlink(str(rev), path)
205205

@@ -217,7 +217,7 @@ def _heads(self, globs):
217217
results = []
218218
def match(n, path):
219219
for d in self.ls(youngest, path):
220-
if d.type == 'd':
220+
if d.get('type') == 'd':
221221
for k, v in n.iteritems():
222222
if fnmatch.fnmatchcase(d.name, k):
223223
if path:

tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@ def test_cat_error3(self):
678678
def test_cat_error4(self):
679679
self.assertRaises(BadFileType, self.repo.cat, self.main_branch, '/c')
680680

681+
def test_cat_error5(self):
682+
self.assertRaises(BadFileType, self.repo.cat, self.main_branch, '/')
683+
681684
def test_readlink1(self):
682685
result = self.repo.readlink(self.main_branch, 'b')
683686
correct = 'a'
@@ -710,6 +713,9 @@ def test_readlink_error3(self):
710713
def test_readlink_error4(self):
711714
self.assertRaises(BadFileType, self.repo.readlink, self.main_branch, '/c')
712715

716+
def test_readlink_error5(self):
717+
self.assertRaises(BadFileType, self.repo.readlink, self.main_branch, '/')
718+
713719
def test_log_head(self):
714720
result = self.repo.log(revrange=self.main_branch)
715721
self.assertIsInstance(result, CommitLogEntry)

0 commit comments

Comments
 (0)