[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Nov 29 20:36:29 PST 2016
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/1c398305825c/
Changeset: 1c398305825c
Branch: yt
User: ngoldbaum
Date: 2016-11-29 22:26:46+00:00
Summary: Interact with mercurial repositories using hglib context manager.
This ensures we do not leave orphan mercurial processes running after
interacting with a repository.
Affected #: 2 files
diff -r 0bfebdb21e22a03f91a11dff8d455ee17e885e92 -r 1c398305825c3dc664f7ea009f526dbdc5825afe doc/helper_scripts/generate_doap.py
--- a/doc/helper_scripts/generate_doap.py
+++ b/doc/helper_scripts/generate_doap.py
@@ -75,47 +75,47 @@
lastname_sort = lambda a: a.rsplit(None, 1)[-1]
def get_release_tags():
- c = hglib.open(yt_path)
- releases = {}
- for name, rev, node, islocal in c.tags():
- if name.startswith("yt-"):
- releases[name] = node
- rr = []
- for name, node in sorted(releases.items()):
- date = c.log(node)[-1][-1]
- rr.append((date, name[3:]))
+ with hglib.open(yt_path) as c:
+ releases = {}
+ for name, rev, node, islocal in c.tags():
+ if name.startswith("yt-"):
+ releases[name] = node
+ rr = []
+ for name, node in sorted(releases.items()):
+ date = c.log(node)[-1][-1]
+ rr.append((date, name[3:]))
rr.sort()
return [(_[1], _[0].strftime("%Y-%M-%d")) for _ in rr]
def developer_names():
cmd = hglib.util.cmdbuilder("churn", "-c")
- c = hglib.open(yt_path)
- emails = set([])
- for dev in c.rawcommand(cmd).split("\n"):
- if len(dev.strip()) == 0: continue
- emails.add(dev.rsplit(None, 2)[0])
- print("Generating real names for {0} emails".format(len(emails)))
- names = set([])
- for email in sorted(emails):
- if email in name_ignores:
- continue
- if email in name_mappings:
- names.add(name_mappings[email])
- continue
- cset = c.log(revrange="last(author('%s'))" % email)
- if len(cset) == 0:
- print("Error finding {0}".format(email))
- realname = email
- else:
- realname, addr = parseaddr(cset[0][4])
- if realname == '':
- realname = email
- if realname in name_mappings:
- names.add(name_mappings[realname])
- continue
- realname = realname.decode('utf-8')
- realname = realname.encode('ascii', 'xmlcharrefreplace')
- names.add(realname)
+ with hglib.open(yt_path) as c:
+ emails = set([])
+ for dev in c.rawcommand(cmd).split("\n"):
+ if len(dev.strip()) == 0: continue
+ emails.add(dev.rsplit(None, 2)[0])
+ print("Generating real names for {0} emails".format(len(emails)))
+ names = set([])
+ for email in sorted(emails):
+ if email in name_ignores:
+ continue
+ if email in name_mappings:
+ names.add(name_mappings[email])
+ continue
+ cset = c.log(revrange="last(author('%s'))" % email)
+ if len(cset) == 0:
+ print("Error finding {0}".format(email))
+ realname = email
+ else:
+ realname, addr = parseaddr(cset[0][4])
+ if realname == '':
+ realname = email
+ if realname in name_mappings:
+ names.add(name_mappings[realname])
+ continue
+ realname = realname.decode('utf-8')
+ realname = realname.encode('ascii', 'xmlcharrefreplace')
+ names.add(realname)
#with open("devs.txt", "w") as f:
# for name in sorted(names, key=lastname_sort):
# f.write("%s\n" % name)
diff -r 0bfebdb21e22a03f91a11dff8d455ee17e885e92 -r 1c398305825c3dc664f7ea009f526dbdc5825afe yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -519,33 +519,34 @@
print("Try: pip install python-hglib")
return -1
f = open(os.path.join(path, "yt_updater.log"), "a")
- repo = hglib.open(path)
- repo.pull()
- ident = repo.identify().decode("utf-8")
- if "+" in ident:
- print("Can't rebuild modules by myself.")
- print("You will have to do this yourself. Here's a sample commands:")
- print("")
- print(" $ cd %s" % (path))
- print(" $ hg up")
- print(" $ %s setup.py develop" % (sys.executable))
- return 1
- print("Updating the repository")
- f.write("Updating the repository\n\n")
- repo.update(check=True)
- f.write("Updated from %s to %s\n\n" % (ident, repo.identify()))
- if skip_rebuild: return
- f.write("Rebuilding modules\n\n")
- p = subprocess.Popen([sys.executable, "setup.py", "build_ext", "-i"], cwd=path,
- stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
- stdout, stderr = p.communicate()
- f.write(stdout.decode('utf-8'))
- f.write("\n\n")
- if p.returncode:
- print("BROKEN: See %s" % (os.path.join(path, "yt_updater.log")))
- sys.exit(1)
- f.write("Successful!\n")
- print("Updated successfully.")
+ with hglib.open(path) as repo:
+ repo.pull()
+ ident = repo.identify().decode("utf-8")
+ if "+" in ident:
+ print("Can't rebuild modules by myself.")
+ print("You will have to do this yourself. Here's a sample commands:")
+ print("")
+ print(" $ cd %s" % (path))
+ print(" $ hg up")
+ print(" $ %s setup.py develop" % (sys.executable))
+ return 1
+ print("Updating the repository")
+ f.write("Updating the repository\n\n")
+ repo.update(check=True)
+ f.write("Updated from %s to %s\n\n" % (ident, repo.identify()))
+ if skip_rebuild: return
+ f.write("Rebuilding modules\n\n")
+ p = subprocess.Popen([sys.executable, "setup.py", "build_ext", "-i"],
+ cwd=path, stdout = subprocess.PIPE,
+ stderr = subprocess.STDOUT)
+ stdout, stderr = p.communicate()
+ f.write(stdout.decode('utf-8'))
+ f.write("\n\n")
+ if p.returncode:
+ print("BROKEN: See %s" % (os.path.join(path, "yt_updater.log")))
+ sys.exit(1)
+ f.write("Successful!\n")
+ print("Updated successfully.")
def get_hg_version(path):
try:
@@ -556,8 +557,8 @@
print("Try: pip install python-hglib")
return None
try:
- repo = hglib.open(path)
- return repo.identify()
+ with hglib.open(path) as repo:
+ return repo.identify()
except hglib.error.ServerError:
# path is not an hg repository
return None
https://bitbucket.org/yt_analysis/yt/commits/1c3b1ee85942/
Changeset: 1c3b1ee85942
Branch: yt
User: xarthisius
Date: 2016-11-30 04:36:00+00:00
Summary: Merged in ngoldbaum/yt (pull request #2449)
Interact with mercurial repositories using hglib context manager.
Affected #: 2 files
diff -r 96882803a599e1a52ed4bb47a919970b76628efd -r 1c3b1ee859420671a78a52e0d964026f0be3a068 doc/helper_scripts/generate_doap.py
--- a/doc/helper_scripts/generate_doap.py
+++ b/doc/helper_scripts/generate_doap.py
@@ -75,47 +75,47 @@
lastname_sort = lambda a: a.rsplit(None, 1)[-1]
def get_release_tags():
- c = hglib.open(yt_path)
- releases = {}
- for name, rev, node, islocal in c.tags():
- if name.startswith("yt-"):
- releases[name] = node
- rr = []
- for name, node in sorted(releases.items()):
- date = c.log(node)[-1][-1]
- rr.append((date, name[3:]))
+ with hglib.open(yt_path) as c:
+ releases = {}
+ for name, rev, node, islocal in c.tags():
+ if name.startswith("yt-"):
+ releases[name] = node
+ rr = []
+ for name, node in sorted(releases.items()):
+ date = c.log(node)[-1][-1]
+ rr.append((date, name[3:]))
rr.sort()
return [(_[1], _[0].strftime("%Y-%M-%d")) for _ in rr]
def developer_names():
cmd = hglib.util.cmdbuilder("churn", "-c")
- c = hglib.open(yt_path)
- emails = set([])
- for dev in c.rawcommand(cmd).split("\n"):
- if len(dev.strip()) == 0: continue
- emails.add(dev.rsplit(None, 2)[0])
- print("Generating real names for {0} emails".format(len(emails)))
- names = set([])
- for email in sorted(emails):
- if email in name_ignores:
- continue
- if email in name_mappings:
- names.add(name_mappings[email])
- continue
- cset = c.log(revrange="last(author('%s'))" % email)
- if len(cset) == 0:
- print("Error finding {0}".format(email))
- realname = email
- else:
- realname, addr = parseaddr(cset[0][4])
- if realname == '':
- realname = email
- if realname in name_mappings:
- names.add(name_mappings[realname])
- continue
- realname = realname.decode('utf-8')
- realname = realname.encode('ascii', 'xmlcharrefreplace')
- names.add(realname)
+ with hglib.open(yt_path) as c:
+ emails = set([])
+ for dev in c.rawcommand(cmd).split("\n"):
+ if len(dev.strip()) == 0: continue
+ emails.add(dev.rsplit(None, 2)[0])
+ print("Generating real names for {0} emails".format(len(emails)))
+ names = set([])
+ for email in sorted(emails):
+ if email in name_ignores:
+ continue
+ if email in name_mappings:
+ names.add(name_mappings[email])
+ continue
+ cset = c.log(revrange="last(author('%s'))" % email)
+ if len(cset) == 0:
+ print("Error finding {0}".format(email))
+ realname = email
+ else:
+ realname, addr = parseaddr(cset[0][4])
+ if realname == '':
+ realname = email
+ if realname in name_mappings:
+ names.add(name_mappings[realname])
+ continue
+ realname = realname.decode('utf-8')
+ realname = realname.encode('ascii', 'xmlcharrefreplace')
+ names.add(realname)
#with open("devs.txt", "w") as f:
# for name in sorted(names, key=lastname_sort):
# f.write("%s\n" % name)
diff -r 96882803a599e1a52ed4bb47a919970b76628efd -r 1c3b1ee859420671a78a52e0d964026f0be3a068 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -519,33 +519,34 @@
print("Try: pip install python-hglib")
return -1
f = open(os.path.join(path, "yt_updater.log"), "a")
- repo = hglib.open(path)
- repo.pull()
- ident = repo.identify().decode("utf-8")
- if "+" in ident:
- print("Can't rebuild modules by myself.")
- print("You will have to do this yourself. Here's a sample commands:")
- print("")
- print(" $ cd %s" % (path))
- print(" $ hg up")
- print(" $ %s setup.py develop" % (sys.executable))
- return 1
- print("Updating the repository")
- f.write("Updating the repository\n\n")
- repo.update(check=True)
- f.write("Updated from %s to %s\n\n" % (ident, repo.identify()))
- if skip_rebuild: return
- f.write("Rebuilding modules\n\n")
- p = subprocess.Popen([sys.executable, "setup.py", "build_ext", "-i"], cwd=path,
- stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
- stdout, stderr = p.communicate()
- f.write(stdout.decode('utf-8'))
- f.write("\n\n")
- if p.returncode:
- print("BROKEN: See %s" % (os.path.join(path, "yt_updater.log")))
- sys.exit(1)
- f.write("Successful!\n")
- print("Updated successfully.")
+ with hglib.open(path) as repo:
+ repo.pull()
+ ident = repo.identify().decode("utf-8")
+ if "+" in ident:
+ print("Can't rebuild modules by myself.")
+ print("You will have to do this yourself. Here's a sample commands:")
+ print("")
+ print(" $ cd %s" % (path))
+ print(" $ hg up")
+ print(" $ %s setup.py develop" % (sys.executable))
+ return 1
+ print("Updating the repository")
+ f.write("Updating the repository\n\n")
+ repo.update(check=True)
+ f.write("Updated from %s to %s\n\n" % (ident, repo.identify()))
+ if skip_rebuild: return
+ f.write("Rebuilding modules\n\n")
+ p = subprocess.Popen([sys.executable, "setup.py", "build_ext", "-i"],
+ cwd=path, stdout = subprocess.PIPE,
+ stderr = subprocess.STDOUT)
+ stdout, stderr = p.communicate()
+ f.write(stdout.decode('utf-8'))
+ f.write("\n\n")
+ if p.returncode:
+ print("BROKEN: See %s" % (os.path.join(path, "yt_updater.log")))
+ sys.exit(1)
+ f.write("Successful!\n")
+ print("Updated successfully.")
def get_hg_version(path):
try:
@@ -556,8 +557,8 @@
print("Try: pip install python-hglib")
return None
try:
- repo = hglib.open(path)
- return repo.identify()
+ with hglib.open(path) as repo:
+ return repo.identify()
except hglib.error.ServerError:
# path is not an hg repository
return None
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list