about summary refs log tree commit diff
path: root/third_party/git/contrib/hg-to-git/hg-to-git.py
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
commit93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch)
tree85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/contrib/hg-to-git/hg-to-git.py
parent6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff)
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing
changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/contrib/hg-to-git/hg-to-git.py')
-rwxr-xr-xthird_party/git/contrib/hg-to-git/hg-to-git.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/third_party/git/contrib/hg-to-git/hg-to-git.py b/third_party/git/contrib/hg-to-git/hg-to-git.py
index 7eb1b24cc7a1..de3f81667ed9 100755
--- a/third_party/git/contrib/hg-to-git/hg-to-git.py
+++ b/third_party/git/contrib/hg-to-git/hg-to-git.py
@@ -42,7 +42,7 @@ hgnewcsets = 0
 
 def usage():
 
-        print("""\
+        print """\
 %s: [OPTIONS] <hgprj>
 
 options:
@@ -54,7 +54,7 @@ options:
 
 required:
     hgprj:  name of the HG project to import (directory)
-""" % sys.argv[0])
+""" % sys.argv[0]
 
 #------------------------------------------------------------------------------
 
@@ -104,22 +104,22 @@ os.chdir(hgprj)
 if state:
     if os.path.exists(state):
         if verbose:
-            print('State does exist, reading')
+            print 'State does exist, reading'
         f = open(state, 'r')
         hgvers = pickle.load(f)
     else:
-        print('State does not exist, first run')
+        print 'State does not exist, first run'
 
 sock = os.popen('hg tip --template "{rev}"')
 tip = sock.read()
 if sock.close():
     sys.exit(1)
 if verbose:
-    print('tip is', tip)
+    print 'tip is', tip
 
 # Calculate the branches
 if verbose:
-    print('analysing the branches...')
+    print 'analysing the branches...'
 hgchildren["0"] = ()
 hgparents["0"] = (None, None)
 hgbranch["0"] = "master"
@@ -154,15 +154,15 @@ for cset in range(1, int(tip) + 1):
         else:
             hgbranch[str(cset)] = "branch-" + str(cset)
 
-if "0" not in hgvers:
-    print('creating repository')
+if not hgvers.has_key("0"):
+    print 'creating repository'
     os.system('git init')
 
 # loop through every hg changeset
 for cset in range(int(tip) + 1):
 
     # incremental, already seen
-    if str(cset) in hgvers:
+    if hgvers.has_key(str(cset)):
         continue
     hgnewcsets += 1
 
@@ -180,27 +180,27 @@ for cset in range(int(tip) + 1):
     os.write(fdcomment, csetcomment)
     os.close(fdcomment)
 
-    print('-----------------------------------------')
-    print('cset:', cset)
-    print('branch:', hgbranch[str(cset)])
-    print('user:', user)
-    print('date:', date)
-    print('comment:', csetcomment)
+    print '-----------------------------------------'
+    print 'cset:', cset
+    print 'branch:', hgbranch[str(cset)]
+    print 'user:', user
+    print 'date:', date
+    print 'comment:', csetcomment
     if parent:
-        print('parent:', parent)
+	print 'parent:', parent
     if mparent:
-        print('mparent:', mparent)
+        print 'mparent:', mparent
     if tag:
-        print('tag:', tag)
-    print('-----------------------------------------')
+        print 'tag:', tag
+    print '-----------------------------------------'
 
     # checkout the parent if necessary
     if cset != 0:
         if hgbranch[str(cset)] == "branch-" + str(cset):
-            print('creating new branch', hgbranch[str(cset)])
+            print 'creating new branch', hgbranch[str(cset)]
             os.system('git checkout -b %s %s' % (hgbranch[str(cset)], hgvers[parent]))
         else:
-            print('checking out branch', hgbranch[str(cset)])
+            print 'checking out branch', hgbranch[str(cset)]
             os.system('git checkout %s' % hgbranch[str(cset)])
 
     # merge
@@ -209,7 +209,7 @@ for cset in range(int(tip) + 1):
             otherbranch = hgbranch[mparent]
         else:
             otherbranch = hgbranch[parent]
-        print('merging', otherbranch, 'into', hgbranch[str(cset)])
+        print 'merging', otherbranch, 'into', hgbranch[str(cset)]
         os.system(getgitenv(user, date) + 'git merge --no-commit -s ours "" %s %s' % (hgbranch[str(cset)], otherbranch))
 
     # remove everything except .git and .hg directories
@@ -233,12 +233,12 @@ for cset in range(int(tip) + 1):
 
     # delete branch if not used anymore...
     if mparent and len(hgchildren[str(cset)]):
-        print("Deleting unused branch:", otherbranch)
+        print "Deleting unused branch:", otherbranch
         os.system('git branch -d %s' % otherbranch)
 
     # retrieve and record the version
     vvv = os.popen('git show --quiet --pretty=format:%H').read()
-    print('record', cset, '->', vvv)
+    print 'record', cset, '->', vvv
     hgvers[str(cset)] = vvv
 
 if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
@@ -247,7 +247,7 @@ if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
 # write the state for incrementals
 if state:
     if verbose:
-        print('Writing state')
+        print 'Writing state'
     f = open(state, 'w')
     pickle.dump(hgvers, f)