rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
tz = time.strftime('%z')
if time.daylight: offset = time.altzone else: offset = time.timezone if offset <= 0: sign, offset = '+', -offset else: sign = '-' offset = '%s%02d%02d' % (sign, offset / 3600, (offset % 3600) / 60)
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()]
m['Date'] = time.strftime('%a, %e %b %Y %T ', time.localtime(start_time)) + tz
m['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(start_time)) + ' ' + offset
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()]
local=not not opts['local'])
local=int(not not opts['local']))
def tag(ui, repo, name, rev_=None, **opts): """add a tag for the current tip or a given revision Name a particular revision using <name>. Tags are used to name particular revisions of the repository and are very useful to compare different revision, to go back to significant earlier versions or to mark branch points ...
def seq(factor=1): yield 1 * factor yield 3 * factor
def seq(factor, maxchanges=None): if maxchanges: yield maxchanges if maxchanges >= 20 and maxchanges <= 40: yield 50 else: yield 1 * factor yield 3 * factor
def seq(factor=1): yield 1 * factor yield 3 * factor #yield 5 * factor for f in seq(factor * 10): yield f
for f in seq(): if f < self.maxchanges / 2:
last = 0 for f in seq(1, self.maxchanges): if f < self.maxchanges or f <= last:
def seq(factor=1): yield 1 * factor yield 3 * factor #yield 5 * factor for f in seq(factor * 10): yield f
if not force: self.check_localchanges(repo)
commitfiles = [] (c, a, r, d, u) = repo.changes(None, None) if c or a or d or r: if not force: raise util.Abort(_("Local changes found, refresh first")) else: commitfiles = c + a + r
def new(self, repo, patch, msg=None, force=None): if not force: self.check_localchanges(repo) self.check_toppatch(repo) wlock = repo.wlock() insert = self.series_end() if msg: n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) else: n = repo.commit([], "New patch: %s" % patch, force=True, wlock=wlock) if n ...
n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) else: n = repo.commit([],
n = repo.commit(commitfiles, "[mq]: %s" % msg, force=True, wlock=wlock) else: n = repo.commit(commitfiles,
def new(self, repo, patch, msg=None, force=None): if not force: self.check_localchanges(repo) self.check_toppatch(repo) wlock = repo.wlock() insert = self.series_end() if msg: n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) else: n = repo.commit([], "New patch: %s" % patch, force=True, wlock=wlock) if n ...
edittext = text + "\n" + "HG: manifest hash %s\n" % hex(mn) edittext += "".join(["HG: changed %s\n" % f for f in new]) edittext += "".join(["HG: removed %s\n" % f for f in remove]) edittext = self.ui.edit(edittext) if not edittext: return 1 n = self.changelog.add(mn, new, edittext, tr, p1, p2)
if not text: edittext = "\n" + "HG: manifest hash %s\n" % hex(mn) edittext += "".join(["HG: changed %s\n" % f for f in new]) edittext += "".join(["HG: removed %s\n" % f for f in remove]) edittext = self.ui.edit(edittext) if not edittext.rstrip(): return 1 text = edittext n = self.changelog.add(mn, new, text, tr, p1, p...
def commit(self, files = None, text = ""): commit = [] remove = [] if files: for f in files: s = self.dirstate.state(f) if s in 'nmai': commit.append(f) elif s == 'r': remove.append(f) else: self.ui.warn("%s not tracked!\n" % f) else: (c, a, d, u) = self.diffdir(self.root) commit = c + a remove = d
if p == "/": raise "No repo found"
if p == oldp: raise "No repo found"
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")
def parent(self, t1, node=nullid, rev=-1, **args): if node != hex(nullid): yield self.t(t1, node = node, rev = rev, **args)
def listfilediffs(self, files, changeset): for f in files[:self.maxfiles]: yield self.t("filedifflink", node = hex(changeset), file = f) if len(files) > self.maxfiles: yield self.t("fileellipses")
def tag(ui, repo, name, rev=None, **opts):
def tag(ui, repo, name, rev_=None, **opts):
def tag(ui, repo, name, rev=None, **opts): """add a tag for the current tip or a given revision Name a particular revision using <name>. Tags are used to name particular revisions of the repository and are very useful to compare different revision, to go back to significant earlier versions or to mark branch points a...
if 'rev' in opts: rev = opts['rev'] if rev: r = hex(repo.lookup(rev))
if opts['rev']: rev_ = opts['rev'] if rev_: r = hex(repo.lookup(rev_))
def tag(ui, repo, name, rev=None, **opts): """add a tag for the current tip or a given revision Name a particular revision using <name>. Tags are used to name particular revisions of the repository and are very useful to compare different revision, to go back to significant earlier versions or to mark branch points a...
if not quiet: print l
ui.status("%s\n" % l)
def import_(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"] for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.join(d, patch) text = "" for l in file(pf): i...
try: import win32api, win32con, win32file
try: 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
win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, pid) except: return True
handle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, pid) if handle: status = win32process.GetExitCodeProcess(handle) if status == win32con.STILL_ACTIVE: return True else: return False except pywintypes.error, details: if details[0] == 87: return False return True
def testpid(pid): '''return False if pid is dead, True if running or not known''' try: win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, pid) except: return True
return p
return os.path.normpath(p)
def templatepath(): for f in "templates", "../templates": p = os.path.join(os.path.dirname(__file__), f) if os.path.isdir(p): return p
for i in xrange(filelog.count() - 1, 0, -window):
for i in xrange(filelog.count() - 1, -1, -window): print "filelog"
def filerevgen(filelog): for i in xrange(filelog.count() - 1, 0, -window): revs = [] for j in xrange(max(0, i - window), i): revs.append(filelog.linkrev(filelog.node(j))) revs.reverse() for rev in revs: yield rev
for j in xrange(max(0, i - window), i):
for j in xrange(max(0, i - window), i + 1):
def filerevgen(filelog): for i in xrange(filelog.count() - 1, 0, -window): revs = [] for j in xrange(max(0, i - window), i): revs.append(filelog.linkrev(filelog.node(j))) revs.reverse() for rev in revs: yield rev
for i in xrange(repo.changelog.count() - 1, 0, -window): for j in xrange(max(0, i - window), i):
for i in xrange(repo.changelog.count() - 1, -1, -window): for j in xrange(max(0, i - window), i + 1):
def mfrevgen(): for i in xrange(repo.changelog.count() - 1, 0, -window): for j in xrange(max(0, i - window), i): yield j, repo.changelog.read(repo.lookup(str(j)))[3]
f = self.do_cmd("changegroup", roots=n) return self.pipei
return self.do_cmd("changegroup", roots=n)
def changegroup(self, nodes, kind): n = " ".join(map(hex, nodes)) f = self.do_cmd("changegroup", roots=n) return self.pipei
self.ui.warn("patch %s already exists\n" % patch) sys.exit(1)
raise util.Abort(_('patch "%s" already exists') % patch)
def qimport(self, repo, files, patch=None, existing=None, force=None): if len(files) > 1 and patch: self.ui.warn("-n option not valid when importing multiple files\n") sys.exit(1) i = 0 added = [] for filename in files: if existing: if not patch: patch = filename if not os.path.isfile(os.path.join(self.path, patch)): s...
self.ui.warn("patch %s is already in the series file\n" % patch) sys.exit(1)
raise util.Abort(_('patch %s is already in the series file') % patch)
def qimport(self, repo, files, patch=None, existing=None, force=None): if len(files) > 1 and patch: self.ui.warn("-n option not valid when importing multiple files\n") sys.exit(1) i = 0 added = [] for filename in files: if existing: if not patch: patch = filename if not os.path.isfile(os.path.join(self.path, patch)): s...
ui.debug(_('proxying through %s\n') % proxyurl)
ui.debug(_('proxying through http://%s:%s\n') % (proxyhost, proxyport))
def __init__(self, ui, path): self.path = path self.caps = None scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if query or frag: raise util.Abort(_('unsupported URL component: "%s"') % (query or frag)) if not urlpath: urlpath = '/' host, port, user, passwd = netlocsplit(netloc)
"forget": (forget, [], "hg forget [FILE]..."),
"forget": (forget, [], "hg forget FILE..."),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
p = path[1:] if p and p[-1] != "/": p += "/" l = len(p)
if path and path[-1] != "/": path += "/" l = len(path) abspath = "/" + path
def manifest(self, ctx, path): mf = ctx.manifest() node = ctx.node()
if f[:l] != p:
if f[:l] != path:
def manifest(self, ctx, path): mf = ctx.manifest() node = ctx.node()
"path": os.path.join(path, f),
"path": os.path.join(abspath, f),
def dirlist(**map): parity = 0 fl = files.keys() fl.sort() for f in fl: full, fnode = files[f] if fnode: continue
path=path, up=_up(path),
path=abspath, up=_up(abspath),
def dirlist(**map): parity = 0 fl = files.keys() fl.sort() for f in fl: full, fnode = files[f] if fnode: continue
path = req.form.get('file', [''])[0]
path = self.cleanpath(req.form.get('file', [''])[0])
def do_file(self, req): path = req.form.get('file', [''])[0] if path: try: req.write(self.filerevision(self.filectx(req))) return except hg.RepoError: pass path = self.cleanpath(path)
path = self.cleanpath(path) req.write(self.manifest(self.changectx(req), '/' + path))
req.write(self.manifest(self.changectx(req), path))
def do_file(self, req): path = req.form.get('file', [''])[0] if path: try: req.write(self.filerevision(self.filectx(req))) return except hg.RepoError: pass path = self.cleanpath(path)
changesets = self.changelog.rev(cn) - self.changelog.rev(co)
cnr, cor = map(self.changelog.rev, (cn, co)) changesets = cnr - cor
def revmap(x): return self.changelog.rev(x)
if not self.hook("changegroup"):
if not self.hook("changegroup", node=hex(self.changelog.node(cor+1))): self.ui.warn("abort: changegroup hook returned failure!\n")
def revmap(x): return self.changelog.rev(x)
r = self.rev(n)
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) r = self.rev(n) if n not in seen: seen[n] = 1 yield (-d, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
yield (-d, n)
r = self.rev(n) yield (-d, r, n)
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) r = self.rev(n) if n not in seen: seen[n] = 1 yield (-d, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
return lx[1]
return lx[2]
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) r = self.rev(n) if n not in seen: seen[n] = 1 yield (-d, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
hx = x if '.' in x: hx = x.split('.')[0] if not hasattr(mod, hx): setattr(mod, hx, _demandmod(x, mod.__dict__, mod.__dict__))
subload(mod, x)
def _load(self): if not self._module: head, globals, locals, after = self._data mod = _origimport(head, globals, locals) # load submodules for x in after: hx = x if '.' in x: hx = x.split('.')[0] if not hasattr(mod, hx): setattr(mod, hx, _demandmod(x, mod.__dict__, mod.__dict__)) # are we in the locals dictionary still...
raise Abort("patch command failed: %s" % explain_exit(code))
raise Abort("patch command failed: %s" % explain_exit(code)[0])
def patch(strip, patchname, ui): """apply the patch <patchname> to the working directory. a list of patched files is returned""" fp = os.popen('patch -p%d < "%s"' % (strip, patchname)) files = {} for line in fp: line = line.rstrip() ui.status("%s\n" % line) if line.startswith('patching file '): pf = parse_patch_output(...
aliases, i = findcmd(name)
aliases, i = findcmd(ui, name)
def helpcmd(name): if with_version: show_version(ui) ui.write('\n') aliases, i = findcmd(name) # synopsis ui.write("%s\n\n" % i[2])
aliases, entry = findcmd(cmd)
aliases, entry = findcmd(ui, cmd)
def debugcomplete(ui, cmd='', **opts): """returns the completion list associated with the given command""" if opts['options']: options = [] otables = [globalopts] if cmd: aliases, entry = findcmd(cmd) otables.append(entry[1]) for t in otables: for o in t: if o[0]: options.append('-%s' % o[0]) options.append('--%s' % o...
clist = findpossible(cmd).keys()
clist = findpossible(ui, cmd).keys()
def debugcomplete(ui, cmd='', **opts): """returns the completion list associated with the given command""" if opts['options']: options = [] otables = [globalopts] if cmd: aliases, entry = findcmd(cmd) otables.append(entry[1]) for t in otables: for o in t: if o[0]: options.append('-%s' % o[0]) options.append('--%s' % o...
def findpossible(cmd):
def findpossible(ui, cmd):
def findpossible(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 else: for ...
else:
elif not ui.config("ui", "strict"):
def findpossible(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 else: for ...
def findcmd(cmd):
def findcmd(ui, cmd):
def findcmd(cmd): """Return (aliases, command table entry) for command string.""" choice = findpossible(cmd) if choice.has_key(cmd): return choice[cmd] if len(choice) > 1: clist = choice.keys() clist.sort() raise AmbiguousCommand(cmd, clist) if choice: return choice.values()[0] raise UnknownCommand(cmd)
choice = findpossible(cmd)
choice = findpossible(ui, cmd)
def findcmd(cmd): """Return (aliases, command table entry) for command string.""" choice = findpossible(cmd) if choice.has_key(cmd): return choice[cmd] if len(choice) > 1: clist = choice.keys() clist.sort() raise AmbiguousCommand(cmd, clist) if choice: return choice.values()[0] raise UnknownCommand(cmd)
aliases, i = findcmd(cmd)
aliases, i = findcmd(ui, cmd)
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:] aliases, i = findcmd(cmd) cmd = aliases[0] defaults = ui.config("defaults", cmd) if defaults: args...
return path
return path or loc
def expandpath(self, loc, default=None): """Return repository location relative to cwd or from [paths]""" if loc.find("://") != -1 or os.path.exists(loc): return loc
yield (-d, r, n)
yield (-d, n)
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) if n not in seen: seen[n] = 1 r = self.rev(n) yield (-d, r, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
x = ancestors(a) y = ancestors(b) lx = x.next() ly = y.next()
def generations(node): sg, s = None, {} for g,n in ancestors(node): if g != sg: if sg: yield sg, s sg, s = g, {n:1} else: s[n] = 1 yield sg, s x = generations(a) y = generations(b) gx = x.next() gy = y.next()
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) if n not in seen: seen[n] = 1 r = self.rev(n) yield (-d, r, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
if lx == ly: return lx[2] elif lx < ly: ly = y.next() elif lx > ly: lx = x.next()
if gx[0] == gy[0]: i = [ n for n in gx[1] if n in gy[1] ] if i: return i[0] else: gy = y.next() gx = x.next() elif gx[0] < gy[0]: gy = y.next() else: gx = x.next()
def ancestors(node): # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} earliest = self.count() while h: d, n = heapq.heappop(h) if n not in seen: seen[n] = 1 r = self.rev(n) yield (-d, r, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p))
if pn == p: c.append(p)
if pn == node: c.append(n)
def children(self, node): c = [] p = self.rev(node) for r in range(p + 1, self.count()): n = self.node(r) for pn in self.parents(n): if pn == p: c.append(p) continue elif pn == nullid: continue return c
while lb < lenb and la < lenb and a[la] == b[lb] :
while lb < lenb and la < lena and a[la] == b[lb] :
def sortdiff(a, b): la = lb = 0 lena = len(a) lenb = len(b) while 1: am, bm, = la, lb # walk over matching lines while lb < lenb and la < lenb and a[la] == b[lb] : la += 1 lb += 1 if la > am: yield (am, bm, la - am) # return a match # skip mismatched lines from b while lb < lenb and b[lb] < a[la]: lb += 1 if lb >=...
for each matching command
for each matching command. Return debug commands (or their aliases) only if no normal command matches.
def findpossible(cmd): """ Return cmd -> (aliases, command table entry) for each matching command """ choice = {} debugchoice = {} for e in table.keys(): aliases = e.lstrip("^").split("|") if cmd in aliases: choice[cmd] = (aliases, table[e]) continue for a in aliases: if a.startswith(cmd): if aliases[0].startswith("deb...
choice[cmd] = (aliases, table[e]) continue for a in aliases: if a.startswith(cmd): if aliases[0].startswith("debug"): debugchoice[a] = (aliases, table[e]) else: choice[a] = (aliases, table[e]) break
found = cmd else: for a in aliases: if a.startswith(cmd): found = a break if found is not None: if aliases[0].startswith("debug"): debugchoice[found] = (aliases, table[e]) else: choice[found] = (aliases, table[e])
def findpossible(cmd): """ Return cmd -> (aliases, command table entry) for each matching command """ choice = {} debugchoice = {} for e in table.keys(): aliases = e.lstrip("^").split("|") if cmd in aliases: choice[cmd] = (aliases, table[e]) continue for a in aliases: if a.startswith(cmd): if aliases[0].startswith("deb...
p = os.path.normpath(path)
p = util.normpath(path)
def clean(path): p = os.path.normpath(path) if p[:2] == "..": raise "suspicious path" return p
committer = "%s %s %s" % (changes[1], date, date_ar[1])
committer = changes[1]
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 "committer %s" % (committer)
print "committer %s %s %s" % (committer, date, date_ar[1])
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...
mf = dict(self.manifest.read(change[0]))
mf = self.manifest.read(change[0]).copy()
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
if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)):
if mf1.flags(fn) != mf2.flags(fn) or \ (mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1))):
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
i = 0 lines = [] while True: n = text.find('\n', i) if n == -1: last = text[i:] if last: lines.append(last) return lines lines.append(text[i:keepends and n+1 or n]) i = n + 1
lines = [l + '\n' for l in text.split('\n')] if lines: if lines[-1] == '\n': lines.pop() else: lines[-1] = lines[-1][:-1] return lines
def splitnewlines(text, keepends=False): '''like str.splitlines, but only split on newlines.''' i = 0 lines = [] while True: n = text.find('\n', i) if n == -1: last = text[i:] if last: lines.append(last) return lines lines.append(text[i:keepends and n+1 or n]) i = n + 1
b = splitnewlines(b, keepends=True)
b = splitnewlines(b)
def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif not a: b = splitnewlines(b, keepends=True) if a is None: l1 = "--- %s\t%s\n" ...
a = splitnewlines(a, keepends=True)
a = splitnewlines(a)
def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif not a: b = splitnewlines(b, keepends=True) if a is None: l1 = "--- %s\t%s\n" ...
al = splitnewlines(a, keepends=True) bl = splitnewlines(b, keepends=True)
al = splitnewlines(a) bl = splitnewlines(b)
def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif not a: b = splitnewlines(b, keepends=True) if a is None: l1 = "--- %s\t%s\n" ...
desc=nl2br(cgi.escape(changes[4])), date=datestr)
desc=nl2br(cgi.escape(changes[4])), date=datestr, files=' '.join(files))
def content(self): changes = self.repo.changelog.read(self.node) i = self.repo.changelog.rev(self.node) parents = self.repo.changelog.parents(self.node) (h1, h2) = [ hg.hex(x) for x in parents ] (i1, i2) = [ self.repo.changelog.rev(x) for x in parents ] datestr = time.asctime(time.gmtime(float(changes[2].split(' ')[0])...
if nodes:
if msng_cl_lst:
def gengroup(): # The set of changed files starts empty. changedfiles = {} # Create a changenode group generator that will call our functions # back to lookup the owning changenode and collect information. group = cl.group(msng_cl_lst, identity, manifest_and_file_collector(changedfiles)) for chnk in group: yield chnk
patch = q.lookup(f) if patch in patches or patch == parent: ui.warn(_('Skipping already folded patch %s') % patch) if q.isapplied(patch): raise util.Abort(_('qfold cannot fold already applied patch %s') % patch) patches.append(patch) for patch in patches:
p = q.lookup(f) if p in patches or p == parent: ui.warn(_('Skipping already folded patch %s') % p) if q.isapplied(p): raise util.Abort(_('qfold cannot fold already applied patch %s') % p) patches.append(p) for p in patches:
def fold(ui, repo, *files, **opts): """fold the named patches into the current patch Patches must not yet be applied. Each patch will be successively applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded...
messages.append(q.readheaders(patch)[0]) pf = q.join(patch)
messages.append(q.readheaders(p)[0]) pf = q.join(p)
def fold(ui, repo, *files, **opts): """fold the named patches into the current patch Patches must not yet be applied. Each patch will be successively applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded...
raise util.Abort(_('Error folding patch %s') % patch)
raise util.Abort(_('Error folding patch %s') % p) patch.updatedir(ui, repo, files)
def fold(ui, repo, *files, **opts): """fold the named patches into the current patch Patches must not yet be applied. Each patch will be successively applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded...
for patch in patches: q.delete(repo, patch, keep=opts['keep'])
q.delete(repo, patches, keep=opts['keep'])
def fold(ui, repo, *files, **opts): """fold the named patches into the current patch Patches must not yet be applied. Each patch will be successively applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded...
"hg grep [options] [pat] [files]"),
"hg grep [OPTION]... [PATTERN] [FILE]..."),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
incmatch = matchfn(map(patkind, inc), '(?:/|$)')
inckinds = [patkind(canonpath(canonroot, cwd, i)) for i in inc] incmatch = matchfn(inckinds, '(?:/|$)')
def globprefix(pat): '''return the non-glob prefix of a path, e.g. foo/* -> foo''' root = [] for p in pat.split(os.sep): if contains_glob(p): break root.append(p) return '/'.join(root)
excmatch = matchfn(map(patkind, exc), '(?:/|$)')
exckinds = [patkind(canonpath(canonroot, cwd, x)) for x in exc] excmatch = matchfn(exckinds, '(?:/|$)')
def globprefix(pat): '''return the non-glob prefix of a path, e.g. foo/* -> foo''' root = [] for p in pat.split(os.sep): if contains_glob(p): break root.append(p) return '/'.join(root)
self.root = path
self.root = os.path.abspath(path)
def __init__(self, ui, path=None, create=0): self.remote = 0 if path and path.startswith("http://"): self.remote = 1 self.path = path else: if not path: p = os.getcwd() while not os.path.isdir(os.path.join(p, ".hg")): oldp = p p = os.path.dirname(p) if p == oldp: raise RepoError("no repo found") path = p self.path = os...
self.current = bin(self.open("current").read()) except:
self.current = bin(self.opener("current").read()) except IOError:
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")
mmap = {}
def diffdir(self, path): dc = self.dircache.copy() changed = [] added = []
mmap = self.manifest.read(change[0])
mf = self.manifest.read(change[0])
def diffdir(self, path): dc = self.dircache.copy() changed = [] added = []
t2 = self.file(fn).revision(mmap[fn])
t2 = self.file(fn).revision(mf[fn])
def diffdir(self, path): dc = self.dircache.copy() changed = [] added = []
branch = changes[5].get("branch")
extra = changes[5] branch = extra.get("branch")
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
except IOError:
except IOError, e: if e.errno != errno.ENOENT: raise
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
blocksize = self.datasize - blockstart
blocksize = max(self.datasize - blockstart, 0)
def loadblock(self, blockstart, blocksize, data=None): if self.all: return if data is None: self.dataf.seek(blockstart) if blockstart + blocksize > self.datasize: # the revlog may have grown since we've started running, # but we don't have space in self.index for more entries. # limit blocksize so that we don't get too...
st = os.stat(p)
st = os.lstat(p)
def findfiles(s): retfiles = [] work = [s] while work: top = work.pop() names = os.listdir(top) names.sort() # nd is the top of the repository dir tree nd = util.normpath(top[len(self.root) + 1:]) if nd == '.': nd = '' for f in names: np = os.path.join(nd, f) if seen(np): continue p = os.path.join(top, f) st = os.stat(...
return mdiff.diff(a, b)
return mdiff.textdiff(a, b)
def diff(self, a, b): # this is sneaky, as we're not actually using a and b if self.listcache and len(self.listcache[0]) == len(a): return mdiff.diff(self.listcache[1], self.addlist, 1) else: return mdiff.diff(a, b)
has_cl_set = dict.fromkeys(hasnodeset)
has_cl_set = dict.fromkeys(has_cl_set)
def changegroupsubset(self, bases, heads): cl = self.changelog # msng = missing msng_cl_lst, bases, heads = cl.nodesbetween(bases, heads) junk = None knownheads = {} for n in bases: for p in cl.parents(n): if p != nullid: knownheads[p] = 1 knownheads = knownheads.keys() if knownheads: has_cl_set, junk, junk = cl.nodesb...
if not args.has_key('cmd') or args['cmd'][0] == 'changelog':
if not args.has_key('cmd'): args['cmd'] = [self.t.cache['default'],] if args['cmd'][0] == 'changelog':
def footer(**map): yield self.t("footer", **map)
except: u.warn(_("failed to import extension %s\n") % x[0])
except Exception, inst: on_exception(Exception, inst)
def importh(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod
self.opener = util.opener(path)
def __init__(self, ui, path, patchdir=None): self.opener = util.opener(path) self.basepath = path if patchdir: self.path = patchdir else: self.path = os.path.join(path, "patches") self.ui = ui self.applied = [] self.full_series = [] self.applied_dirty = 0 self.series_dirty = 0 self.series_path = os.path.join(self.path,...
self.series_path = os.path.join(self.path, "series") self.status_path = os.path.join(self.path, "status") s = self.series_path if os.path.exists(s): self.full_series = self.opener(s).read().splitlines()
self.series_path = "series" self.status_path = "status" if os.path.exists(os.path.join(self.path, self.series_path)): self.full_series = self.opener(self.series_path).read().splitlines()
def __init__(self, ui, path, patchdir=None): self.opener = util.opener(path) self.basepath = path if patchdir: self.path = patchdir else: self.path = os.path.join(path, "patches") self.ui = ui self.applied = [] self.full_series = [] self.applied_dirty = 0 self.series_dirty = 0 self.series_path = os.path.join(self.path,...
s = self.status_path if os.path.exists(s): self.applied = self.opener(s).read().splitlines()
if os.path.exists(os.path.join(self.path, self.status_path)): self.applied = self.opener(self.status_path).read().splitlines()
def __init__(self, ui, path, patchdir=None): self.opener = util.opener(path) self.basepath = path if patchdir: self.path = patchdir else: self.path = os.path.join(path, "patches") self.ui = ui self.applied = [] self.full_series = [] self.applied_dirty = 0 self.series_dirty = 0 self.series_path = os.path.join(self.path,...
patchf = self.opener(os.path.join(self.path, patch), "w")
patchf = self.opener(patch, "w")
def mergeone(self, repo, mergeq, head, patch, rev, wlock): # first try just applying the patch (err, n) = self.apply(repo, [ patch ], update_status=False, strict=True, merge=rev, wlock=wlock)
p = self.opener(os.path.join(self.path, patch), "w")
p = self.opener(patch, "w")
def new(self, repo, patch, msg=None, force=None): if not force: self.check_localchanges(repo) self.check_toppatch(repo) wlock = repo.wlock() insert = self.series_end() if msg: n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) else: n = repo.commit([], "New patch: %s" % patch, force=True, wlock=wlock) if n ...
patchf = self.opener(os.path.join(self.path, patch), "w")
patchf = self.opener(patch, "w")
def refresh(self, repo, short=False): if len(self.applied) == 0: self.ui.write("No patches applied\n") return wlock = repo.wlock() self.check_toppatch(repo) qp = self.qparents(repo) (top, patch) = self.applied[-1].split(':') top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo, ...
if (fl not in self.series and fl != "status" and fl != "series" and not fl.startswith('.')):
if (fl not in self.series and fl not in (self.status_path, self.series_path) and not fl.startswith('.')):
def qseries(self, repo, missing=None): start = self.series_end() if not missing: for p in self.series[:start]: if self.ui.verbose: self.ui.write("%d A " % self.series.index(p)) self.ui.write("%s\n" % p) for p in self.series[start:]: if self.ui.verbose: self.ui.write("%d U " % self.series.index(p)) self.ui.write("%s\n" ...
patchf = self.opener(os.path.join(self.path, patch), "w")
patchf = self.opener(patch, "w")
def qimport(self, repo, files, patch=None, existing=None, force=None): if len(files) > 1 and patch: self.ui.warn("-n option not valid when importing multiple files\n") sys.exit(1) i = 0 for filename in files: if existing: if not patch: patch = filename if not os.path.isfile(os.path.join(self.path, patch)): self.ui.warn...
os.unlink(q.status_path)
os.unlink(os.path.join(q.path, q.status_path))
def save(ui, repo, **opts): """save current queue state""" q = repomap[repo] ret = q.save(repo, msg=opts['message']) if ret: return ret q.save_dirty() if opts['copy']: path = q.path if opts['name']: newpath = os.path.join(q.basepath, opts['name']) if os.path.exists(newpath): if not os.path.isdir(newpath): ui.warn("dest...
def parent(self, t1, node, rev):
def parent(self, t1, node=nullid, rev=-1, **args):
def parent(self, t1, node, rev): if node != hex(nullid): yield self.t(t1, node = node, rev = rev)
yield self.t(t1, node = node, rev = rev)
yield self.t(t1, node = node, rev = rev, **args)
def parent(self, t1, node, rev): if node != hex(nullid): yield self.t(t1, node = node, rev = rev)
hex(p1), fl.rev(p1)),
hex(p1), fl.rev(p1), file=f),
def lines(): for l, t in enumerate(text.splitlines(1)): yield self.t("fileline", line = t, linenumber = "% 6d" % (l + 1), parity = l & 1)
hex(p2), fl.rev(p2)),
hex(p2), fl.rev(p2), file=f),
def lines(): for l, t in enumerate(text.splitlines(1)): yield self.t("fileline", line = t, linenumber = "% 6d" % (l + 1), parity = l & 1)
parent1 = self.parent("filerevparent", hex(p1), fl.rev(p1)), parent2 = self.parent("filerevparent", hex(p2), fl.rev(p2)),
parent1 = self.parent("fileannotateparent", hex(p1), fl.rev(p1), file=f), parent2 = self.parent("fileannotateparent", hex(p2), fl.rev(p2), file=f),
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
np = os.path.join(nd, f)
np = util.pconvert(os.path.join(nd, f))
def findfiles(s): work = [s] while work: top = work.pop() names = os.listdir(top) names.sort() # nd is the top of the repository dir tree nd = util.normpath(top[len(self.root) + 1:]) if nd == '.': nd = '' for f in names: np = os.path.join(nd, f) if seen(np): continue p = os.path.join(top, f) # don't trip over symlinks ...
yield 'm', util.pconvert(np), st
yield 'm', np, st
def findfiles(s): work = [s] while work: top = work.pop() names = os.listdir(top) names.sort() # nd is the top of the repository dir tree nd = util.normpath(top[len(self.root) + 1:]) if nd == '.': nd = '' for f in names: np = os.path.join(nd, f) if seen(np): continue p = os.path.join(top, f) # don't trip over symlinks ...