Skip to content

Commit 919e06b

Browse files
committed
Merge branch 'bc/portable'
* bc/portable: Remove python 2.5'isms Makefile: add PYTHON_PATH to GIT-BUILD-OPTIONS t/aggregate-results: accomodate systems with small max argument list length t/t7006: ignore return status of shell's unset builtin t/t5150: remove space from sed script git-request-pull.sh: remove -e switch to shell interpreter which breaks ksh t/t5800: skip if python version is older than 2.5
2 parents a031d76 + 23b093e commit 919e06b

File tree

12 files changed

+63
-28
lines changed

12 files changed

+63
-28
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,6 +1884,7 @@ GIT-CFLAGS: FORCE
18841884
GIT-BUILD-OPTIONS: FORCE
18851885
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
18861886
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
1887+
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
18871888
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
18881889
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
18891890
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@

git-remote-testgit.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env python
22

3-
import hashlib
3+
# hashlib is only available in python >= 2.5
4+
try:
5+
import hashlib
6+
_digest = hashlib.sha1
7+
except ImportError:
8+
import sha
9+
_digest = sha.new
410
import sys
511
import os
612
sys.path.insert(0, os.getenv("GITPYTHONLIB","."))
@@ -19,7 +25,7 @@ def get_repo(alias, url):
1925
repo.get_revs()
2026
repo.get_head()
2127

22-
hasher = hashlib.sha1()
28+
hasher = _digest()
2329
hasher.update(repo.path)
2430
repo.hash = hasher.hexdigest()
2531

@@ -133,7 +139,10 @@ def do_export(repo, args):
133139

134140
path = os.path.join(dirname, 'testgit.marks')
135141
print path
136-
print path if os.path.exists(path) else ""
142+
if os.path.exists(path):
143+
print path
144+
else:
145+
print ""
137146
sys.stdout.flush()
138147

139148
update_local_repo(repo)

git-request-pull.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh -e
1+
#!/bin/sh
22
# Copyright 2005, Ryan Anderson <ryan@michonline.com>
33
#
44
# This file is licensed under the GPL v2, or a later version
@@ -70,10 +70,10 @@ git show -s --format='The following changes since commit %H:
7070
7171
%s (%ci)
7272
73-
are available in the git repository at:' $baserev
74-
echo " $url $branch"
75-
echo
73+
are available in the git repository at:' $baserev &&
74+
echo " $url $branch" &&
75+
echo &&
7676

77-
git shortlog ^$baserev $headrev
78-
git diff -M --stat --summary $patch $merge_base..$headrev
77+
git shortlog ^$baserev $headrev &&
78+
git diff -M --stat --summary $patch $merge_base..$headrev || exit
7979
exit $status

git_remote_helpers/git/exporter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ def export_repo(self, base):
4848

4949
args = ["sed", "s_refs/heads/_" + self.repo.prefix + "_g"]
5050

51-
subprocess.check_call(args, stdin=p1.stdout)
51+
child = subprocess.Popen(args, stdin=p1.stdout)
52+
if child.wait() != 0:
53+
raise CalledProcessError

git_remote_helpers/git/importer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ def do_import(self, base):
3535
if os.path.exists(path):
3636
args.append("--import-marks=" + path)
3737

38-
subprocess.check_call(args)
38+
child = subprocess.Popen(args)
39+
if child.wait() != 0:
40+
raise CalledProcessError

git_remote_helpers/git/non_local.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def clone(self, base):
2929
os.makedirs(path)
3030
args = ["git", "clone", "--bare", "--quiet", self.repo.gitpath, path]
3131

32-
subprocess.check_call(args)
32+
child = subprocess.Popen(args)
33+
if child.wait() != 0:
34+
raise CalledProcessError
3335

3436
return path
3537

@@ -43,10 +45,14 @@ def update(self, base):
4345
die("could not find repo at %s", path)
4446

4547
args = ["git", "--git-dir=" + path, "fetch", "--quiet", self.repo.gitpath]
46-
subprocess.check_call(args)
48+
child = subprocess.Popen(args)
49+
if child.wait() != 0:
50+
raise CalledProcessError
4751

4852
args = ["git", "--git-dir=" + path, "update-ref", "refs/heads/master", "FETCH_HEAD"]
49-
subprocess.check_call(args)
53+
child = subprocess.Popen(args)
54+
if child.wait() != 0:
55+
raise CalledProcessError
5056

5157
def push(self, base):
5258
"""Pushes from the non-local repo to base.
@@ -58,4 +64,6 @@ def push(self, base):
5864
die("could not find repo at %s", path)
5965

6066
args = ["git", "--git-dir=" + path, "push", "--quiet", self.repo.gitpath]
61-
subprocess.check_call(args)
67+
child = subprocess.Popen(args)
68+
if child.wait() != 0:
69+
raise CalledProcessError

git_remote_helpers/git/repo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def is_remote(url):
1919

2020
prefixes = ["http", "file", "git"]
2121

22-
return any(url.startswith(i) for i in prefixes)
22+
for prefix in prefixes:
23+
if url.startswith(prefix):
24+
return True
25+
return False
2326

2427
class GitRepo(object):
2528
"""Repo object representing a repo.
@@ -50,7 +53,9 @@ def get_revs(self):
5053
path = ".cached_revs"
5154
ofile = open(path, "w")
5255

53-
subprocess.check_call(args, stdout=ofile)
56+
child = subprocess.Popen(args, stdout=ofile)
57+
if child.wait() != 0:
58+
raise CalledProcessError
5459
output = open(path).readlines()
5560
self.revmap = dict(sanitize(i) for i in output)
5661
if "HEAD" in self.revmap:

t/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ aggregate-results-and-cleanup: $(T)
3535
$(MAKE) clean
3636

3737
aggregate-results:
38-
'$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*
38+
for f in test-results/t*-*; do \
39+
echo "$$f"; \
40+
done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
3941

4042
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
4143
full-svn-test:

t/aggregate-results.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ failed=0
66
broken=0
77
total=0
88

9-
for file
9+
while read file
1010
do
1111
while read type value
1212
do

t/t5150-request-pull.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ test_expect_success 'setup: two scripts for reading pull requests' '
6767
6868
cat <<-\EOT >read-request.sed &&
6969
#!/bin/sed -nf
70-
/ in the git repository at:$/! d
70+
/ in the git repository at:$/!d
7171
n
7272
/^$/ n
7373
s/^[ ]*\(.*\) \([^ ]*\)/please pull\
@@ -102,7 +102,7 @@ test_expect_success 'setup: two scripts for reading pull requests' '
102102
/^ [a-zA-Z]/ n
103103
/^[a-zA-Z]* ([0-9]*):\$/ n
104104
/^\$/ N
105-
/^\n[a-zA-Z]* ([0-9]*):\$/! {
105+
/^\n[a-zA-Z]* ([0-9]*):\$/!{
106106
a\\
107107
SHORTLOG
108108
D

0 commit comments

Comments
 (0)