rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
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):
if not revs and len(remote_heads) < len(heads) \ and remote_heads != [nullid]:
def push(self, remote, force=False, revs=None): lock = remote.lock()
py2exe_opts['console'] = 'hg'
py2exe_opts['console'] = ['hg']
def finalize_options(self): self.set_undefined_options('install', ('install_lib', 'install_dir')) install_data.finalize_options(self)
for src, abs, rel, exact in walk(repo, pats, opts): if abs not in mmap: ui.warn(_("warning: %s is not in the repository!\n") % ((pats and rel) or abs)) continue
for src, abs, rel, exact in walk(repo, pats, opts, node=node):
def getdate(rev): datestr = dcache.get(rev) if datestr is None: cl = repo.changelog.read(repo.changelog.node(rev)) datestr = dcache[rev] = util.datestr(cl[2]) return datestr
self.ui.warn("too many revisions to diff\n")
ui.warn("too many revisions to diff\n")
def diff(ui, repo, *files, **opts): """diff working directory (or selected files)""" revs = [] if opts['rev']: revs = map(lambda x: repo.lookup(x), opts['rev']) if len(revs) > 2: self.ui.warn("too many revisions to diff\n") sys.exit(1) if files: files = relpath(repo, files) else: files = relpath(repo, [""]) dodiff(u...
yield {"type" : i, "node" : nodeid}
yield {"type" : i, "node" : nodeid, "url": ""}
def archivelist(self, nodeid): for i in self.archives: if self.repo.ui.configbool("web", "allow" + i, False): yield {"type" : i, "node" : nodeid}
lastupdate=d)
lastupdate=d, archives=archivelist(u, "tip", url))
def entries(**map): parity = 0 for name, path in self.repos: u = ui.ui() try: u.readconfig(os.path.join(path, '.hg', 'hgrc')) except IOError: pass get = u.config
return self.series[self.series_end()-1]
return self.series[self.series_end(True)-1]
def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q...
self.ui.warn("update failed to remove %s: %s!\n" % (f, inst))
if inst.errno != errno.ENOENT: self.ui.warn("update failed to remove %s: %s!\n" % (f, inst.strerror))
def update(self, node, allow=False, force=False, choose=None, moddirstate=True): pl = self.dirstate.parents() if not force and pl[1] != nullid: self.ui.warn("aborting: outstanding uncommitted merges\n") return 1
def __init__(self, mapfile, filters = {}):
def __init__(self, mapfile, filters = {}, defaults = {}):
def __init__(self, mapfile, filters = {}): self.cache = {} self.map = {} self.base = os.path.dirname(mapfile) self.filters = filters
return template(tmpl, self.filters, **map)
return template(tmpl, self.filters, **m)
def __call__(self, t, **map): try: tmpl = self.cache[t] except KeyError: tmpl = self.cache[t] = file(self.map[t]).read() return template(tmpl, self.filters, **map)
return strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(x))
return time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(x))
def rfc822date(x): return strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(x))
port = os.environ["SERVER_PORT"] port = port != "80" and (":" + port) or "" self.url = "http://%s%s%s" % \ (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"]) yield self.t("header", repo = self.reponame, url = self.url)
yield self.t("header")
def header(self): port = os.environ["SERVER_PORT"] port = port != "80" and (":" + port) or "" self.url = "http://%s%s%s" % \ (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"])
yield self.t("footer", repo = self.reponame)
yield self.t("footer")
def footer(self): yield self.t("footer", repo = self.reponame)
header = self.header(), footer = self.footer(), repo = self.reponame,
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): n = cl.node(i) changes = cl.read(n) hn = hex(n) t = float(changes[2].split(' ')[0])
header = self.header(), footer = self.footer(),
def revgen(): for i in range(cl.count() - 1, 0, -100): l = [] for j in range(max(0, i - 100), i): n = cl.node(j) changes = cl.read(n) l.insert(0, (n, j, changes)) for e in l: yield e
repo = self.reponame,
def revgen(): for i in range(cl.count() - 1, 0, -100): l = [] for j in range(max(0, i - 100), i): n = cl.node(j) changes = cl.read(n) l.insert(0, (n, j, changes)) for e in l: yield e
header = self.header(), footer = self.footer(), repo = self.reponame,
def diff(): yield self.diff(p1, n, changes[3])
header = self.header(), footer = self.footer(), repo = self.reponame,
def entries(): l = [] parity = (count - 1) & 1
header = self.header(), footer = self.footer(), repo = self.reponame,
def lines(): for l, t in enumerate(text.splitlines(1)): yield self.t("fileline", line = t, linenumber = "% 6d" % (l + 1), parity = l & 1)
header = self.header(), footer = self.footer(), repo = self.reponame,
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)
header = self.header(), footer = self.footer(), repo = self.reponame,
def filelist(): parity = 0 fl = files.keys() fl.sort() for f in fl: full, fnode = files[f] if fnode: yield self.t("manifestfileentry", file = full, manifest = mnode, filenode = hex(fnode), parity = parity, basename = f, permissions = mff[full]) else: yield self.t("manifestdirentry", parity = parity, path = os.path.join...
header = self.header(), footer = self.footer(), repo = self.reponame,
def entries(): parity = 0 for k,n in i: yield self.t("tagentry", parity = parity, tag = k, node = hex(n)) parity = 1 - parity
header = self.header(), footer = self.footer(), repo = self.reponame,
def diff(): yield self.diff(p1, n, file)
self.t = templater(m, self.filters)
port = os.environ["SERVER_PORT"] port = port != "80" and (":" + port) or "" url = "http://%s%s%s" % \ (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"]) self.t = templater(m, self.filters, {"url":url, "repo":self.reponame, "header":self.header(), "footer":self.footer(), })
def run(self): self.refresh() args = cgi.parse()
Retruns a list of the single files/directories in "path".
Returns a list of the single files/directories in "path".
def _split_path(self, path): ''' Retruns a list of the single files/directories in "path". For instance: '/home/user/test' -> ['/', 'home', 'user', 'test'] 'C:\\Mercurial' -> ['C:\\', 'Mercurial'] ''' ret = [] while True: head, tail = os.path.split(path) if tail: ret.append(tail) if head == path: ret.append(head) bre...
files that this program would delete use the -vn options.
files that this program would delete use the --print option.
def purge(ui, repo, *dirs, **opts): '''removes files not tracked by mercurial Delete files not known to mercurial, this is useful to test local and uncommitted changes in the otherwise clean source tree. This means that purge will delete: - Unknown files: files marked with "?" by "hg status" - Ignored files: files us...
def add_comment(self, bugid, text, prefuser):
def map_committer(self, user): '''map name of committer to bugzilla user name.''' for committer, bzuser in self.ui.configitems('usermap'): if committer.lower() == user.lower(): return bzuser return user def add_comment(self, bugid, text, committer):
def add_comment(self, bugid, text, prefuser): '''add comment to bug. try adding comment as committer of changeset, otherwise as default bugzilla user.''' try: userid = self.get_user_id(prefuser) except KeyError: try: defaultuser = self.ui.config('bugzilla', 'bzuser') userid = self.get_user_id(defaultuser) except KeyErr...
userid = self.get_user_id(prefuser)
userid = self.get_user_id(user)
def add_comment(self, bugid, text, prefuser): '''add comment to bug. try adding comment as committer of changeset, otherwise as default bugzilla user.''' try: userid = self.get_user_id(prefuser) except KeyError: try: defaultuser = self.ui.config('bugzilla', 'bzuser') userid = self.get_user_id(defaultuser) except KeyErr...
raise util.Abort(_('cannot find user id for %s or %s') % (prefuser, defaultuser))
raise util.Abort(_('cannot find bugzilla user id for %s or %s') % (user, defaultuser))
def add_comment(self, bugid, text, prefuser): '''add comment to bug. try adding comment as committer of changeset, otherwise as default bugzilla user.''' try: userid = self.get_user_id(prefuser) except KeyError: try: defaultuser = self.ui.config('bugzilla', 'bzuser') userid = self.get_user_id(defaultuser) except KeyErr...
if aliases[0].startswith("debug"):
if aliases[0].startswith("debug") or found.startswith("debug"):
def findpossible(ui, cmd): """ Return cmd -> (aliases, command table entry) for each matching command. Return debug commands (or their aliases) only if no normal command matches. """ choice = {} debugchoice = {} for e in table.keys(): aliases = e.lstrip("^").split("|") found = None if cmd in aliases: found = cmd elif n...
fp.write(m.as_string(0)) fp.write('\n')
try: fp.write(m.as_string(0)) fp.write('\n') except IOError, inst: if inst.errno != errno.EPIPE: raise
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()]
except IOError:
except OSError:
def __del__(self): if self.dir_: self.rmtree(self.dir_, True)
" p1 p2 nodeid\n")
" nodeid p1 p2\n")
def debugindex(ui, file_): """dump the contents of an index file""" r = hg.revlog(hg.opener(""), file_, "") ui.write(" rev offset length base linkrev" + " p1 p2 nodeid\n") for i in range(r.count()): e = r.index[i] ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % ( i, e[0], e[1], e[2], ...
ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % (
ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
def debugindex(ui, file_): """dump the contents of an index file""" r = hg.revlog(hg.opener(""), file_, "") ui.write(" rev offset length base linkrev" + " p1 p2 nodeid\n") for i in range(r.count()): e = r.index[i] ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % ( i, e[0], e[1], e[2], ...
hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])))
hg.short(e[6]), hg.short(e[4]), hg.short(e[5])))
def debugindex(ui, file_): """dump the contents of an index file""" r = hg.revlog(hg.opener(""), file_, "") ui.write(" rev offset length base linkrev" + " p1 p2 nodeid\n") for i in range(r.count()): e = r.index[i] ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % ( i, e[0], e[1], e[2], ...
n, k = l.split(" ") self.tagscache[k] = bin(n)
n, k = l.split(" ", 1) self.tagscache[k.strip()] = bin(n)
def tags(self): '''return a mapping of tag to node''' if not self.tagscache: self.tagscache = {} try: # read each head of the tags file, ending with the tip # and add each tag found to the map, with "newer" ones # taking precedence fl = self.file(".hgtags") h = fl.heads() h.reverse() for r in h: for l in fl.revision(r)...
n = self.changelog.add(mn, changed, text, tr, p1, p2, user, date)
n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date)
def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False): commit = [] remove = [] changed = []
yield tmpl("footer", motd=self.motd, **map)
yield tmpl("footer", **map)
def footer(**map): yield tmpl("footer", motd=self.motd, **map)
self.hook("precommit", throw=True)
xp1 = hex(p1) if p2 == nullid: xp2 = '' else: xp2 = hex(p2) self.hook("precommit", throw=True, p1=xp1, p2=xp2)
def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, wlock=None): commit = [] remove = [] changed = []
self.hook("commit", node=hex(n))
self.hook("commit", node=hex(n), p1=xp1, p2=xp2)
def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, wlock=None): commit = [] remove = [] changed = []
filenode = hex(mf[file]),
filenode = hex(mf.get(file, nullid)),
def diff(): yield self.diff(p1, n, file)
def incoming(ui, repo, source="default"):
def incoming(ui, repo, source="default", **opts):
def incoming(ui, repo, source="default"): """show new changesets found in source""" source = ui.expandpath(source) other = hg.repository(ui, source) if not other.local(): ui.warn("abort: incoming doesn't work for remote" + " repositories yet, sorry!\n") return 1 o = repo.findincoming(other) if not o: return o = other.n...
def outgoing(ui, repo, dest="default-push"):
def outgoing(ui, repo, dest="default-push", **opts):
def outgoing(ui, repo, dest="default-push"): """show changesets not found in destination""" dest = ui.expandpath(dest) other = hg.repository(ui, dest) o = repo.findoutgoing(other) o = repo.newer(o) o.reverse() for n in o: show_changeset(ui, repo, changenode=n)
"incoming|in": (incoming, [], 'hg incoming [SOURCE]'),
"incoming|in": (incoming, [('p', 'patch', None, 'show patch')], 'hg incoming [-p] [SOURCE]'),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
"outgoing|out": (outgoing, [], 'hg outgoing [DEST]'),
"outgoing|out": (outgoing, [('p', 'patch', None, 'show patch')], 'hg outgoing [-p] [DEST]'),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
self.mapcache = (n, map)
self.mapcache = (n, map, flags)
def add(self, map, flags, transaction, link, p1=None, p2=None): files = map.keys() files.sort()
pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0])
c1 = self.changelog.read(p1) c2 = self.changelog.read(p2) m1 = self.manifest.read(c1[0]) mf1 = self.manifest.readflags(c1[0]) m2 = self.manifest.read(c2[0])
def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0]) tr = self.transaction() mmap = {} linkrev = self.changelog.count() for f in files: try:...
mmap = {}
mm = m1.copy() mfm = mf1.copy()
def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0]) tr = self.transaction() mmap = {} linkrev = self.changelog.count() for f in files: try:...
t = file(f).read()
t = self.wfile(f).read() tm = is_exec(self.wjoin(f)) r = self.file(f) mfm[f] = tm mm[f] = r.add(t, tr, linkrev, m1.get(f, nullid), m2.get(f, nullid))
def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0]) tr = self.transaction() mmap = {} linkrev = self.changelog.count() for f in files: try:...
self.ui.warn("Read file %s error, skipped\n" % f) continue r = self.file(f) prev = pmmap.get(f, nullid) mmap[f] = r.add(t, tr, linkrev, prev) mnode = self.manifest.add(mmap, tr, linkrev, pchange[0]) n = self.changelog.add(mnode, files, text, tr, p1, p2, user ,date, )
del mm[f] del mfm[f] mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date)
def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0]) tr = self.transaction() mmap = {} linkrev = self.changelog.count() for f in files: try:...
self.dirstate.update(mmap.keys(), "n")
self.dirstate.update(files, "n")
def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid pchange = self.changelog.read(p1) pmmap = self.manifest.read(pchange[0]) tr = self.transaction() mmap = {} linkrev = self.changelog.count() for f in files: try:...
manifestchangeset = {}
def verify(self): filelinkrevs = {} filenodes = {} manifestchangeset = {} changesets = revisions = files = 0 errors = 0
manifestchangeset[changes[0]] = n
def verify(self): filelinkrevs = {} filenodes = {} manifestchangeset = {} changesets = revisions = files = 0 errors = 0
ca = self.changelog.node(self.manifest.linkrev(n)) cc = manifestchangeset[n] if ca != cc: self.ui.warn("manifest %s points to %s, not %s\n" % (hex(n), hex(ca), hex(cc))) errors += 1
def verify(self): filelinkrevs = {} filenodes = {} manifestchangeset = {} changesets = revisions = files = 0 errors = 0
def delete(self, repo, patch, keep=False): patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch)
def delete(self, repo, patches, keep=False): realpatches = [] for patch in patches: patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) realpatc...
def delete(self, repo, patch, keep=False): patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) if not keep: r = self.qrepo() if r: r.remove([pat...
r.remove([patch], True)
r.remove(realpatches, True)
def delete(self, repo, patch, keep=False): patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) if not keep: r = self.qrepo() if r: r.remove([pat...
i = self.find_series(patch) del self.full_series[i]
indices = [self.find_series(p) for p in realpatches] indices.sort() for i in indices[-1::-1]: del self.full_series[i]
def delete(self, repo, patch, keep=False): patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) if not keep: r = self.qrepo() if r: r.remove([pat...
def delete(ui, repo, patch, **opts): """remove a patch from the series file The patch must not be applied. With -k, the patch file is preserved in the patch directory."""
def delete(ui, repo, patch, *patches, **opts): """remove patches from queue The patches must not be applied. With -k, the patch files are preserved in the patch directory."""
def delete(ui, repo, patch, **opts): """remove a patch from the series file The patch must not be applied. With -k, the patch file is preserved in the patch directory.""" q = repo.mq q.delete(repo, patch, keep=opts.get('keep')) q.save_dirty() return 0
q.delete(repo, patch, keep=opts.get('keep'))
q.delete(repo, (patch,) + patches, keep=opts.get('keep'))
def delete(ui, repo, patch, **opts): """remove a patch from the series file The patch must not be applied. With -k, the patch file is preserved in the patch directory.""" q = repo.mq q.delete(repo, patch, keep=opts.get('keep')) q.save_dirty() return 0
empty = hg.nullid
empty = hg.short(hg.nullid)
def __difftree(repo, node1, node2, files=[]): if node2: change = repo.changelog.read(node2) mmap2 = repo.manifest.read(change[0]) status = repo.status(node1, node2, files=files)[:5] modified, added, removed, deleted, unknown = status else: status = repo.status(node1, files=files)[:5] modified, added, removed, deleted, ...
print ":000000 100664 %s %s N\t%s\t%s" % (hg.short(nullid),
print ":000000 100664 %s %s N\t%s\t%s" % (empty,
def __difftree(repo, node1, node2, files=[]): if node2: change = repo.changelog.read(node2) mmap2 = repo.manifest.read(change[0]) status = repo.status(node1, node2, files=files)[:5] modified, added, removed, deleted, unknown = status else: status = repo.status(node1, files=files)[:5] modified, added, removed, deleted, ...
hg.short(nullid),
empty,
def __difftree(repo, node1, node2, files=[]): if node2: change = repo.changelog.read(node2) mmap2 = repo.manifest.read(change[0]) status = repo.status(node1, node2, files=files)[:5] modified, added, removed, deleted, unknown = status else: status = repo.status(node1, files=files)[:5] modified, added, removed, deleted, ...
return (rev < 0) and nullid or self.index[rev][-1]
return rev == nullrev and nullid or self.index[rev][-1]
def node(self, rev): return (rev < 0) and nullid or self.index[rev][-1]
if rev < 0:
if rev == nullrev:
def start(self, rev): if rev < 0: return 0 if self.version != REVLOGV0: return self.ngoffset(self.index[rev][0]) return self.index[rev][0]
if rev < 0:
if rev == nullrev:
def length(self, rev): if rev < 0: return 0 else: return self.index[rev][1]
def base(self, rev): return (rev < 0) and rev or self.index[rev][-5]
def base(self, rev): if (rev == nullrev): return nullrev else: return self.index[rev][-5]
def base(self, rev): return (rev < 0) and rev or self.index[rev][-5]
raise util.Abort(_('%s hook is invalid ' '(import of "%s" failed)') % (hname, modname))
try: obj = __import__("hgext_%s" % modname) except ImportError: raise util.Abort(_('%s hook is invalid ' '(import of "%s" failed)') % (hname, modname))
def callhook(hname, funcname): '''call python hook. hook is callable object, looked up as name in python module. if callable returns "true", hook fails, else passes. if hook raises exception, treated as hook failure. exception propagates if throw is "true".
if opts['strip']:
if opts['no_status']:
def status(ui, repo, *pats, **opts): '''show changed files in the working directory M = modified A = added R = removed ? = not tracked ''' cwd = repo.getcwd() files, matchfn, anypats = matchpats(repo, cwd, pats, opts) (c, a, d, u) = [[util.pathto(cwd, x) for x in n] for n in repo.changes(files=files, match=matchfn)] ...
('p', 'strip', None, 'strip status prefix'),
('n', 'no-status', None, 'hide status prefix'),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
minus = patch.rsplit('-', 1) if len(minus) > 1: res = partial_name(minus[0])
minus = patch.rfind('-') if minus >= 0: res = partial_name(patch[:minus])
def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q...
off = int(minus[1] or 1)
off = int(patch[minus+1:] or 1)
def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q...
plus = patch.rsplit('+', 1) if len(plus) > 1: res = partial_name(plus[0])
plus = patch.rfind('+') if plus >= 0: res = partial_name(patch[:plus])
def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q...
off = int(plus[1] or 1)
off = int(patch[plus+1:] or 1)
def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q...
for src, abs, rel, exact in walk(repo, pats, opts, node=node):
for src, abs, rel, exact in walk(repo, pats, opts, node=ctx.node()):
def getdate(rev): datestr = dcache.get(rev) if datestr is None: datestr = dcache[rev] = util.datestr(repo.changectx(rev).date()) return datestr
u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst))
u.warn(_("*** failed to import extension %s: %s\n") % (ext_name, inst))
def importh(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod
window = 300
def walkchangerevs(ui, repo, pats, opts): '''Iterate over files and the revs they changed in. Callers most commonly need to iterate backwards over the history it is interested in. Doing so has awful (quadratic-looking) performance, so we use iterators in a "windowed" way. We walk a window of revisions in the desired...
for i in xrange(filelog.count() - 1, -1, -window):
for i, window in increasing_windows(filelog.count()-1, -1):
def filerevgen(filelog): for i in xrange(filelog.count() - 1, -1, -window): revs = [] for j in xrange(max(0, i - window), i + 1): revs.append(filelog.linkrev(filelog.node(j))) revs.reverse() for rev in revs: yield rev
for i in xrange(repo.changelog.count() - 1, -1, -window):
for i, window in increasing_windows(repo.changelog.count()-1, -1):
def changerevgen(): for i in xrange(repo.changelog.count() - 1, -1, -window): for j in xrange(max(0, i - window), i + 1): yield j, getchange(j)[3]
for i in xrange(0, len(revs), window):
for i, window in increasing_windows(0, len(revs)):
def iterate(): for i in xrange(0, len(revs), window): yield 'window', revs[0] < revs[-1], revs[-1] nrevs = [rev for rev in revs[i:min(i+window, len(revs))] if rev in wanted] srevs = list(nrevs) srevs.sort() for rev in srevs: fns = fncache.get(rev) or filter(matchfn, getchange(rev)[3]) yield 'add', rev, fns for rev in n...
if dest == source: ui.warn('abort: source and destination are the same\n') sys.exit(1)
if os.path.exists(dest): ui.warn("abort: destination '%s' already exists\n" % dest) return 1
def clone(ui, source, dest = None, **opts): """make a copy of an existing repository""" source = ui.expandpath(source) success = False if dest is None: dest = os.path.basename(os.path.normpath(source)) if dest == source: ui.warn('abort: source and destination are the same\n') sys.exit(1) os.mkdir(dest) try: link = ...
o = fl.tip()
o = fl.count()
def revmap(x): return self.changelog.rev(x)
revisions += fl.rev(n) - fl.rev(o)
revisions += fl.count() - o
def revmap(x): return self.changelog.rev(x)
findincoming(self, remote, base)
self.findincoming(remote, base)
def findoutgoing(self, remote): base = {} findincoming(self, remote, base) remain = dict.fromkeys(self.changelog.nodemap)
remain.append(p)
remove.append(p)
def findoutgoing(self, remote): base = {} findincoming(self, remote, base) remain = dict.fromkeys(self.changelog.nodemap)
except IOError, why: ui.warn("Can't read commit message %s: %s\n" % (logfile, why))
except IOError, inst: raise util.Abort("can't read commit message '%s': %s" % (logfile, inst.strerror))
def commit(ui, repo, *pats, **opts): """commit the specified files or all outstanding changes""" if opts['text']: ui.warn("Warning: -t and --text is deprecated," " please use -m or --message instead.\n") message = opts['message'] or opts['text'] logfile = opts['logfile'] if not message and logfile: try: if logfile == '...
l = [x for x in list if x in filters]
l = [x for x in files if x in filters]
def filterfiles(filters, files): l = [x for x in list if x in filters]
if t[-1] != os.sep:
if t and t[-1] != os.sep:
def filterfiles(filters, files): l = [x for x in list if x in filters]
subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip())
tlen = len(str(total)) subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, desc[0].strip())
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') or line.startswith('diff --git')): break desc.append(line) if not node: raise ValueError
subj = '[PATCH 0 of %d] %s' % (
tlen = len(str(len(patches))) subj = '[PATCH %0*d of %d] %s' % ( tlen, 0,
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()]
prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches)))
prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0, len(patches))))
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()]
if not os.path.exists(dest):
if not os.path.exists(p):
def copy(self, source, dest): p = self.wjoin(dest) if not os.path.exists(dest): self.ui.warn("%s does not exist!\n" % dest) elif not os.path.isfile(dest): self.ui.warn("copy failed: %s is not a file\n" % dest) else: if self.dirstate.state(dest) == '?': self.dirstate.update([dest], "a") self.dirstate.copy(source, dest)
elif not os.path.isfile(dest):
elif not os.path.isfile(p):
def copy(self, source, dest): p = self.wjoin(dest) if not os.path.exists(dest): self.ui.warn("%s does not exist!\n" % dest) elif not os.path.isfile(dest): self.ui.warn("copy failed: %s is not a file\n" % dest) else: if self.dirstate.state(dest) == '?': self.dirstate.update([dest], "a") self.dirstate.copy(source, dest)
"permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--")
"permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"), "rfc822date": rfc822date,
def __init__(self, path, name, templates = ""): self.templates = templates or templatepath() self.reponame = name self.path = path self.mtime = -1 self.viewonly = 0
yield self.t("header", repo = self.reponame)
port = os.environ["SERVER_PORT"] port = port != "80" and (":" + port) or "" self.url = "http://%s%s%s" % \ (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"]) yield self.t("header", repo = self.reponame, url = self.url)
def header(self): yield self.t("header", repo = self.reponame)
os.unlink(self.join(patch))
for p in realpatches: os.unlink(self.join(p))
def delete(self, repo, patches, opts): realpatches = [] for patch in patches: patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) realpatches.ap...
this returns a path in the form used by the local filesystem, not hg.'''
n1 should use os.sep to separate directories n2 should use "/" to separate directories returns an os.sep-separated path. '''
def pathto(n1, n2): '''return the relative path from one place to another. this returns a path in the form used by the local filesystem, not hg.''' if not n1: return localpath(n2) a, b = n1.split('/'), n2.split('/') a.reverse() b.reverse() while a and b and a[-1] == b[-1]: a.pop() b.pop() b.reverse() return os.sep.join...
a, b = n1.split('/'), n2.split('/')
a, b = n1.split(os.sep), n2.split('/')
def pathto(n1, n2): '''return the relative path from one place to another. this returns a path in the form used by the local filesystem, not hg.''' if not n1: return localpath(n2) a, b = n1.split('/'), n2.split('/') a.reverse() b.reverse() while a and b and a[-1] == b[-1]: a.pop() b.pop() b.reverse() return os.sep.join...
to = ""
to = None
def prettyprintlines(diff): for l in diff.splitlines(1): 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) else: yield self.t("diffline", line = l)
tn = ""
tn = None
def prettyprintlines(diff): for l in diff.splitlines(1): 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) else: yield self.t("diffline", line = l)
def delete(self, repo, patches, keep=False):
def delete(self, repo, patches, opts):
def delete(self, repo, patches, keep=False): realpatches = [] for patch in patches: patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) realpatc...