rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
cmdclass = { 'install_data' : install_package_data, 'py2exe' : py2exe_for_demandload}, | cmdclass=cmdclass, | def finalize_options(self): self.set_undefined_options('install', ('install_lib', 'install_dir')) install_data.finalize_options(self) |
f = os.popen("lsdiff --strip %d %s" % (strip, pf)) files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) | f = os.popen("patch -p%d < %s" % (strip, pf)) files = [] for l in f.read().splitlines(): l.rstrip('\r\n'); if not quiet: print l if l[:14] == 'patching file ': files.append(l[14:]) | def patch(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" try: import psyco psyco.full() except: pass patches = (patch1,) + patches d = opts["base"] strip = opts["strip"] quiet = opts["quiet"] and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.jo... |
if files: if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): raise "patch failed!" | if len(files) > 0: addremove(ui, repo, *files) | def patch(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" try: import psyco psyco.full() except: pass patches = (patch1,) + patches d = opts["base"] strip = opts["strip"] quiet = opts["quiet"] and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.jo... |
% (hex(n), f)) | % (hex(node), f)) | def verify(self): filelinkrevs = {} filenodes = {} changesets = revisions = files = 0 errors = 0 |
import zipfile | import zipfile, tempfile tmp = tempfile.mkstemp()[1] | def archive(self, req, cnode, type): cs = self.repo.changelog.read(cnode) mnode = cs[0] mf = self.repo.manifest.read(mnode) rev = self.repo.manifest.rev(mnode) reponame = re.sub(r"\W+", "-", self.reponame) name = "%s-%s/" % (reponame, short(cnode)) |
tmp = tempfile.mkstemp()[1] | def archive(self, req, cnode, type): cs = self.repo.changelog.read(cnode) mnode = cs[0] mf = self.repo.manifest.read(mnode) rev = self.repo.manifest.rev(mnode) reponame = re.sub(r"\W+", "-", self.reponame) name = "%s-%s/" % (reponame, short(cnode)) | |
'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', 'x-bzip2'), 'gz': ('application/x-tar', 'tgz', '.tar.gz', 'x-gzip'), | 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None), 'gz': ('application/x-tar', 'tgz', '.tar.gz', None), | def diff(**map): yield self.diff(p1, n, [file]) |
e = r.index[i] ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) if e[5] != nullid: ui.write("\t%d -> %d\n" % (r.rev(e[5]), i)) | node = r.node(i) pp = r.parents(node) ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) if pp[1] != nullid: ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) | def debugindexdot(ui, file_): """dump an index DAG as a .dot file""" r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) ui.write("digraph G {\n") for i in range(r.count()): e = r.index[i] ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) if e[5] != nullid: ui.write("\t%d -> %d\n" % (r.rev(e[5]), i)) ui.wr... |
series.append(file_) | else: series.append(file_) | def restore(self, repo, rev, delete=None, qupdate=None): c = repo.changelog.read(rev) desc = c[4].strip() lines = desc.splitlines() i = 0 datastart = None series = [] applied = [] qpp = None for i in xrange(0, len(lines)): if lines[i] == 'Patch Data:': datastart = i + 1 elif lines[i].startswith('Dirstate:'): l = lines[... |
self.sio = cmdutil.stringio() | def __init__(self, ui, repo, hooktype): self.ui = ui cfg = self.ui.config('notify', 'config') if cfg: self.ui.readsections(cfg, 'usersubs', 'reposubs') self.repo = repo self.stripcount = int(self.ui.config('notify', 'strip', 0)) self.root = self.strip(self.repo.root) self.domain = self.ui.config('notify', 'domain') sel... | |
self.t = cmdutil.changeset_templater(self.ui, self.repo, mapfile, self.sio) | self.t = cmdutil.changeset_templater(self.ui, self.repo, False, None, mapfile, False) | def __init__(self, ui, repo, hooktype): self.ui = ui cfg = self.ui.config('notify', 'config') if cfg: self.ui.readsections(cfg, 'usersubs', 'reposubs') self.repo = repo self.stripcount = int(self.ui.config('notify', 'strip', 0)) self.root = self.strip(self.repo.root) self.domain = self.ui.config('notify', 'domain') sel... |
def send(self, node, count): | def send(self, node, count, data): | def send(self, node, count): '''send message.''' |
self.sio.seek(0) msg = p.parse(self.sio) | msg = p.parsestr(data) | def send(self, node, count): '''send message.''' |
fp = cmdutil.stringio() | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = cmdutil.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) if self.ui.configbool('notify', 'diffstat', True): s = patch.diff... | |
patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) | self.ui.pushbuffer() patch.diff(self.repo, prev, ref) difflines = self.ui.popbuffer().splitlines(1) | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = cmdutil.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) if self.ui.configbool('notify', 'diffstat', True): s = patch.diff... |
self.sio.write('\ndiffstat:\n\n' + s) | self.ui.write('\ndiffstat:\n\n' + s) | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = cmdutil.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) if self.ui.configbool('notify', 'diffstat', True): s = patch.diff... |
self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') % (len(difflines), maxdiff)) | self.ui.write(_('\ndiffs (truncated from %d to %d lines):\n\n') % (len(difflines), maxdiff)) | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = cmdutil.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) if self.ui.configbool('notify', 'diffstat', True): s = patch.diff... |
self.sio.write(_('\ndiffs (%d lines):\n\n') % len(difflines)) self.sio.write(*difflines) | self.ui.write(_('\ndiffs (%d lines):\n\n') % len(difflines)) self.ui.write(*difflines) | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = cmdutil.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, prev, ref, fp=fp) difflines = fp.getvalue().splitlines(1) if self.ui.configbool('notify', 'diffstat', True): s = patch.diff... |
while path and count >= 0: | while count > 0: | def strip(self, path): '''strip leading slashes from local path, turn into web-safe path.''' |
def __init__(self, opener): | def __init__(self, opener, ui): | def __init__(self, opener): self.opener = opener self.dirty = 0 self.map = None |
try: del self.map[f] except KeyError: pass | try: del self.map[f] except KeyError: self.ui.warn("Not in dircache: %s\n" % f) pass | def remove(self, files): if not files: return self.read() self.dirty = 1 for f in files: try: del self.map[f] except KeyError: pass |
self.dircache = dircache(self.opener) | self.dircache = dircache(self.opener, ui) | def __init__(self, ui, path=None, create=0): self.remote = 0 if path and path[:7] == "http://": self.remote = 1 self.path = path else: if not path: p = os.getcwd() while not os.path.isdir(os.path.join(p, ".hg")): p = os.path.dirname(p) if p == "/": raise "No repo found" path = p self.path = os.path.join(path, ".hg") |
if not opts['test']: | if not opts['test'] and not opts['mbox']: | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] |
ui.status('Sending ', m['Subject'], ' ...\n') | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] | |
"Expected output", "Test output", lineterm=''): | "Expected output", "Test output"): | def show_diff(expected, output): for line in difflib.unified_diff(expected, output, "Expected output", "Test output", lineterm=''): sys.stdout.write(line) |
body += '\n'.join(patch) msg = email.MIMEText.MIMEText(body) | if opts['attach']: msg = email.MIMEMultipart.MIMEMultipart() if body: msg.attach(email.MIMEText.MIMEText(body, 'plain')) msg.attach(email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')) else: body += '\n'.join(patch) msg = email.MIMEText.MIMEText(body) | def makepatch(patch, idx, total): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r'): break desc.append(line) if not node: raise ValueError |
[('', 'bcc', [], 'email addresses of blind copy recipients'), | [('a', 'attach', None, 'send patches as inline attachments'), ('', 'bcc', [], 'email addresses of blind copy recipients'), | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('email', opt) or ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] |
self.listcache = text.splitlines(1) for l in self.listcache: | self.listcache = (text, text.splitlines(1)) for l in self.listcache[1]: | def read(self, node): if self.mapcache and self.mapcache[0] == node: return self.mapcache[1] text = self.revision(node) map = {} self.listcache = text.splitlines(1) for l in self.listcache: (f, n) = l.split('\0') map[f] = bin(n[:40]) self.mapcache = (node, map) return map |
if self.listcache: return mdiff.diff(self.listcache, self.addlist, 1) | if self.listcache and len(self.listcache[0]) == len(a): return mdiff.diff(self.listcache[1], self.addlist, 1) | def diff(self, a, b): # this is sneaky, as we're not actually using a and b if self.listcache: return mdiff.diff(self.listcache, self.addlist, 1) else: return mdiff.diff(a, b) |
self.listcache = self.addlist | self.listcache = (text, self.addlist) | def add(self, map, transaction, link, p1=None, p2=None): files = map.keys() files.sort() |
edittext += "".join(["HG: removed %s\n" % f for f in remove]) | def lseq(l): for r in l: yield r | |
try: sys.stdout.flush() finally: sys.stderr.flush() | try: sys.stdout.flush() except: pass try: sys.stderr.flush() except: pass | def flush(self): try: sys.stdout.flush() finally: sys.stderr.flush() |
print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]), hg.hex(mmap2[f]), f, f) | print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]), hg.short(mmap2[f]), f, f) | def read(f): return file(os.path.join(repo.root, f)).read() |
print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f) | print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.short(mmap2[f]), f, f) | def read(f): return file(os.path.join(repo.root, f)).read() |
print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f) | print ":100664 000000 %s %s D\t%s\t%s" % (hg.short(mmap[f]), empty, f, f) | def read(f): return file(os.path.join(repo.root, f)).read() |
(h, h1, h2) = map(hg.hex, (n, p1, p2)) | (h, h1, h2) = map(hg.short, (n, p1, p2)) | def catcommit(repo, n, prefix, changes=None): nlprefix = '\n' + prefix; (p1, p2) = repo.changelog.parents(n) (h, h1, h2) = map(hg.hex, (n, p1, p2)) (i1, i2) = map(repo.changelog.rev, (p1, p2)) if not changes: changes = repo.changelog.read(n) print "tree %s" % (hg.hex(changes[0])) if i1 != -1: print "parent %s" % (h1) i... |
print "tree %s" % (hg.hex(changes[0])) | print "tree %s" % (hg.short(changes[0])) | def catcommit(repo, n, prefix, changes=None): nlprefix = '\n' + prefix; (p1, p2) = repo.changelog.parents(n) (h, h1, h2) = map(hg.hex, (n, p1, p2)) (i1, i2) = map(repo.changelog.rev, (p1, p2)) if not changes: changes = repo.changelog.read(n) print "tree %s" % (hg.hex(changes[0])) if i1 != -1: print "parent %s" % (h1) i... |
print hg.hex(n) | print hg.short(n) | def base(ui, repo, node1, node2): """Output common ancestor information""" node1 = repo.lookup(node1) node2 = repo.lookup(node2) n = repo.changelog.ancestor(node1, node2) print hg.hex(n) |
parentstr += " " + hg.hex(pp[0]) | parentstr += " " + hg.short(pp[0]) | def is_reachable(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in range(len(ar)): if sha in reachable[i]: mask |= 1 << i |
parentstr += " " + hg.hex(pp[1]) | parentstr += " " + hg.short(pp[1]) | def is_reachable(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in range(len(ar)): if sha in reachable[i]: mask |= 1 << i |
print hg.hex(n) + parentstr | print hg.short(n) + parentstr | def is_reachable(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in range(len(ar)): if sha in reachable[i]: mask |= 1 << i |
(h, h1, h2) = map(hg.hex, (n, p1, p2)) | (h, h1, h2) = map(hg.short, (n, p1, p2)) | def is_reachable(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in range(len(ar)): if sha in reachable[i]: mask |= 1 << i |
visit.extend(parents) | for p in parents: if p not in seen: seen.add(p) visit.append(p) | def bundle(ui, repo, fname, dest=None, **opts): """create a changegroup file Generate a compressed changegroup file collecting changesets not found in the other repository. If no destination repository is specified the destination is assumed to have all the nodes specified by one or more --base parameters. The bundl... |
self.offset = 0 | self.offset = fp.tell() | def __init__(self, fp): fd, self.tmpname = tempfile.mkstemp() self.tmpfp = os.fdopen(fd, 'ab+') self.realfp = fp self.offset = 0 # real file is not written by anyone else. cache its size so # seek and read can be fast. self.fpsize = os.fstat(fp.fileno()).st_size |
commands.addremove_lock(self.ui, repo, files, | cwd = repo.getcwd() cfiles = files if cwd: cfiles = [util.pathto(cwd, f) for f in files] commands.addremove_lock(self.ui, repo, cfiles, | def apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, wlock=None): # TODO unify with commands.py if not patchdir: patchdir = self.path err = 0 if not wlock: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction() n = None for patch in series: self.ui.warn("applyi... |
diffre = re.compile(r'(?:diff -|--- .*\s+\w+ \w+ +\d+ \d+:\d+:\d+ \d+)') | diffre = re.compile(r'(?:Index:[ \t]|diff[ \t]|RCS file: |' + 'retrieving revision [0-9]+(\.[0-9]+)*$|' + '(---|\*\*\*)[ \t])') | def import_(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" patches = (patch1,) + patches if not opts['force']: (c, a, d, u) = repo.changes() if c or a or d: raise util.Abort("outstanding uncommitted changes") d = opts["base"] strip = opts["strip"] mailre = re.compile(r'(?:From |[\w-]+:)'... |
return cwd[len(self.root) + 1:] | common_prefix_len = len(self.root) if not self.root.endswith(os.sep): common_prefix_len += 1 return cwd[common_prefix_len:] | def getcwd(self): cwd = os.getcwd() if cwd == self.root: return '' return cwd[len(self.root) + 1:] |
if p[:7] == "http://": return httprangereader(f) | def o(path, mode="r"): f = os.path.join(p, path) if p[:7] == "http://": return httprangereader(f) | |
if not opts['pull'] and other.dev() != -1: | if other.dev() != -1: | def __del__(self): if self.dir_: self.rmtree(self.dir_, True) |
copy = True | if not opts['pull']: copy = True | def __del__(self): if self.dir_: self.rmtree(self.dir_, True) |
def expand(e1, e2, a1, a2): ne = [] for n in e1: (p1, p2) = self.parents(n) if p1 in a2: return p1 if p2 in a2: return p2 if p1 != nullid and p1 not in a1: a1[p1] = 1 ne.append(p1) if p2 != nullid and p2 not in a1: a1[p2] = 1 ne.append(p2) return expand(e2, ne, a2, a1) return expand([a], [b], {a:1}, {b:1}) | def expand(list, map): a = [] while list: n = list.pop(0) map[n] = 1 yield n for p in self.parents(n): if p != nullid and p not in map: list.append(p) yield nullid amap = {} bmap = {} ag = expand([a], amap) bg = expand([b], bmap) adone = bdone = 0 while not adone or not bdone: if not adone: an = ag.next() if an == nu... | def expand(e1, e2, a1, a2): ne = [] for n in e1: (p1, p2) = self.parents(n) if p1 in a2: return p1 if p2 in a2: return p2 if p1 != nullid and p1 not in a1: a1[p1] = 1 ne.append(p1) if p2 != nullid and p2 not in a1: a1[p2] = 1 ne.append(p2) return expand(e2, ne, a2, a1) |
if not node1 or node1 == self.dirstate.parents()[0]: | if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): | def mfmatches(node): change = self.changelog.read(node) mf = dict(self.manifest.read(change[0])) for fn in mf.keys(): if not match(fn): del mf[fn] return mf |
for f in "templates/map", "../templates/map": | for f in "templates", "../templates": | def templatepath(): for f in "templates/map", "../templates/map": p = os.path.join(os.path.dirname(__file__), f) if os.path.isfile(p): return p |
if os.path.isfile(p): return p | if os.path.isdir(p): return p | def templatepath(): for f in "templates/map", "../templates/map": p = os.path.join(os.path.dirname(__file__), f) if os.path.isfile(p): return p |
return text.replace('\n', '<br/>') | return text.replace('\n', '<br/>\n') | def nl2br(text): return text.replace('\n', '<br/>') |
def template(tmpl, **map): | def template(tmpl, filters = {}, **map): | def template(tmpl, **map): while tmpl: m = re.search(r"#([a-zA-Z0-9]+)#", tmpl) if m: yield tmpl[:m.start(0)] v = map.get(m.group(1), "") yield callable(v) and v() or v tmpl = tmpl[m.end(0):] else: yield tmpl return |
yield callable(v) and v() or v | v = callable(v) and v() or v fl = m.group(2) if fl: for f in fl.split("|")[1:]: v = filters[f](v) yield v | def template(tmpl, **map): while tmpl: m = re.search(r"#([a-zA-Z0-9]+)#", tmpl) if m: yield tmpl[:m.start(0)] v = map.get(m.group(1), "") yield callable(v) and v() or v tmpl = tmpl[m.end(0):] else: yield tmpl return |
def __init__(self, mapfile): | def __init__(self, mapfile, filters = {}): | def __init__(self, mapfile): self.cache = {} self.map = {} self.base = os.path.dirname(mapfile) for l in file(mapfile): m = re.match(r'(\S+)\s*=\s*"(.*)"$', l) if m: self.cache[m.group(1)] = m.group(2) else: m = re.match(r'(\S+)\s*=\s*(\S+)', l) if m: self.map[m.group(1)] = os.path.join(self.base, m.group(2)) else: ra... |
return template(tmpl, **map) | return template(tmpl, self.filters, **map) | def __call__(self, t, **map): try: tmpl = self.cache[t] except KeyError: tmpl = self.cache[t] = file(self.map[t]).read() return template(tmpl, **map) |
def __init__(self, path, name, templatemap = ""): templatemap = templatemap or templatepath() | def __init__(self, path, name, templates = ""): self.templates = templates or templatepath() | def __init__(self, path, name, templatemap = ""): templatemap = templatemap or templatepath() |
self.t = templater(templatemap) | def __init__(self, path, name, templatemap = ""): templatemap = templatemap or templatepath() | |
line = cgi.escape(l) if line.startswith('+'): yield self.t("difflineplus", line = line) elif line.startswith('-'): yield self.t("difflineminus", line = line) elif line.startswith('@'): yield self.t("difflineat", line = line) | if l.startswith('+'): yield self.t("difflineplus", line = l) elif l.startswith('-'): yield self.t("difflineminus", line = l) elif l.startswith('@'): yield self.t("difflineat", line = l) | def prettyprintlines(diff): for l in diff.splitlines(1): line = cgi.escape(l) if line.startswith('+'): yield self.t("difflineplus", line = line) elif line.startswith('-'): yield self.t("difflineminus", line = line) elif line.startswith('@'): yield self.t("difflineat", line = line) else: yield self.t("diffline", line = ... |
yield self.t("diffline", line = line) | yield self.t("diffline", line = l) | def prettyprintlines(diff): for l in diff.splitlines(1): line = cgi.escape(l) if line.startswith('+'): yield self.t("difflineplus", line = line) elif line.startswith('-'): yield self.t("difflineminus", line = line) elif line.startswith('@'): yield self.t("difflineat", line = line) else: yield self.t("diffline", line = ... |
author = obfuscate(changes[1]), shortdesc = cgi.escape(changes[4].splitlines()[0]), age = age(t), | author = changes[1], | def changelist(): parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in range(start, end + 1): n = cl.node(i) changes = cl.read(n) hn = hex(n) p1, p2 = cl.parents(n) t = float(changes[2].split(' ')[0]) |
desc = nl2br(cgi.escape(changes[4])), date = time.asctime(time.gmtime(t)), | desc = changes[4], date = t, | def changelist(): parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in range(start, end + 1): n = cl.node(i) changes = cl.read(n) hn = hex(n) p1, p2 = cl.parents(n) t = float(changes[2].split(' ')[0]) |
shortdesc = cgi.escape(changes[4].splitlines()[0]), | def diff(): yield self.diff(p1, n, changes[3]) | |
author = obfuscate(changes[1]), desc = nl2br(cgi.escape(changes[4])), date = time.asctime(time.gmtime(t)), | author = changes[1], desc = changes[4], date = t, | def diff(): yield self.diff(p1, n, changes[3]) |
author = obfuscate(cs[1]), age = age(t), date = time.asctime(time.gmtime(t)), shortdesc = cgi.escape(cs[4].splitlines()[0]), | author = cs[1], date = t, desc = cs[4], | def entries(): l = [] parity = (count - 1) & 1 for i in range(count): |
text = cgi.escape(fl.read(n)) | text = fl.read(n) | def filerevision(self, f, node): fl = self.repo.file(f) n = bin(node) text = cgi.escape(fl.read(n)) changerev = fl.linkrev(n) cl = self.repo.changelog cn = cl.node(changerev) cs = cl.read(cn) p1, p2 = fl.parents(n) t = float(cs[2].split(' ')[0]) mfn = cs[0] |
author = obfuscate(cs[1]), age = age(t), date = time.asctime(time.gmtime(t)), shortdesc = cgi.escape(cs[4].splitlines()[0]), | author = cs[1], date = t, | def lines(): for l, t in enumerate(text.splitlines(1)): yield self.t("fileline", line = t, linenumber = "% 6d" % (l + 1), parity = l & 1) |
line = cgi.escape(l)) | line = l) | def annotate(): parity = 1 last = None for r, l in fl.annotate(n): try: cnode = ncache[r] except KeyError: cnode = ncache[r] = self.repo.changelog.node(r) try: name = bcache[r] except KeyError: cl = self.repo.changelog.read(cnode) name = cl[1] f = name.find('@') if f >= 0: name = name[:f] bcache[r] = name |
author = obfuscate(cs[1]), age = age(t), date = time.asctime(time.gmtime(t)), shortdesc = cgi.escape(cs[4].splitlines()[0]), | author = cs[1], date = t, | def annotate(): parity = 1 last = None for r, l in fl.annotate(n): try: cnode = ncache[r] except KeyError: cnode = ncache[r] = self.repo.changelog.node(r) try: name = bcache[r] except KeyError: cl = self.repo.changelog.read(cnode) name = cl[1] f = name.find('@') if f >= 0: name = name[:f] bcache[r] = name |
n = repo.manifest.tip() mf = repo.manifest.readflags(n) util.set_exec(myreldest, util.is_exec(rel, mf[abs])) | shutil.copymode(rel, myreldest) | def okaytocopy(abs, rel, exact): reasons = {'?': 'is not managed', 'a': 'has been marked for add'} reason = reasons.get(repo.dirstate.state(abs)) if reason: if exact: ui.warn('%s: not copying - file %s\n' % (rel, reason)) else: return True |
t = time.time() if time.daylight: tz = time.altzone else: tz = time.timezone return t, tz | lt = time.localtime() if lt[8] == 1 and time.daylight: tz = time.altzone else: tz = time.timezone return time.mktime(lt), tz | def makedate(): t = time.time() if time.daylight: tz = time.altzone else: tz = time.timezone return t, tz |
return subset | if heads: return subset, updated_heads.keys() else: return subset | def findoutgoing(self, remote, base=None, heads=None, force=False): if base == None: base = {} self.findincoming(remote, base, heads, force=force) |
heads = remote.heads() inc = self.findincoming(remote, base, heads, force=force) | remote_heads = remote.heads() inc = self.findincoming(remote, base, remote_heads, force=force) | def push(self, remote, force=False, revs=None): lock = remote.lock() |
self.ui.status(_("(did you forget to sync? use push -f to force)\n")) | self.ui.status(_("(did you forget to sync?" " use push -f to force)\n")) | def push(self, remote, force=False, revs=None): lock = remote.lock() |
update = self.findoutgoing(remote, base) | update, updated_heads = self.findoutgoing(remote, base, remote_heads) | def push(self, remote, force=False, revs=None): lock = remote.lock() |
if len(bases) < len(heads): | if revs is not None: updated_heads = {} for base in msng_cl: for parent in self.changelog.parents(base): if parent in remote_heads: updated_heads[parent] = True updated_heads = updated_heads.keys() if len(updated_heads) < len(heads): | def push(self, remote, force=False, revs=None): lock = remote.lock() |
f = self.wjoin(fn) st = os.lstat(f) | st = os.lstat(self.wjoin(fn)) | def changes(self, files=None, match=util.always, show_ignored=None): lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted = [], [] |
st = os.stat(fn) | st = os.stat(self.wjoin(fn)) | def changes(self, files=None, match=util.always, show_ignored=None): lookup, modified, added, unknown, ignored = [], [], [], [], [] removed, deleted = [], [] |
key, i = find(cmd) | aliases, i = find(cmd) | def help_(ui, cmd=None, with_version=False): """show help for a given command or all commands""" option_lists = [] if cmd and cmd != 'shortlist': if with_version: show_version(ui) ui.write('\n') key, i = find(cmd) # synopsis ui.write("%s\n\n" % i[2]) # description doc = i[0].__doc__ if ui.quiet: doc = doc.splitlines(0... |
aliases = ', '.join(key.split('|')[1:]) if aliases: ui.write(_("\naliases: %s\n") % aliases) | if len(aliases) > 1: ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) | def help_(ui, cmd=None, with_version=False): """show help for a given command or all commands""" option_lists = [] if cmd and cmd != 'shortlist': if with_version: show_version(ui) ui.write('\n') key, i = find(cmd) # synopsis ui.write("%s\n\n" % i[2]) # description doc = i[0].__doc__ if ui.quiet: doc = doc.splitlines(0... |
choice = [] | choice = None | def find(cmd): choice = [] for e in table.keys(): aliases = e.lstrip("^").split("|") if cmd in aliases: return e, table[e] for a in aliases: if a.startswith(cmd): choice.append(e) if len(choice) == 1: e = choice[0] return e, table[e] raise UnknownCommand(cmd) |
return e, table[e] | return aliases, table[e] | def find(cmd): choice = [] for e in table.keys(): aliases = e.lstrip("^").split("|") if cmd in aliases: return e, table[e] for a in aliases: if a.startswith(cmd): choice.append(e) if len(choice) == 1: e = choice[0] return e, table[e] raise UnknownCommand(cmd) |
choice.append(e) if len(choice) == 1: e = choice[0] return e, table[e] | if choice: raise UnknownCommand(cmd) else: choice = aliases, table[e] if choice: return choice | def find(cmd): choice = [] for e in table.keys(): aliases = e.lstrip("^").split("|") if cmd in aliases: return e, table[e] for a in aliases: if a.startswith(cmd): choice.append(e) if len(choice) == 1: e = choice[0] return e, table[e] raise UnknownCommand(cmd) |
i = find(cmd)[1] | aliases, i = find(cmd) cmd = aliases[0] | def parse(ui, args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if args: cmd, args = args[0], args[1:] defaults = ui.config("defaults", cmd) if defaults: # reparse with command defaults added args = [c... |
nodestotag = heads[:] | def nodesbetween(self, roots=None, heads=None): """Return a tuple containing three elements. Elements 1 and 2 contain a final list bases and heads after all the unreachable ones have been pruned. Element 0 contains a topologically sorted list of all | |
import win32api, win32con, win32file, winerror, pywintypes | import win32api, win32con, win32file, pywintypes | def parse_patch_output(output_line): """parses the output produced by patch and returns the file name""" pf = output_line[14:] if pf[0] == '`': pf = pf[1:-1] # Remove the quotes return pf |
patch.diff(repo, other, prev, n) | patch.diff(other, prev, n, fp=repo.ui) | def incoming(ui, repo, source="default", **opts): """show new changesets found in source Show new changesets found in the specified path/URL or the default pull location. These are the changesets that would be pulled if a pull was requested. For remote repository, using --bundle avoids downloading the changesets twic... |
ui.write("\n") ui.write("\n") | ui.write("\n\n") | def log(ui, repo, f=None, **opts): """show the revision history of the repository or a single file""" if f: files = relpath(repo, [f]) filelog = repo.file(files[0]) log = filelog lookup = filelog.lookup else: files = None filelog = None log = repo.changelog lookup = repo.lookup revlist = [] revs = [log.rev(lookup(rev))... |
dotname = '.' + name | def findext(name): '''return module with given extension name''' try: return sys.modules[external[name]] except KeyError: dotname = '.' + name for k, v in external.iteritems(): if k.endswith('.' + name) or v == name: return sys.modules[v] raise KeyError(name) | |
if k.endswith('.' + name) or v == name: | if k.endswith('.' + name) or k.endswith('/' + name) or v == name: | def findext(name): '''return module with given extension name''' try: return sys.modules[external[name]] except KeyError: dotname = '.' + name for k, v in external.iteritems(): if k.endswith('.' + name) or v == name: return sys.modules[v] raise KeyError(name) |
patch = mergeq.lookup(patch) | patch = mergeq.lookup(patch, strict=True) | def mergepatch(self, repo, mergeq, series, wlock): if len(self.applied) == 0: # each of the patches merged in will have two parents. This # can confuse the qrefresh, qdiff, and strip code because it # needs to know which parent is actually in the patch queue. # so, we insert a merge marker with only one parent. This ... |
patch = self.lookup(patch) | patch = self.lookup(patch, strict=True) | def delete(self, repo, patch): patch = self.lookup(patch) info = self.isapplied(patch) if info: self.ui.warn("cannot delete applied patch %s\n" % patch) sys.exit(1) if patch not in self.series: self.ui.warn("patch %s not in series file\n" % patch) sys.exit(1) i = self.find_series(patch) del self.full_series[i] self.rea... |
def lookup(self, patch): | def lookup(self, patch, strict=False): def partial_name(s): count = 0 if s in self.series: return s for x in self.series: if s in x: count += 1 last = x if count > 1: return None if count: return last if len(self.series) > 0 and len(self.applied) > 0: if s == 'qtip': return self.series[self.series_end()-1] if s == 'qba... | def lookup(self, patch): if patch == None: return None if patch in self.series: return patch if not os.path.isfile(os.path.join(self.path, patch)): try: sno = int(patch) except(ValueError, OverflowError): self.ui.warn("patch %s not in series\n" % patch) sys.exit(1) if sno >= len(self.series): self.ui.warn("patch number... |
if patch in self.series: return patch | res = partial_name(patch) if res and res == patch: return res | def lookup(self, patch): if patch == None: return None if patch in self.series: return patch if not os.path.isfile(os.path.join(self.path, patch)): try: sno = int(patch) except(ValueError, OverflowError): self.ui.warn("patch %s not in series\n" % patch) sys.exit(1) if sno >= len(self.series): self.ui.warn("patch number... |
self.ui.warn("patch %s not in series\n" % patch) sys.exit(1) if sno >= len(self.series): self.ui.warn("patch number %d is out of range\n" % sno) sys.exit(1) patch = self.series[sno] else: self.ui.warn("patch %s not in series\n" % patch) sys.exit(1) return patch | pass else: if sno < len(self.series): patch = self.series[sno] return patch if not strict: if res: return res minus = patch.rsplit('-', 1) if len(minus) > 1: res = partial_name(minus[0]) if res: i = self.series.index(res) try: off = int(minus[1] or 1) except(ValueError, OverflowError): pass else: if i - off >= 0: retu... | def lookup(self, patch): if patch == None: return None if patch in self.series: return patch if not os.path.isfile(os.path.join(self.path, patch)): try: sno = int(patch) except(ValueError, OverflowError): self.ui.warn("patch %s not in series\n" % patch) sys.exit(1) if sno >= len(self.series): self.ui.warn("patch number... |
def copy(ui, repo, source, dest): """mark a file as copied or renamed for the next commit""" return repo.copy(*relpath(repo, (source, dest))) | def copy(ui, repo, *pats, **opts): """mark files as copied for the next commit""" if not pats: raise util.Abort('no source or destination specified') elif len(pats) == 1: raise util.Abort('no destination specified') pats = list(pats) dest = pats.pop() sources = [] def okaytocopy(abs, rel, exact): reasons = {'?': 'is n... | def copy(ui, repo, source, dest): """mark a file as copied or renamed for the next commit""" return repo.copy(*relpath(repo, (source, dest))) |
"copy": (copy, [], 'hg copy SOURCE DEST'), | "copy|cp": (copy, [('I', 'include', [], 'include path in search'), ('X', 'exclude', [], 'exclude path from search'), ('A', 'after', None, 'record a copy after it has happened'), ('f', 'force', None, 'replace destination if it exists'), ('p', 'parents', None, 'append source path to dest')], 'hg copy [OPTION]... [SOURCE]... | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.