rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
class Test(object): def __init__(self, suite, name): self.suite = suite self.name = name | def __find_suite(self, name): cur = self.db.cursor() cur.execute('SELECT id FROM tinu_suites WHERE name = ? AND run_id = ?', (name, self.run_id)) return cur.fetchone()['id'] | def parse_item(self, key, value): if key == 'passed': self.passed = int(value) |
self.result = '' self.asserts = Asserts() self.time = 0 | def __delete_last_id(self): id = self.__get_last_id('tinu_run_versions') with self.db: self.db.execute("DELETE FROM tinu_run_versions WHERE id = ?", (id, )) self.db.execute("UPDATE sqlite_sequence SET seq = seq - 1 WHERE name = 'tinu_run_versions'") | def __init__(self, suite, name): self.suite = suite self.name = name |
def parse_item(self, key, value): if key == 'result': self.result = value | def parse_item(self, key, value): if key == 'result': self.result = value | |
if key == 'time': self.time = float(value) elif is_prefix(key, 'asserts'): _, rest = key.split('.', 1) self.asserts.parse_item(rest, value) def load_backend(self, backend, result, assert_total, assert_passed, time): self.result = result self.asserts.total = assert_total self.asserts.passed = assert_passed self.time =... | def parse_item(self, key, value): if key == 'result': self.result = value | |
pass @virtual def load_message_counts(self): pass @virtual def load_suites(self): pass @virtual def load_tests(self, suite): pass @virtual def save_results(self, results): pass class ExampleBackend(Backend): def __init__(self, state): self.saved = state def load_summary(self): return self.saved.summary.passed, se... | cur = self.db.cursor() cur.execute('SELECT * FROM tinu_summary WHERE run_id = ? LIMIT 1', (self.run_id, )) line = cur.fetchone() return line['passed'], line['failed'], line['segfault'] | def load_summary(self): pass |
return self.saved.messages.msgcount | cur = self.db.cursor() cur.execute('SELECT * FROM tinu_messages WHERE run_id = ? LIMIT 1', (self.run_id, )) line = cur.fetchone() return line def load_tests(self, suite): suite_id = self.__find_suite(suite) cur = self.db.cursor() cur.execute('SELECT name, result, assert_passed, assert_total, time FROM tinu_suites WHER... | def load_message_counts(self): return self.saved.messages.msgcount |
for name, obj in self.saved.suites.iteritems(): yield name, obj.result, obj.asserts.total, obj.asserts.passed def load_tests(self, suite): for name, obj in self.saved.suites[suite].tests.iteritems(): yield name, obj.result, obj.asserts.total, obj.asserts.passed, obj.time | cur = self.db.cursor() cur.execute('SELECT name, result, assert_passed, assert_total FROM tinu_suites WHERE run_id = ?', (self.run_id, )) for value in cur: yield value | def load_suites(self, suite): for name, obj in self.saved.suites.iteritems(): yield name, obj.result, obj.asserts.total, obj.asserts.passed |
self.saved = results | self.__create_run_id() try: with self.db: self.db.execute("INSERT INTO tinu_summary (run_id, passed, failed, segfault) VALUES (?, ?, ?, ?)", (self.run_id, results.summary.passed, results.summary.failed, results.summary.segfault)) self.db.execute("INSERT INTO tinu_messages (critical, error, warning, notice, info, debug)... | def save_results(self, results): self.saved = results |
def dump(self): res = [] def _(*args): res.append(' '.join(map(str, args))) | for name, suite in results.suites.iteritems(): self.db.execute("INSERT INTO tinu_suites (run_id, name, result, assert_passed, assert_total) VALUES (?, ?, ?, ?, ?)", (self.run_id, name, suite.result, suite.asserts.passed, suite.asserts.total)) suite_id = self.__get_last_id('tinu_suites') | def dump(self): res = [] def _(*args): res.append(' '.join(map(str, args))) |
_('Summary') _(' Passed : %s' % self.saved.summary.passed) _(' Failed : %s' % self.saved.summary.failed) _(' SIGSEGV: %s' % self.saved.summary.segfault) | with self.db: for test, case in suite.tests.iteritems(): self.db.execute('INSERT INTO tinu_tests (suite_id, name, result, assert_passed, assert_total, run_time) VALUES (?, ?, ?, ?, ?, ?)', (suite_id, test, case.result, case.asserts.passed, case.asserts.total, case.time)) | def _(*args): res.append(' '.join(map(str, args))) |
_('Message counts') for key, value in self.saved.messages.msgcount.iteritems(): _(' %s = %s' % (key, value)) | except: self.__delete_last_id() raise | def _(*args): res.append(' '.join(map(str, args))) |
for name, suite in self.saved.suites.iteritems(): _('Suite %s' % name) _(' Result: %s' % suite.result) _(' Assert passes: %d/%d' % (suite.asserts.passed, suite.asserts.total)) | try: backend = SqliteBackend(sys.argv[2]) | def _(*args): res.append(' '.join(map(str, args))) |
for tname, case in suite.tests.iteritems(): _(' Test case %s' % tname) _(' Result : %s' % case.result) _(' Assert passes: %d/%d' % (case.asserts.passed, case.asserts.total)) _(' Time : %.3lf' % case.time) | except IndexError: sys.stderr.write('usage: %s <file> <db>\n', sys.argv[0]) sys.exit(-1) | def _(*args): res.append(' '.join(map(str, args))) |
return res def load_using_args(): import sys cfg = TinuResult() try: cfg.load_file(sys.argv[1]) except IndexError: sys.stderr.write("Usage: %s <filename>\n" % sys.argv[0]) sys.exit(-1) return cfg | load_using_args().save_backend(backend) | def _(*args): res.append(' '.join(map(str, args))) |
def debugdata(ui, file_, rev): | def debugdata(ui, repo, file_, rev): | def debugdata(ui, file_, rev): """dump the contents of a data file revision""" r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") try: ui.write(r.revision(r.lookup(rev))) except KeyError: raise util.Abort(_('invalid revision identifier %s') % rev) |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") | r = None if repo: filelog = repo.file(file_) if len(filelog): r = filelog if not r: r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") | def debugdata(ui, file_, rev): """dump the contents of a data file revision""" r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") try: ui.write(r.revision(r.lookup(rev))) except KeyError: raise util.Abort(_('invalid revision identifier %s') % rev) |
norepo = ("clone init version help debugcommands debugcomplete debugdata" | norepo = ("clone init version help debugcommands debugcomplete" | def version_(ui): """output version and copyright information""" ui.write(_("Mercurial Distributed SCM (version %s)\n") % util.version()) ui.status(_( "\nCopyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others\n" "This is free software; see the source for copying conditions. " "There is NO\nwarranty; " "not e... |
optionalrepo = ("identify paths serve showconfig debugancestor debugdag") | optionalrepo = ("identify paths serve showconfig debugancestor debugdag" " debugdata") | def version_(ui): """output version and copyright information""" ui.write(_("Mercurial Distributed SCM (version %s)\n") % util.version()) ui.status(_( "\nCopyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others\n" "This is free software; see the source for copying conditions. " "There is NO\nwarranty; " "not e... |
wctx.copy(src, dst) | dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd) | def updatedir(ui, repo, patches, similarity=0): '''Update dirstate after patch application according to metadata''' if not patches: return copies = [] removes = set() cfiles = patches.keys() cwd = repo.getcwd() if cwd: cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()] for f in patches: gp = patches[f] i... |
origsrc = repo.dirstate.copied(abssrc) or abssrc if abstarget == origsrc: if state not in 'mn' and not dryrun: repo.dirstate.normallookup(abstarget) else: if repo.dirstate[origsrc] == 'a' and origsrc == abssrc: if not ui.quiet: ui.warn(_("%s has not been committed yet, so no copy " "data will be stored for %s.\n") % (r... | dirstatecopy(ui, repo, wctx, abssrc, abstarget, dryrun=dryrun, cwd=cwd) | def copyfile(abssrc, relsrc, otarget, exact): abstarget = util.canonpath(repo.root, cwd, otarget) reltarget = repo.pathto(abstarget, cwd) target = repo.wjoin(abstarget) src = repo.wjoin(abssrc) state = repo.dirstate[abstarget] |
Extension('mercurial.osutil', ['mercurial/osutil.c']), | def find_modules(self): modules = build_py.find_modules(self) for module in modules: if module[0] == "mercurial.pure": if module[1] != "__init__": yield ("mercurial", module[1], module[2]) else: yield module | |
packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert', 'hgext.highlight', 'hgext.zeroconf'] | if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'): pymodules.append('mercurial.pure.osutil') else: extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c'])) | def find_modules(self): modules = build_py.find_modules(self) for module in modules: if module[0] == "mercurial.pure": if module[1] != "__init__": yield ("mercurial", module[1], module[2]) else: yield module |
tail = spacejoin(add, tail) | tail = spacejoin(tail, add) | def show(self, now, topic, pos, item, unit, total): if not shouldprint(self.ui): return termwidth = self.width() self.printed = True head = '' needprogress = False tail = '' for indicator in self.order: add = '' if indicator == 'topic': add = topic elif indicator == 'number': if total: add = ('% ' + str(len(str(total))... |
style = ui.config('ui', 'style') | style = util.expandpath(ui.config('ui', 'style', '')) | def show_changeset(ui, repo, opts, buffered=False, matchfn=False): """show one changeset using template or regular display. Display format will be the first non-empty hit of: 1. option 'template' 2. option 'style' 3. [ui] setting 'logtemplate' 4. [ui] setting 'style' If all of these values are either the unset or the ... |
cs = cStringIO.StringIO() copymap = self._copymap pack = struct.pack write = cs.write write("".join(self._pl)) for f, e in self._map.iteritems(): if f in copymap: f = "%s\0%s" % (f, copymap[f]) | for f in self._map.keys(): e = self._map[f] | def write(self): if not self._dirty: return st = self._opener("dirstate", "w", atomictemp=True) |
e = (e[0], 0, -1, -1) | self._map[f] = (e[0], 0, -1, -1) cs = cStringIO.StringIO() copymap = self._copymap pack = struct.pack write = cs.write write("".join(self._pl)) for f, e in self._map.iteritems(): if f in copymap: f = "%s\0%s" % (f, copymap[f]) | def write(self): if not self._dirty: return st = self._opener("dirstate", "w", atomictemp=True) |
info.mode, info.issym(), tar.extractfile(info).read()) | info.mode, info.issym(), data) | def archive(self, ui, archiver, prefix): source, revision = self._state self._fetch(source, revision) |
if of == f or of == c2.path(): | if cr and (cr.path() == f or cr.path == c2.path()): | def checkcopies(f, m1, m2): '''check possible copies of f from m1 to m2''' of = None seen = set([f]) for oc in ctx(f, m1[f]).ancestors(): ocr = oc.rev() of = oc.path() if of in seen: # check limit late - grab last rename before if ocr < limit: break continue seen.add(of) |
def pathstrip(path, count=1): | def pathstrip(path, strip): | def pathstrip(path, count=1): pathlen = len(path) i = 0 if count == 0: return '', path.rstrip() while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d dirs from %s") % (count, path)) i += 1 # consume '//' in the path while i < pathlen - 1 and path[i] == '/': i += 1 count -= 1 ret... |
if count == 0: | if strip == 0: | def pathstrip(path, count=1): pathlen = len(path) i = 0 if count == 0: return '', path.rstrip() while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d dirs from %s") % (count, path)) i += 1 # consume '//' in the path while i < pathlen - 1 and path[i] == '/': i += 1 count -= 1 ret... |
raise PatchError(_("unable to strip away %d dirs from %s") % (count, path)) | raise PatchError(_("unable to strip away %d of %d dirs from %s") % (count, strip, path)) | def pathstrip(path, count=1): pathlen = len(path) i = 0 if count == 0: return '', path.rstrip() while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d dirs from %s") % (count, path)) i += 1 # consume '//' in the path while i < pathlen - 1 and path[i] == '/': i += 1 count -= 1 ret... |
self.added = [] | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) | |
print response.status, response.reason | print response.status, reasons.get(response.reason, response.reason) | def request(host, path, show): global tag headers = {} if tag: headers['If-None-Match'] = tag conn = httplib.HTTPConnection(host) conn.request("GET", path, None, headers) response = conn.getresponse() print response.status, response.reason for h in [h.lower() for h in show]: if response.getheader(h, None) is not None... |
repo.ui.debug(repr(x), '\n') | def parents(repo, subset, x): """``parents([set])`` The set of all parents for all changesets in set, or the working directory. """ repo.ui.debug(repr(x), '\n') if x is None: ps = tuple(p.rev() for p in repo[x].parents()) return [r for r in subset if r in ps] ps = set() cl = repo.changelog for r in getset(repo, range(... | |
cmd = args.pop(0) | self.cmdname = cmd = args.pop(0) | def _checkvar(m): if int(m.groups()[0]) <= len(args): return m.group() else: return '' |
ui.debug("alias '%s' shadows command\n" % self.name) | ui.debug("alias '%s' shadows command '%s'\n" % (self.name, self.cmdname)) | def __call__(self, ui, *args, **opts): if self.shadows: ui.debug("alias '%s' shadows command\n" % self.name) |
gitworkdone = False | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... | |
gitworkdone = True | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... | |
if newfile: gitworkdone = False | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... | |
etree.parse(fp) | etree.parse(fp, parser=parser) | def xml(self, cmd, **kwargs): # NOTE: darcs is currently encoding agnostic and will print # patch metadata byte-for-byte, even in the XML changelog. etree = ElementTree() fp = self._run(cmd, **kwargs) etree.parse(fp) self.checkexit(fp.close()) return etree.getroot() |
newheads = [head for head in newheads if len(repo[head].children()) == 0] | def fetch(ui, repo, source='default', **opts): '''pull changes from a remote repository, merge new changes if needed. This finds all changes from the repository at the specified path or URL and adds them to the local repository. If the pulled changes add a new branch head, the head is automatically merged, and the re... | |
elif not to: | elif not to or util.binary(to): | def trydiff(repo, revs, ctx1, ctx2, modified, added, removed, copy, getfilectx, opts, losedatafn): date1 = util.datestr(ctx1.date()) man1 = ctx1.manifest() gone = set() gitmode = {'l': '120000', 'x': '100755', '': '100644'} copyto = dict([(v, k) for k, v in copy.items()]) if opts.git: revs = None for f in sorted(m... |
if el.startswith('|'): el = '\\' + el | def rematch(el, l): try: # hack to deal with graphlog, which looks like bogus regexes if el.startswith('|'): el = '\\' + el # ensure that the regex matches to the end of the string return re.match(el + r'\Z', l) except re.error: # el is an invalid regex return False | |
elif el and el[2:] and rematch(el, l): postout.append(" " + el) else: postout.append(" " + l) | elif el and el.endswith(" (re)\n") and rematch(el[:-6] + '\n', l): postout.append(" " + el) else: postout.append(" " + l) | def rematch(el, l): try: # hack to deal with graphlog, which looks like bogus regexes if el.startswith('|'): el = '\\' + el # ensure that the regex matches to the end of the string return re.match(el + r'\Z', l) except re.error: # el is an invalid regex return False |
hg.repository(hg.remoteui(ui, opts), dest, create=1) | hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1) | def init(ui, dest=".", **opts): """create a new repository in the given directory Initialize a new repository in the given directory. If the given directory does not exist, it will be created. If no directory is given, the current directory is used. It is possible to specify an ``ssh://`` URL as the destination. See... |
def overwrite(self, node, expand, candidates): | def overwrite(self, node, expand, candidates, recctx=None): | def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit candidates = [f for f in ctx.files() if f in mf] candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] if candidates: sel... |
ctx = self.repo[node] | if recctx is None: ctx = self.repo[node] else: ctx = recctx | def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit candidates = [f for f in ctx.files() if f in mf] candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] if candidates: sel... |
fp = self.repo.file(f) data = fp.read(mf[f]) | if recctx is None: data = self.repo.file(f).read(mf[f]) else: data = self.repo.wread(f) | def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit candidates = [f for f in ctx.files() if f in mf] candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] if candidates: sel... |
kwt.overwrite(n, True, None) | if not kwt.record: kwt.overwrite(n, True, None) | def kwcommitctx(self, ctx, error=False): n = super(kwrepo, self).commitctx(ctx, error) # no lock needed, only called from repo.commit() which already locks kwt.overwrite(n, True, None) return n |
addrs = (ui.config('email', opt) or ui.config('patchbomb', opt) or '') | addrs = ui.config('email', opt) or ui.config('patchbomb', opt) or '' | def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if addrs: return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) |
if not opts.get('no_commit'): | if opts.get('no_commit'): if message: msgs.append(message) else: | def tryone(ui, hunk): tmpname, message, user, date, branch, nodeid, p1, p2 = \ patch.extract(ui, hunk) |
for l in self.transplants.itervalues(): for c in l: l, r = map(revlog.hex, (c.lnode, c.rnode)) | for list in self.transplants.itervalues(): for t in list: l, r = map(revlog.hex, (t.lnode, t.rnode)) | def write(self): if self.dirty and self.transplantfile: if not os.path.isdir(self.path): os.mkdir(self.path) fp = self.opener(self.transplantfile, 'w') for l in self.transplants.itervalues(): for c in l: l, r = map(revlog.hex, (c.lnode, c.rnode)) fp.write(l + ':' + r + '\n') fp.close() self.dirty = False |
def externalpatch(patcher, args, patchname, ui, strip, cwd, files): | def externalpatch(patcher, patchname, ui, strip, cwd, files): | def externalpatch(patcher, args, patchname, ui, strip, cwd, files): """use <patcher> to apply <patchname> to the working directory. returns whether patch was applied with fuzz factor.""" fuzz = False if cwd: args.append('-d %s' % util.shellquote(cwd)) fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip... |
args = [] | def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'): """Apply <patchname> to the working directory. 'eolmode' specifies how end of lines should be handled. It can be: - 'strict': inputs are read in binary mode, EOLs are preserved - 'crlf': EOLs are ignored when patching and reset to CRLF - 'lf': ... | |
return externalpatch(patcher, args, patchname, ui, strip, cwd, files) | return externalpatch(patcher, patchname, ui, strip, cwd, files) | def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'): """Apply <patchname> to the working directory. 'eolmode' specifies how end of lines should be handled. It can be: - 'strict': inputs are read in binary mode, EOLs are preserved - 'crlf': EOLs are ignored when patching and reset to CRLF - 'lf': ... |
self.ui = self.baseui.copy() | u = self.baseui.copy() | def refresh(self): if self.lastrefresh + self.refreshinterval > time.time(): return |
self.ui = ui.ui() self.ui.setconfig('ui', 'report_untrusted', 'off') self.ui.setconfig('ui', 'interactive', 'off') | u = ui.ui() u.setconfig('ui', 'report_untrusted', 'off') u.setconfig('ui', 'interactive', 'off') | def refresh(self): if self.lastrefresh + self.refreshinterval > time.time(): return |
self.ui.readconfig(self.conf, remap=map, trust=True) paths = self.ui.configitems('hgweb-paths') | u.readconfig(self.conf, remap=map, trust=True) paths = u.configitems('hgweb-paths') | def refresh(self): if self.lastrefresh + self.refreshinterval > time.time(): return |
self.repos = findrepos(paths) for prefix, root in self.ui.configitems('collections'): prefix = util.pconvert(prefix) for path in util.walkrepos(root, followsym=True): repo = os.path.normpath(path) name = util.pconvert(repo) if name.startswith(prefix): name = name[len(prefix):] self.repos.append((name.lstrip('/'), repo)... | def refresh(self): if self.lastrefresh + self.refreshinterval > time.time(): return | |
if cachehit and self._cache: global _cached _cached += 1 | if cachehit: | def revision(self, node): """return an uncompressed revision of a given node""" cachedrev = None if node == nullid: return "" if self._cache: if self._cache[0] == node: return self._cache[2] cachedrev = self._cache[1] |
else: global _uncached _uncached += 1 | def revision(self, node): """return an uncompressed revision of a given node""" cachedrev = None if node == nullid: return "" if self._cache: if self._cache[0] == node: return self._cache[2] cachedrev = self._cache[1] | |
write, read, err = util.popen3(cmd, env=env, newlines=True) retdata = read.read() err = err.read().strip() if err: raise util.Abort(err) return retdata | p = subprocess.Popen(cmd, shell=True, bufsize=-1, close_fds=util.closefds, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, env=env) stdout, stderr = p.communicate() stderr = stderr.strip() if stderr: raise util.Abort(stderr) return stdout | def _svncommand(self, commands, filename=''): path = os.path.join(self._ctx._repo.origroot, self._path, filename) cmd = ['svn'] + commands + [path] cmd = [util.shellquote(arg) for arg in cmd] cmd = util.quotecommand(' '.join(cmd)) env = dict(os.environ) # Avoid localized output, preserve current locale for everything e... |
args[0], args[1], args[2]) | int(args[0]) - 1, args[1], args[2]) | def rollback(self, dryrun=False): wlock = lock = None try: wlock = self.wlock() lock = self.lock() if os.path.exists(self.sjoin("undo")): try: args = self.opener("undo.desc", "r").read().splitlines() if len(args) >= 3 and self.ui.verbose: desc = _("rolling back to revision %s" " (undo %s: %s)\n") % ( args[0], args[1], ... |
args[0], args[1]) | int(args[0]) - 1, args[1]) | def rollback(self, dryrun=False): wlock = lock = None try: wlock = self.wlock() lock = self.lock() if os.path.exists(self.sjoin("undo")): try: args = self.opener("undo.desc", "r").read().splitlines() if len(args) >= 3 and self.ui.verbose: desc = _("rolling back to revision %s" " (undo %s: %s)\n") % ( args[0], args[1], ... |
this for ad-hoc sharing and browing of repositories. It is | this for ad-hoc sharing and browsing of repositories. It is | def serve(ui, repo, **opts): """start stand-alone webserver Start a local HTTP repository browser and pull server. You can use this for ad-hoc sharing and browing of repositories. It is recommended to use a real web server to serve a repository for longer periods of time. Please note that the server does not implemen... |
formail -s sendmail \ | formail -s sendmail \\ | def patchbomb(ui, repo, *revs, **opts): '''send changesets by email By default, diffs are sent in the format generated by :hg:`export`, one per message. The series starts with a "[PATCH 0 of N]" introduction, which describes the series as a whole. Each patch email has a Subject line of "[PATCH M of N] ...", using the... |
diffopts.context = 0 | diffopts = diffopts.copy(context=0) | def write(s, **kw): fp.write(s) |
diffordiffstat(self.ui, self.repo, diffopts, prev, node, match=matchfn, stat=stat) | if stat: diffordiffstat(self.ui, self.repo, diffopts, prev, node, match=matchfn, stat=True) if diff: if stat: self.ui.write("\n") diffordiffstat(self.ui, self.repo, diffopts, prev, node, match=matchfn, stat=False) | def showpatch(self, node, matchfn): if not matchfn: matchfn = self.patch if matchfn: stat = self.diffopts.get('stat') diffopts = patch.diffopts(self.ui, self.diffopts) prev = self.repo.changelog.parents(node)[0] diffordiffstat(self.ui, self.repo, diffopts, prev, node, match=matchfn, stat=stat) self.ui.write("\n") |
This command is depreacted. Without -c, it's implied by other relevant | This command is deprecated. Without -c, it's implied by other relevant | def init(ui, repo, **opts): """init a new queue repository (DEPRECATED) The queue repository is unversioned by default. If -c/--create-repo is specified, qinit will create a separate nested repository for patches (qinit -c may also be run later to convert an unversioned patch repository into a versioned one). You can ... |
def revsingle(repo, revspec, default=None): | def revsingle(repo, revspec, default='.'): | def revsingle(repo, revspec, default=None): if not revspec: return repo[default] l = revrange(repo, [revspec]) if len(l) < 1: raise util.Abort("empty revision set") return repo[l[-1]] |
def needbinarypatch(): """return True if patches should be applied in binary mode by default.""" return os.name == 'nt' | def needbinarypatch(): """return True if patches should be applied in binary mode by default.""" return os.name == 'nt' | |
msg = "%s%s: %s" % (pfx, patchname, msg) | self.ui.write(patchname, label='qseries.' + state) self.ui.write(': ') self.ui.write(msg, label='qseries.message.' + state) | def displayname(pfx, patchname, state): if summary: ph = patchheader(self.join(patchname), self.plainmode) msg = ph.message and ph.message[0] or '' if self.ui.interactive(): width = util.termwidth() - len(pfx) - len(patchname) - 2 if width > 0: msg = util.ellipsis(msg, width) else: msg = '' msg = "%s%s: %s" % (pfx, pat... |
msg = pfx + patchname self.ui.write(msg + '\n', label='qseries.' + state) | self.ui.write(patchname, label='qseries.' + state) self.ui.write('\n') | def displayname(pfx, patchname, state): if summary: ph = patchheader(self.join(patchname), self.plainmode) msg = ph.message and ph.message[0] or '' if self.ui.interactive(): width = util.termwidth() - len(pfx) - len(patchname) - 2 if width > 0: msg = util.ellipsis(msg, width) else: msg = '' msg = "%s%s: %s" % (pfx, pat... |
shutil.rmtree(self._ctx._repo.wjoin(self._path)) | def onerror(function, path, excinfo): if function is not os.remove: raise s = os.stat(path) if (s.st_mode & stat.S_IWRITE) != 0: raise os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE) os.remove(path) shutil.rmtree(self._ctx._repo.wjoin(self._path), onerror=onerror) | def remove(self): if self.dirty(): self._ui.warn(_('not removing repo %s because ' 'it has changes.\n' % self._path)) return self._ui.note(_('removing subrepo %s\n') % self._path) shutil.rmtree(self._ctx._repo.wjoin(self._path)) |
if opts.get(opt): return mail.addrlistencode(ui, opts.get(opt), _charsets, | addrs = opts.get(opt.replace('-', '_')) if addrs: return mail.addrlistencode(ui, addrs, _charsets, | def getaddrs(opt, prpt=None, default=None): if opts.get(opt): return mail.addrlistencode(ui, opts.get(opt), _charsets, opts.get('test')) |
self._diffopts = None | def __init__(self, ui, path, patchdir=None): self.basepath = path self.path = patchdir or os.path.join(path, "patches") self.opener = util.opener(self.path) self.ui = ui self.applied_dirty = 0 self.series_dirty = 0 self.series_path = "series" self.status_path = "status" self.guards_path = "guards" self.active_guards = ... | |
def diffopts(self): if self._diffopts is None: self._diffopts = patch.diffopts(self.ui) return self._diffopts | def diffopts(self, opts={}, patchfn=None): diffopts = patch.diffopts(self.ui, opts) if patchfn: patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): diffopts.git = True break return diffopts | def diffopts(self): if self._diffopts is None: self._diffopts = patch.diffopts(self.ui) return self._diffopts |
def printdiff(self, repo, node1, node2=None, files=None, | def printdiff(self, repo, diffopts, node1, node2=None, files=None, | def printdiff(self, repo, node1, node2=None, files=None, fp=None, changes=None, opts={}): stat = opts.get('stat') if stat: opts['unified'] = '0' |
chunks = patch.diff(repo, node1, node2, m, changes, self.diffopts()) | chunks = patch.diff(repo, node1, node2, m, changes, diffopts) | def printdiff(self, repo, node1, node2=None, files=None, fp=None, changes=None, opts={}): stat = opts.get('stat') if stat: opts['unified'] = '0' |
git=self.diffopts().git)) | git=diffopts.git)) | def printdiff(self, repo, node1, node2=None, files=None, fp=None, changes=None, opts={}): stat = opts.get('stat') if stat: opts['unified'] = '0' |
def mergeone(self, repo, mergeq, head, patch, rev): | def mergeone(self, repo, mergeq, head, patch, rev, diffopts): | def mergeone(self, repo, mergeq, head, patch, rev): # first try just applying the patch (err, n) = self.apply(repo, [ patch ], update_status=False, strict=True, merge=rev) |
self.printdiff(repo, head, n, fp=patchf) | self.printdiff(repo, diffopts, head, n, fp=patchf) | def mergeone(self, repo, mergeq, head, patch, rev): # first try just applying the patch (err, n) = self.apply(repo, [ patch ], update_status=False, strict=True, merge=rev) |
def mergepatch(self, repo, mergeq, series): | def mergepatch(self, repo, mergeq, series, diffopts): | def mergepatch(self, repo, mergeq, series): 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 way # t... |
(err, head) = self.mergeone(repo, mergeq, head, patch, rev) | err, head = self.mergeone(repo, mergeq, head, patch, rev, diffopts) | def mergepatch(self, repo, mergeq, series): 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 way # t... |
diffopts = self.diffopts() if opts.get('git'): diffopts.git = True | def badfn(f, msg): raise util.Abort('%s: %s' % (f, msg)) | |
ret = self.mergepatch(repo, mergeq, s) | ret = self.mergepatch(repo, mergeq, s, diffopts) | def push(self, repo, patch=None, force=False, list=False, mergeq=None, all=False): wlock = repo.wlock() try: if repo.dirstate.parents()[0] not in repo.heads(): self.ui.status(_("(working directory not at a head)\n")) |
self._diffopts = patch.diffopts(self.ui, opts) self.printdiff(repo, node1, node2, files=pats, opts=opts) | diffopts = self.diffopts(opts) self.printdiff(repo, diffopts, node1, node2, files=pats, opts=opts) | def diff(self, repo, pats, opts): top = self.check_toppatch(repo) if not top: self.ui.write(_("no patches applied\n")) return qp = self.qparents(repo, top) if opts.get('reverse'): node1, node2 = None, qp else: node1, node2 = qp, None self._diffopts = patch.diffopts(self.ui, opts) self.printdiff(repo, node1, node2, file... |
patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): self.diffopts().git = True break | diffopts = self.diffopts({'git': opts.get('git')}, patchfn) | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... |
if opts.get('git'): self.diffopts().git = True | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... | |
changes=c, opts=self.diffopts()) | changes=c, opts=diffopts) | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... |
if self.diffopts().git: | if diffopts.git: | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... |
self.printdiff(repo, patchparent, fp=patchf) | self.printdiff(repo, diffopts, patchparent, fp=patchf) | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... |
if git: self.diffopts().git = True | diffopts = self.diffopts({'git': git}) | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) |
patch.export(repo, [n], fp=patchf, opts=self.diffopts()) | patch.export(repo, [n], fp=patchf, opts=diffopts) | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) |
return self._status[5] | return self._status[6] | def clean(self): return self._status[5] |
if 'PAGER' in os.environ: | if 'PAGER' in os.environ and not ui.plain(): | def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if addrs: return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) |
l = getargs(x, 1, 1, _("rev wants one argument")) n = getstring(l[0], _("rev wants a string")) | l = getargs(x, 1, 1, _("id wants one argument")) n = getstring(l[0], _("id wants a string")) | def node(repo, subset, x): l = getargs(x, 1, 1, _("rev wants one argument")) n = getstring(l[0], _("rev wants a string")) if len(n) == 40: rn = repo[n].rev() else: rn = repo.changelog.rev(repo.changelog._partialmatch(n)) return [r for r in subset if r == rn] |
print 'out', dest, o | def outgoing(repo, subset, x): import hg # avoid start-up nasties l = getargs(x, 0, 1, _("outgoing wants a repository path")) dest = l[1:] or '' dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest) other = hg.repository(hg.remoteui(repo, {}), dest) repo.ui.pushbuffer()... | |
newfile = False | newfile = newgitfile = False | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... |
newfile = True | newgitfile = True | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.