mirror of
https://github.com/git/git.git
synced 2024-10-30 05:47:53 +01:00
remote-helpers: cleanup more global variables
They don't need to be specified if they are not going to be set. Suggested-by: Dusty Phillips <dusty@linux.ca> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
670dda85d6
commit
641a2b5bee
2 changed files with 2 additions and 57 deletions
|
@ -178,11 +178,9 @@ class Parser:
|
||||||
return (committer, int(date), tz)
|
return (committer, int(date), tz)
|
||||||
|
|
||||||
def rev_to_mark(rev):
|
def rev_to_mark(rev):
|
||||||
global marks
|
|
||||||
return marks.from_rev(rev)
|
return marks.from_rev(rev)
|
||||||
|
|
||||||
def mark_to_rev(mark):
|
def mark_to_rev(mark):
|
||||||
global marks
|
|
||||||
return marks.to_rev(mark)
|
return marks.to_rev(mark)
|
||||||
|
|
||||||
def fixup_user(user):
|
def fixup_user(user):
|
||||||
|
@ -237,8 +235,6 @@ def get_filechanges(cur, prev):
|
||||||
return modified, removed
|
return modified, removed
|
||||||
|
|
||||||
def export_files(tree, files):
|
def export_files(tree, files):
|
||||||
global marks, filenodes
|
|
||||||
|
|
||||||
final = []
|
final = []
|
||||||
for path, fid in files.iteritems():
|
for path, fid in files.iteritems():
|
||||||
kind = tree.kind(fid)
|
kind = tree.kind(fid)
|
||||||
|
@ -280,8 +276,6 @@ def export_files(tree, files):
|
||||||
return final
|
return final
|
||||||
|
|
||||||
def export_branch(repo, name):
|
def export_branch(repo, name):
|
||||||
global prefix
|
|
||||||
|
|
||||||
ref = '%s/heads/%s' % (prefix, name)
|
ref = '%s/heads/%s' % (prefix, name)
|
||||||
tip = marks.get_tip(name)
|
tip = marks.get_tip(name)
|
||||||
|
|
||||||
|
@ -382,16 +376,12 @@ def export_branch(repo, name):
|
||||||
marks.set_tip(name, revid)
|
marks.set_tip(name, revid)
|
||||||
|
|
||||||
def export_tag(repo, name):
|
def export_tag(repo, name):
|
||||||
global tags, prefix
|
|
||||||
|
|
||||||
ref = '%s/tags/%s' % (prefix, name)
|
ref = '%s/tags/%s' % (prefix, name)
|
||||||
print "reset %s" % ref
|
print "reset %s" % ref
|
||||||
print "from :%u" % rev_to_mark(tags[name])
|
print "from :%u" % rev_to_mark(tags[name])
|
||||||
print
|
print
|
||||||
|
|
||||||
def do_import(parser):
|
def do_import(parser):
|
||||||
global dirname
|
|
||||||
|
|
||||||
repo = parser.repo
|
repo = parser.repo
|
||||||
path = os.path.join(dirname, 'marks-git')
|
path = os.path.join(dirname, 'marks-git')
|
||||||
|
|
||||||
|
@ -417,8 +407,6 @@ def do_import(parser):
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def parse_blob(parser):
|
def parse_blob(parser):
|
||||||
global blob_marks
|
|
||||||
|
|
||||||
parser.next()
|
parser.next()
|
||||||
mark = parser.get_mark()
|
mark = parser.get_mark()
|
||||||
parser.next()
|
parser.next()
|
||||||
|
@ -429,8 +417,6 @@ def parse_blob(parser):
|
||||||
class CustomTree():
|
class CustomTree():
|
||||||
|
|
||||||
def __init__(self, branch, revid, parents, files):
|
def __init__(self, branch, revid, parents, files):
|
||||||
global files_cache
|
|
||||||
|
|
||||||
self.updates = {}
|
self.updates = {}
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
|
|
||||||
|
@ -587,9 +573,6 @@ def c_style_unescape(string):
|
||||||
return string
|
return string
|
||||||
|
|
||||||
def parse_commit(parser):
|
def parse_commit(parser):
|
||||||
global marks, blob_marks, parsed_refs
|
|
||||||
global mode
|
|
||||||
|
|
||||||
parents = []
|
parents = []
|
||||||
|
|
||||||
ref = parser[1]
|
ref = parser[1]
|
||||||
|
@ -661,8 +644,6 @@ def parse_commit(parser):
|
||||||
marks.new_mark(revid, commit_mark)
|
marks.new_mark(revid, commit_mark)
|
||||||
|
|
||||||
def parse_reset(parser):
|
def parse_reset(parser):
|
||||||
global parsed_refs
|
|
||||||
|
|
||||||
ref = parser[1]
|
ref = parser[1]
|
||||||
parser.next()
|
parser.next()
|
||||||
|
|
||||||
|
@ -678,8 +659,6 @@ def parse_reset(parser):
|
||||||
parsed_refs[ref] = mark_to_rev(from_mark)
|
parsed_refs[ref] = mark_to_rev(from_mark)
|
||||||
|
|
||||||
def do_export(parser):
|
def do_export(parser):
|
||||||
global parsed_refs, dirname
|
|
||||||
|
|
||||||
parser.next()
|
parser.next()
|
||||||
|
|
||||||
for line in parser.each_block('done'):
|
for line in parser.each_block('done'):
|
||||||
|
@ -728,8 +707,6 @@ def do_export(parser):
|
||||||
print
|
print
|
||||||
|
|
||||||
def do_capabilities(parser):
|
def do_capabilities(parser):
|
||||||
global dirname
|
|
||||||
|
|
||||||
print "import"
|
print "import"
|
||||||
print "export"
|
print "export"
|
||||||
print "refspec refs/heads/*:%s/heads/*" % prefix
|
print "refspec refs/heads/*:%s/heads/*" % prefix
|
||||||
|
@ -747,8 +724,6 @@ def ref_is_valid(name):
|
||||||
return not True in [c in name for c in '~^: \\']
|
return not True in [c in name for c in '~^: \\']
|
||||||
|
|
||||||
def do_list(parser):
|
def do_list(parser):
|
||||||
global tags
|
|
||||||
|
|
||||||
master_branch = None
|
master_branch = None
|
||||||
|
|
||||||
for name in branches:
|
for name in branches:
|
||||||
|
@ -782,8 +757,6 @@ def clone(path, remote_branch):
|
||||||
return remote_branch.sprout(bdir, repository=repo)
|
return remote_branch.sprout(bdir, repository=repo)
|
||||||
|
|
||||||
def get_remote_branch(name):
|
def get_remote_branch(name):
|
||||||
global dirname, branches
|
|
||||||
|
|
||||||
remote_branch = bzrlib.branch.Branch.open(branches[name])
|
remote_branch = bzrlib.branch.Branch.open(branches[name])
|
||||||
if isinstance(remote_branch.user_transport, bzrlib.transport.local.LocalTransport):
|
if isinstance(remote_branch.user_transport, bzrlib.transport.local.LocalTransport):
|
||||||
return remote_branch
|
return remote_branch
|
||||||
|
@ -825,8 +798,6 @@ def find_branches(repo):
|
||||||
yield name, branch.base
|
yield name, branch.base
|
||||||
|
|
||||||
def get_repo(url, alias):
|
def get_repo(url, alias):
|
||||||
global dirname, peer, branches
|
|
||||||
|
|
||||||
normal_url = bzrlib.urlutils.normalize_url(url)
|
normal_url = bzrlib.urlutils.normalize_url(url)
|
||||||
origin = bzrlib.bzrdir.BzrDir.open(url)
|
origin = bzrlib.bzrdir.BzrDir.open(url)
|
||||||
is_local = isinstance(origin.transport, bzrlib.transport.local.LocalTransport)
|
is_local = isinstance(origin.transport, bzrlib.transport.local.LocalTransport)
|
||||||
|
|
|
@ -227,8 +227,6 @@ class Parser:
|
||||||
return sys.stdin.read(size)
|
return sys.stdin.read(size)
|
||||||
|
|
||||||
def get_author(self):
|
def get_author(self):
|
||||||
global bad_mail
|
|
||||||
|
|
||||||
ex = None
|
ex = None
|
||||||
m = RAW_AUTHOR_RE.match(self.line)
|
m = RAW_AUTHOR_RE.match(self.line)
|
||||||
if not m:
|
if not m:
|
||||||
|
@ -261,8 +259,6 @@ def fix_file_path(path):
|
||||||
return os.path.relpath(path, '/')
|
return os.path.relpath(path, '/')
|
||||||
|
|
||||||
def export_files(files):
|
def export_files(files):
|
||||||
global marks, filenodes
|
|
||||||
|
|
||||||
final = []
|
final = []
|
||||||
for f in files:
|
for f in files:
|
||||||
fid = node.hex(f.filenode())
|
fid = node.hex(f.filenode())
|
||||||
|
@ -344,8 +340,6 @@ def fixup_user_hg(user):
|
||||||
return (name, mail)
|
return (name, mail)
|
||||||
|
|
||||||
def fixup_user(user):
|
def fixup_user(user):
|
||||||
global mode, bad_mail
|
|
||||||
|
|
||||||
if mode == 'git':
|
if mode == 'git':
|
||||||
name, mail = fixup_user_git(user)
|
name, mail = fixup_user_git(user)
|
||||||
else:
|
else:
|
||||||
|
@ -374,7 +368,7 @@ def updatebookmarks(repo, peer):
|
||||||
bookmarks.write(repo)
|
bookmarks.write(repo)
|
||||||
|
|
||||||
def get_repo(url, alias):
|
def get_repo(url, alias):
|
||||||
global dirname, peer
|
global peer
|
||||||
|
|
||||||
myui = ui.ui()
|
myui = ui.ui()
|
||||||
myui.setconfig('ui', 'interactive', 'off')
|
myui.setconfig('ui', 'interactive', 'off')
|
||||||
|
@ -416,16 +410,12 @@ def get_repo(url, alias):
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
def rev_to_mark(rev):
|
def rev_to_mark(rev):
|
||||||
global marks
|
|
||||||
return marks.from_rev(rev.hex())
|
return marks.from_rev(rev.hex())
|
||||||
|
|
||||||
def mark_to_rev(mark):
|
def mark_to_rev(mark):
|
||||||
global marks
|
|
||||||
return marks.to_rev(mark)
|
return marks.to_rev(mark)
|
||||||
|
|
||||||
def export_ref(repo, name, kind, head):
|
def export_ref(repo, name, kind, head):
|
||||||
global prefix, marks, mode
|
|
||||||
|
|
||||||
ename = '%s/%s' % (kind, name)
|
ename = '%s/%s' % (kind, name)
|
||||||
try:
|
try:
|
||||||
tip = marks.get_tip(ename)
|
tip = marks.get_tip(ename)
|
||||||
|
@ -537,12 +527,9 @@ def export_branch(repo, branch):
|
||||||
export_ref(repo, branch, 'branches', head)
|
export_ref(repo, branch, 'branches', head)
|
||||||
|
|
||||||
def export_head(repo):
|
def export_head(repo):
|
||||||
global g_head
|
|
||||||
export_ref(repo, g_head[0], 'bookmarks', g_head[1])
|
export_ref(repo, g_head[0], 'bookmarks', g_head[1])
|
||||||
|
|
||||||
def do_capabilities(parser):
|
def do_capabilities(parser):
|
||||||
global prefix, dirname
|
|
||||||
|
|
||||||
print "import"
|
print "import"
|
||||||
print "export"
|
print "export"
|
||||||
print "refspec refs/heads/branches/*:%s/branches/*" % prefix
|
print "refspec refs/heads/branches/*:%s/branches/*" % prefix
|
||||||
|
@ -562,8 +549,6 @@ def branch_tip(branch):
|
||||||
return branches[branch][-1]
|
return branches[branch][-1]
|
||||||
|
|
||||||
def get_branch_tip(repo, branch):
|
def get_branch_tip(repo, branch):
|
||||||
global branches
|
|
||||||
|
|
||||||
heads = branches.get(hgref(branch), None)
|
heads = branches.get(hgref(branch), None)
|
||||||
if not heads:
|
if not heads:
|
||||||
return None
|
return None
|
||||||
|
@ -576,7 +561,7 @@ def get_branch_tip(repo, branch):
|
||||||
return heads[0]
|
return heads[0]
|
||||||
|
|
||||||
def list_head(repo, cur):
|
def list_head(repo, cur):
|
||||||
global g_head, bmarks, fake_bmark
|
global g_head, fake_bmark
|
||||||
|
|
||||||
if 'default' not in branches:
|
if 'default' not in branches:
|
||||||
# empty repo
|
# empty repo
|
||||||
|
@ -592,8 +577,6 @@ def list_head(repo, cur):
|
||||||
g_head = (head, node)
|
g_head = (head, node)
|
||||||
|
|
||||||
def do_list(parser):
|
def do_list(parser):
|
||||||
global branches, bmarks, track_branches
|
|
||||||
|
|
||||||
repo = parser.repo
|
repo = parser.repo
|
||||||
for bmark, node in bookmarks.listbookmarks(repo).iteritems():
|
for bmark, node in bookmarks.listbookmarks(repo).iteritems():
|
||||||
bmarks[bmark] = repo[node]
|
bmarks[bmark] = repo[node]
|
||||||
|
@ -661,8 +644,6 @@ def do_import(parser):
|
||||||
print 'done'
|
print 'done'
|
||||||
|
|
||||||
def parse_blob(parser):
|
def parse_blob(parser):
|
||||||
global blob_marks
|
|
||||||
|
|
||||||
parser.next()
|
parser.next()
|
||||||
mark = parser.get_mark()
|
mark = parser.get_mark()
|
||||||
parser.next()
|
parser.next()
|
||||||
|
@ -679,9 +660,6 @@ def get_merge_files(repo, p1, p2, files):
|
||||||
files[e] = f
|
files[e] = f
|
||||||
|
|
||||||
def parse_commit(parser):
|
def parse_commit(parser):
|
||||||
global marks, blob_marks, parsed_refs
|
|
||||||
global mode
|
|
||||||
|
|
||||||
from_mark = merge_mark = None
|
from_mark = merge_mark = None
|
||||||
|
|
||||||
ref = parser[1]
|
ref = parser[1]
|
||||||
|
@ -799,8 +777,6 @@ def parse_commit(parser):
|
||||||
marks.new_mark(node, commit_mark)
|
marks.new_mark(node, commit_mark)
|
||||||
|
|
||||||
def parse_reset(parser):
|
def parse_reset(parser):
|
||||||
global parsed_refs
|
|
||||||
|
|
||||||
ref = parser[1]
|
ref = parser[1]
|
||||||
parser.next()
|
parser.next()
|
||||||
# ugh
|
# ugh
|
||||||
|
@ -993,8 +969,6 @@ def check_tip(ref, kind, name, heads):
|
||||||
return tip in heads
|
return tip in heads
|
||||||
|
|
||||||
def do_export(parser):
|
def do_export(parser):
|
||||||
global parsed_refs, bmarks, peer
|
|
||||||
|
|
||||||
p_bmarks = []
|
p_bmarks = []
|
||||||
p_revs = {}
|
p_revs = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue