summaryrefslogtreecommitdiffstats
path: root/llvm/utils/git-svn
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2018-11-16 23:59:23 +0000
committerJames Y Knight <jyknight@google.com>2018-11-16 23:59:23 +0000
commit85362113c754a3271aaec8bc64150c8a451e5d88 (patch)
treebb0e93b39651746dd930039a0d6647045f36bc7c /llvm/utils/git-svn
parentc3214ad1dd4b1e3965afffc09fd3b96e3bf3a667 (diff)
downloadbcm5719-llvm-85362113c754a3271aaec8bc64150c8a451e5d88.tar.gz
bcm5719-llvm-85362113c754a3271aaec8bc64150c8a451e5d88.zip
Make git-llvm python3 compatible again. Hopefully. :)
llvm-svn: 347113
Diffstat (limited to 'llvm/utils/git-svn')
-rwxr-xr-xllvm/utils/git-svn/git-llvm17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm
index bff06d5eeb4..94927d445a8 100755
--- a/llvm/utils/git-svn/git-llvm
+++ b/llvm/utils/git-svn/git-llvm
@@ -29,6 +29,16 @@ import tempfile
import time
assert sys.version_info >= (2, 7)
+try:
+ dict.iteritems
+except AttributeError:
+ # Python 3
+ def iteritems(d):
+ return iter(d.items())
+else:
+ # Python 2
+ def iteritems(d):
+ return d.iteritems()
# It's *almost* a straightforward mapping from the monorepo to svn...
GIT_TO_SVN_DIR = {
@@ -287,7 +297,7 @@ def svn_push_one_rev(svn_repo, rev, dry_run):
(rev, status))
svn_dirs_to_update = set()
- for sr, files in subrepo_files.iteritems():
+ for sr, files in iteritems(subrepo_files):
svn_sr_path = GIT_TO_SVN_DIR[sr]
for f in files:
svn_dirs_to_update.update(
@@ -295,13 +305,12 @@ def svn_push_one_rev(svn_repo, rev, dry_run):
# Sort by length to ensure that the parent directories are passed to svn
# before child directories.
- sorted_dirs_to_update = sorted(svn_dirs_to_update,
- cmp=lambda x,y: cmp(len(x), len(y)))
+ sorted_dirs_to_update = sorted(svn_dirs_to_update, key=len)
# SVN update only in the affected directories.
svn(svn_repo, 'update', '--depth=immediates', *sorted_dirs_to_update)
- for sr, files in subrepo_files.iteritems():
+ for sr, files in iteritems(subrepo_files):
svn_sr_path = os.path.join(svn_repo, GIT_TO_SVN_DIR[sr])
if os.name == 'nt':
fix_eol_style_native(rev, svn_sr_path, files)
OpenPOWER on IntegriCloud