Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 10, 2019. It is now read-only.
/vcpromptPublic archive

Commit76f9c62

Browse files
committed
Squashed the last remaining bugs in the tests.
1 parent064e63f commit76f9c62

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

‎tests/tests.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
from __future__importwith_statement
33
importos
4+
importre
45
importsys
56
importsubprocess
67
importunittest
@@ -162,13 +163,21 @@ def test_format_revision(self, string='%r'):
162163
classGit(Base,BaseTest):
163164

164165
def_hash_or_branch(self,get='hash'):
165-
withopen(os.path.join(self.repository,'.git/packed-refs'),'r')asf:
166+
branch=hash=self.unknown()
167+
# get the branch name
168+
withopen(os.path.join(self.repository,'.git/HEAD'),'r')asf:
166169
forlineinf:
167-
ifnotline.startswith('#'):
168-
hash,branch=line.split()
169-
hash=hash[:7]
170-
branch=branch.rsplit('/')[-1]
171-
returnlocals()[get]
170+
ifre.match('^ref',line):
171+
branch=line.strip().split('/')[-1]
172+
break
173+
174+
# open the branch file, grab the hash
175+
ifbranch!=self.unknown():
176+
withopen(self.file('.git/refs/heads/%s'%branch),'r')asbf:
177+
forbflineinbf:
178+
hash=bfline.strip()[:7]
179+
break
180+
returnlocals()[get]
172181

173182
defbranch(self):
174183
returnself._hash_or_branch('branch')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp