rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if newfile: | if newgitfile or newfile: | 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 ... |
for n in heads: branch = self[n].branch() localbrheads.setdefault(branch, []).append(n) | ctxgen = (self[n] for n in msng_cl) self._updatebranchcache(localbrheads, ctxgen) | def checkbranch(lheads, rheads, updatelb, branchname=None): ''' check whether there are more local heads than remote heads on a specific branch. |
fuzzstr = "with fuzz %d " % fuzzlen f = self.ui.warn | msg = _("Hunk "with fuzz %d " "(offset %d lines).\n") | def apply(self, h): if not h.complete(): raise PatchError(_("bad hunk #%d %s (%d %d %d %d)") % (h.number, h.desc, len(h.a), h.lena, len(h.b), h.lenb)) |
fuzzstr = "" f = self.ui.note offset = l - orig_start - fuzzlen if offset == 1: msg = _("Hunk "(offset %d line).\n") else: msg = _("Hunk | msg = _("Hunk | def apply(self, h): if not h.complete(): raise PatchError(_("bad hunk #%d %s (%d %d %d %d)") % (h.number, h.desc, len(h.a), h.lena, len(h.b), h.lenb)) |
f(msg % (h.number, l + 1, fuzzstr, offset)) | self.ui.note(msg % (h.number, l + 1, offset)) | def apply(self, h): if not h.complete(): raise PatchError(_("bad hunk #%d %s (%d %d %d %d)") % (h.number, h.desc, len(h.a), h.lena, len(h.b), h.lenb)) |
if exitcode == SKIPPED_STATUS: | if exitcode == SKIPPED_STATUS or output is None: | def tsttest(test, options, replacements): t = open(test) out = [] script = [] salt = "SALT" + str(time.time()) pos = prepos = -1 after = {} expected = {} for n, l in enumerate(t): if not l.endswith('\n'): l += '\n' if l.startswith(' $ '): # commands after.setdefault(pos, []).append(l) prepos = pos pos = n script.appe... |
_('show only heads which are descendants of REV'), _('REV')), | _('show only heads which are descendants of STARTREV'), _('STARTREV')), | 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... |
_('[-ac] [-r REV] [REV]...')), | _('[-ac] [-r STARTREV] [REV]...')), | 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... |
revrange = ('qbase:qtip',) + revrange | revrange = ('qbase::qtip',) + revrange | def finish(ui, repo, *revrange, **opts): """move applied patches into repository history Finishes the specified revisions (corresponding to applied patches) by moving them out of mq control into regular repository history. Accepts a revision range or the -a/--applied option. If --applied is specified, all applied mq ... |
if u == 'UTF-8': | if e == 'UTF-8': | def tolocal(s): """ Convert a string from internal UTF-8 to local encoding All internal strings should be UTF-8 but some repos before the implementation of locale support may contain latin1 or possibly other character sets. We attempt to decode everything strictly using UTF-8, then Latin-1, and failing that, we use UT... |
(r'^\s*(any|all)\(', "any/all not available in Python 2.4"), | (r'(?<!def)\s+(any|all)\(', "any/all not available in Python 2.4"), | def rephere(m): t = re.sub(r"\S", "x", m.group(2)) return m.group(1) + t |
sum([h.added + h.removed for h in self.hunks]))) | sum([max(h.added, h.removed) for h in self.hunks]))) | def pretty(self, fp): for h in self.header: if h.startswith('index '): fp.write(_('this modifies a binary file (all or nothing)\n')) break if self.pretty_re.match(h): fp.write(h) if self.binary(): fp.write(_('this is a binary file\n')) break if h.startswith('---'): fp.write(_('%d hunks, %d lines changed\n') % (len(self... |
f = testfile + ".hgtmp" try: os_link(testfile, f) except OSError: | f1 = testfile + ".hgtmp1" if os.path.lexists(f1): | def checknlink(testfile): '''check whether hardlink count reporting works properly''' f = testfile + ".hgtmp" try: os_link(testfile, f) except OSError: return False try: # nlinks() may behave differently for files on Windows shares if # the file is open. fd = open(f) return nlinks(f) > 1 finally: fd.close() os.unlink... |
try: | try: posixfile(f1, 'w').close() except IOError: return False f2 = testfile + ".hgtmp2" fd = None try: try: os_link(f1, f2) except OSError: return False | def checknlink(testfile): '''check whether hardlink count reporting works properly''' f = testfile + ".hgtmp" try: os_link(testfile, f) except OSError: return False try: # nlinks() may behave differently for files on Windows shares if # the file is open. fd = open(f) return nlinks(f) > 1 finally: fd.close() os.unlink... |
fd = open(f) return nlinks(f) > 1 | fd = open(f2) return nlinks(f2) > 1 | def checknlink(testfile): '''check whether hardlink count reporting works properly''' f = testfile + ".hgtmp" try: os_link(testfile, f) except OSError: return False try: # nlinks() may behave differently for files on Windows shares if # the file is open. fd = open(f) return nlinks(f) > 1 finally: fd.close() os.unlink... |
fd.close() os.unlink(f) | if fd is not None: fd.close() for f in (f1, f2): try: os.unlink(f) except OSError: pass | def checknlink(testfile): '''check whether hardlink count reporting works properly''' f = testfile + ".hgtmp" try: os_link(testfile, f) except OSError: return False try: # nlinks() may behave differently for files on Windows shares if # the file is open. fd = open(f) return nlinks(f) > 1 finally: fd.close() os.unlink... |
check = protomap.get(proto, lambda p, p2: False) | check = protomap.get(proto, lambda *args: False) | def issvnurl(ui, url): try: proto, path = url.split('://', 1) if proto == 'file': path = urllib.url2pathname(path) except ValueError: proto = 'file' path = os.path.abspath(url) if proto == 'file': path = path.replace(os.sep, '/') check = protomap.get(proto, lambda p, p2: False) while '/' in path: if check(ui, path, pro... |
self._status = list(changes) | self._status = list(changes[:5]) self._ignored = changes[5] self._clean = changes[6] else: self._ignored = None self._clean = None | def __init__(self, repo, text="", user=None, date=None, extra=None, changes=None): self._repo = repo self._rev = None self._node = None self._text = text if date: self._date = util.parsedate(date) if user: self._user = user if changes: self._status = list(changes) |
return self._repo.status(unknown=True) | return self._repo.status(unknown=True)[:5] | def _status(self): return self._repo.status(unknown=True) |
self._status = self._repo.status(ignored=ignored, clean=clean, unknown=unknown) | stat = self._repo.status(ignored=ignored, clean=clean, unknown=unknown) self._ignored = ignored and stat[5] or None self._clean = clean and stat[6] or None self._status = stat[:5] | def status(self, ignored=False, clean=False, unknown=False): """Explicit status query Unless this method is used to query the working copy status, the _status property will implicitly read the status using its default arguments.""" self._status = self._repo.status(ignored=ignored, clean=clean, unknown=unknown) return s... |
return self._status[5] | if self._ignored is None: raise util.Abort(_("Ignored files requested without prior query\n")) return self._ignored | def ignored(self): return self._status[5] |
return self._status[6] | if self._clean is None: raise util.Abort(_("Clean files requested without prior query\n")) return self._clean | def clean(self): return self._status[6] |
def fakebuffer(sliceable, offset=0): return sliceable[offset:] | if sys.version_info[0] < 3: def fakebuffer(sliceable, offset=0): return sliceable[offset:] else: def fakebuffer(sliceable, offset=0): return memoryview(sliceable)[offset:] | def fakebuffer(sliceable, offset=0): return sliceable[offset:] |
d = _data + ' dh fncache' | d = ('data dh fncache' ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i') | def copylist(self): d = _data + ' dh fncache' return (['requires', '00changelog.i'] + [self.pathjoiner('store', f) for f in d.split()]) |
except ImportError: | except AttributeError: | def _ssl_wrap_socket(sock, key_file, cert_file, cert_reqs=CERT_REQUIRED, ca_certs=None): if ca_certs: raise util.Abort(_( 'certificate checking requires Python 2.6')) |
fh, fn = tempfile.mkstemp("", "", path) | fh, fn = tempfile.mkstemp(dir=path, prefix='hg-checkexec-') | def checkexec(path): """ Check whether the given path is on a filesystem with UNIX-like exec flags Requires a directory (like /foo/.hg) """ # VFAT on some Linux versions can flip mode but it doesn't persist # a FS remount. Frequently we can detect it if files are created # with exec bit on. try: EXECFLAGS = stat.S_I... |
cmd = 'p4 -G print %s' % util.shellquote("%s | cmd = 'p4 -G print %s' \ % util.shellquote("%s | def getfile(self, name, rev): cmd = 'p4 -G print %s' % util.shellquote("%s#%s"%(self.depotname[name], rev)) stdout = util.popen(cmd, mode='rb') |
self._repo.ui.warn('Not removing repo %s because' 'it has changes.\n' % self._path) | self._repo.ui.warn(_('not removing repo %s because' 'it has changes.\n' % self._path)) | def remove(self): if self.dirty(): self._repo.ui.warn('Not removing repo %s because' 'it has changes.\n' % self._path) return self._repo.ui.note('removing subrepo %s\n' % self._path) shutil.rmtree(self._ctx.repo.join(self._path)) |
if name not in existing and opts.get('delete'): raise util.Abort(_('cannot delete queue that does not exist')) elif name not in existing and not opts.get('create'): raise util.Abort(_('use --create to create a new queue')) | def _validname(name): for n in name: if n in ':\\/.': return False return True | |
branchname = 'demobranch' | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) | |
path = repo.wjoin(fn) ui.note(_('\nkeywords written to %s:\n') % path) | ui.note(_('\nkeywords written to %s:\n') % fn) | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) |
ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname)) quiet = ui.quiet ui.quiet = not ui.verbose commands.branch(ui, repo, branchname) ui.quiet = quiet | repo.dirstate.setbranch('demobranch') | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) |
ui.note(_('unhooked all commit hooks\n')) | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) | |
ui.note("hg -R '%s' ci -m '%s'\n" % (tmpdir, msg)) | ui.note("hg ci -m '%s'\n" % msg) | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) |
ui.debug('\nremoving temporary repository %s\n' % tmpdir) | def demoitems(section, items): ui.write('[%s]\n' % section) for k, v in sorted(items): ui.write('%s = %s\n' % (k, v)) | |
d - an optional precomputed delta | cachedelta - an optional precomputed delta | def addrevision(self, text, transaction, link, p1, p2, cachedelta=None): """add a revision to the log |
l = (l[0], l[1] + "+") | ld = (l[0], l[1] + "+") | def debug(s, msg, r=""): if r: r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
if l == r or r == a: | if ld == r or r == a: | def debug(s, msg, r=""): if r: r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
elif l == a: | elif ld == a: | def debug(s, msg, r=""): if r: r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
elif l[0] != r[0]: | elif ld[0] != r[0]: | def debug(s, msg, r=""): if r: r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
elif l[1] == a[1]: | elif ld[1] == a[1]: | def debug(s, msg, r=""): if r: r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
mod = _origimport(head, globals, locals, level) | mod = _origimport(head, globals, locals, level=level) | def _load(self): if not self._module: head, globals, locals, after, level = self._data if level is not None: mod = _origimport(head, globals, locals, level) else: mod = _origimport(head, globals, locals) # load submodules def subload(mod, p): h, t = p, None if '.' in p: h, t = p.split('.', 1) if not hasattr(mod, h): # ... |
return re.match(el, l) | return re.match(el + r'\Z', l) | def rematch(el, l): try: # hack to deal with graphlog, which looks like bogus regexes if el.startswith('|'): el = '\\' + el return re.match(el, l) except re.error: # el is an invalid regex return False |
if inst.errno != errno.EPIPE: | if inst.errno not in (errno.EPIPE, errno.EIO): | def write_err(self, *args, **opts): try: if not getattr(sys.stdout, 'closed', False): sys.stdout.flush() for a in args: sys.stderr.write(str(a)) # stderr may be buffered under win32 when redirected to files, # including stdout. if not getattr(sys.stderr, 'closed', False): sys.stderr.flush() except IOError, inst: if ins... |
if 'qtip' in repo.tags() and (repo[dest].hex() in [s.rev for s in repo.mq.applied]): raise util.Abort(_('cannot rebase onto an applied mq patch')) | def buildstate(repo, dest, src, base, detach): 'Define which revisions are going to be rebased and where' targetancestors = set() detachset = set() if not dest: # Destination defaults to the latest revision in the current branch branch = repo[None].branch() dest = repo[branch].rev() else: if 'qtip' in repo.tags() and ... | |
message = _("imported patch %s\n") % patchname | message = "imported patch %s\n" % patchname | def _apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, all_files={}): '''returns (error, hash) error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz''' # TODO unify with commands.py if not patchdir: patchdir = self.path err = 0 n = None for patchname in seri... |
message.append(_("\nimported patch %s") % patchname) | message.append("\nimported patch %s" % patchname) | def _apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, all_files={}): '''returns (error, hash) error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz''' # TODO unify with commands.py if not patchdir: patchdir = self.path err = 0 n = None for patchname in seri... |
if len(text) <= maxlength: return text else: return "%s..." % (text[:maxlength - 3]) | try: utext, truncated = _ellipsis(text.decode(encoding.encoding), maxlength) if not truncated: return text return utext.encode(encoding.encoding) except (UnicodeDecodeError, UnicodeEncodeError): return _ellipsis(text, maxlength)[0] | def ellipsis(text, maxlength=400): """Trim string to at most maxlength (default: 400) characters.""" if len(text) <= maxlength: return text else: return "%s..." % (text[:maxlength - 3]) |
parser.error('too many arguments') | raise util.Abort('too many arguments') | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('not a local repository: %s' % options.repository) | raise util.Abort('not a local repository: %s' % options.repository) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('--revlog option must specify the revlog index file ' '(*.i), not %s' % options.revlog) | raise util.Abort('--revlog option must specify the revlog index ' 'file (*.i), not %s' % options.revlog) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('--revlog option must specify a revlog in %s, not %s' % (store, indexfn)) | raise util.Abort('--revlog option must specify a revlog in %s, ' 'not %s' % (store, indexfn)) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('no such file: %s' % indexfn) | raise util.Abort('no such file: %s' % indexfn) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('shrinking the changelog will corrupt your repository') | raise util.Abort('shrinking the changelog will corrupt your repository') | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('%s does not exist: revlog not big enough ' 'to be worth shrinking' % datafn) | raise util.Abort('%s does not exist: revlog not big enough ' 'to be worth shrinking' % datafn) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
parser.error('one or both of\n' ' %s\n' ' %s\n' 'exists from a previous run; please clean up before ' 'running again' % (oldindexfn, olddatafn)) | raise util.Abort('one or both of\n' ' %s\n' ' %s\n' 'exists from a previous run; please clean up before ' 'running again' % (oldindexfn, olddatafn)) | def main(): # Unbuffer stdout for nice progress output. sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) parser = optparse.OptionParser(description=__doc__) parser.add_option('-R', '--repository', default=os.path.curdir, metavar='REPO', help='repository root directory [default: current dir]') parser.add_option('--... |
repo.ui.debug(repr(x), '\n') if x is None: return [r.rev() for r in repo[x].parents()] | def parents(repo, subset, x): """``parents(set)`` The set of all parents for all changesets in set. """ ps = set() cl = repo.changelog for r in getset(repo, range(len(repo)), x): ps.update(cl.parentrevs(r)) return [r for r in subset if r in ps] | |
if op == '-': | if op == 'minus': | def optimize(x, small): if x == None: return 0, x smallbonus = 1 if small: smallbonus = .5 op = x[0] if op == '-': return optimize(('and', x[1], ('not', x[2])), small) elif op == 'dagrange': return optimize(('and', ('func', ('symbol', 'descendants'), x[1]), ('func', ('symbol', 'ancestors'), x[2])), small) elif op == ... |
if key in self._bookmarks: key = self._bookmarks[key] | if not getattr(self, '_loadingbookmarks', False): if key in self._bookmarks: key = self._bookmarks[key] | def lookup(self, key): if key in self._bookmarks: key = self._bookmarks[key] return super(bookmark_repo, self).lookup(key) |
tags.update(self._bookmarks) | if not getattr(self, '_loadingbookmarks', False): tags.update(self._bookmarks) | def _findtags(self): """Merge bookmarks with normal tags""" (tags, tagtypes) = super(bookmark_repo, self)._findtags() tags.update(self._bookmarks) return (tags, tagtypes) |
gp.setmode(int(line[-6:], 8)) | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... | |
elif gp.op != 'DELETE': util.set_flags(dst, islink, isexec) | util.set_flags(dst, islink, isexec) | 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... |
return generator(fh) | return util.chunkbuffer(generator(fh)) | def generator(f): zd = bz2.BZ2Decompressor() zd.decompress("BZ") for chunk in util.filechunkiter(f, 4096): yield zd.decompress(chunk) |
self._stream = util.chunkbuffer(decompressor(fh, alg)) | self._stream = decompressor(fh, alg) | def __init__(self, fh, alg): self._stream = util.chunkbuffer(decompressor(fh, alg)) self._type = alg |
copy = copy.copy() | def getfilectx(f, ctx): fctx = ctx.filectx(f, filelog=cache.get(f)) if f not in cache: if len(cache) > 20: del cache[order.pop(0)] cache[f] = fctx.filelog() else: order.remove(f) order.append(f) return fctx | |
if f in copy and copy[f] in added and copyto[copy[f]] == f: dodiff = False elif f in copyto and copyto[f] in added and copy[copyto[f]] == f: | if ((f in copy and copy[f] in added and copyto[copy[f]] == f) or (f in copyto and copyto[f] in added and copy[copyto[f]] == f)): | 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... |
self.is_pass_stmt(tree[i + 1]): | self.is_pass_stmt(tree[i + 1])): | def find_docstring_pass_pair(self, tree, spots): for i in range(1, len(tree)): if (self.is_string_constant(tree[i]) and self.is_pass_stmt(tree[i + 1]): first_line = self.first_line_of_tree(tree[i]) last_line = self.last_line_of_tree(tree[i + 1]) self.record_multiline(spots, first_line, last_line) |
if cmd in commands.norepo: | if cmd in norepo: | def uisetup(ui): mqopt = [('', 'mq', None, _("operate on patch repository"))] extensions.wrapcommand(commands.table, 'import', mqimport) entry = extensions.wrapcommand(commands.table, 'init', mqinit) entry[1].extend(mqopt) for cmd in commands.table.keys(): cmd = cmdutil.parsealiases(cmd)[0] if cmd in commands.norepo... |
qrepo[None].add(self.added) | qrepo[None].add(f for f in self.added if f not in qrepo[None]) | def write_list(items, path): fp = self.opener(path, 'w') for i in items: fp.write("%s\n" % i) fp.close() |
return q.qseries(repo, length=end, start=start, status='A', summary=opts.get('summary')) | q.qseries(repo, length=end, start=start, status='A', summary=opts.get('summary')) | def applied(ui, repo, patch=None, **opts): """print the patches already applied Returns 0 on success.""" q = repo.mq if patch: if patch not in q.series: raise util.Abort(_("patch %s is not in series file") % patch) end = q.series.index(patch) + 1 else: end = q.series_end(True) if opts.get('last') and not end: ui.wr... |
return q.qseries(repo, start=start, length=length, status='U', summary=opts.get('summary')) | q.qseries(repo, start=start, length=length, status='U', summary=opts.get('summary')) | def unapplied(ui, repo, patch=None, **opts): """print the patches not yet applied Returns 0 on success.""" q = repo.mq if patch: if patch not in q.series: raise util.Abort(_("patch %s is not in series file") % patch) start = q.series.index(patch) + 1 else: start = q.series_end(True) if start == len(q.series) and opt... |
return q.qseries(repo, start=t - 1, length=1, status='A', summary=opts.get('summary')) | q.qseries(repo, start=t - 1, length=1, status='A', summary=opts.get('summary')) | def top(ui, repo, **opts): """print the name of the current patch Returns 0 on success.""" q = repo.mq t = q.applied and q.series_end(True) or 0 if t: return q.qseries(repo, start=t - 1, length=1, status='A', summary=opts.get('summary')) else: ui.write(_("no patches applied\n")) return 1 |
return q.qseries(repo, start=end, length=1, summary=opts.get('summary')) | q.qseries(repo, start=end, length=1, summary=opts.get('summary')) | def next(ui, repo, **opts): """print the name of the next patch Returns 0 on success.""" q = repo.mq end = q.series_end() if end == len(q.series): ui.write(_("all patches applied\n")) return 1 return q.qseries(repo, start=end, length=1, summary=opts.get('summary')) |
return q.qseries(repo, start=l - 2, length=1, status='A', summary=opts.get('summary')) | q.qseries(repo, start=l - 2, length=1, status='A', summary=opts.get('summary')) | def prev(ui, repo, **opts): """print the name of the previous patch Returns 0 on success.""" q = repo.mq l = len(q.applied) if l == 1: ui.write(_("only one patch applied\n")) return 1 if not l: ui.write(_("no patches applied\n")) return 1 return q.qseries(repo, start=l - 2, length=1, status='A', summary=opts.get('summ... |
_setactivenocheck(name) def _setactivenocheck(name): | def _setactive(name): if q.applied: raise util.Abort(_('patches applied - cannot set new queue active')) | |
return | return 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... |
return | return 1 | 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... |
self.lineno = 0 | def __init__(self, path): self.path = path self.oldpath = None self.mode = None self.op = 'MODIFY' self.lineno = 0 self.binary = False | |
lineno = 0 | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('diff --git'): m = gitre.match(line) if m: if gp: gitpatches.append(gp) dst = m.group(... | |
lineno += 1 | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('diff --git'): m = gitre.match(line) if m: if gp: gitpatches.append(gp) dst = m.group(... | |
gp.lineno = lineno | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('diff --git'): m = gitre.match(line) if m: if gp: gitpatches.append(gp) dst = m.group(... | |
elif ent.action == 'R' and parents: | if ent.action == 'R' and parents: | def expandpaths(self, rev, paths, parents): changed, removed = set(), set() copies = {} |
if line.startswith('diff --git a/'): | if line.startswith('diff --git a/') or line.startswith('diff -r '): | def scanwhile(first, p): """scan lr while predicate holds""" lines = [first] while True: line = lr.readline() if not line: break if p(line): lines.append(line) else: lr.push(line) break return lines |
diff_re = re.compile('diff --git a/(.*) b/(.*)$') | diffgit_re = re.compile('diff --git a/(.*) b/(.*)$') diff_re = re.compile('diff -r .* (.*)$') | def notheader(line): s = line.split(None, 1) return not s or s[0] not in ('---', 'diff') |
fromfile, tofile = self.diff_re.match(self.header[0]).groups() if fromfile == tofile: return [fromfile] return [fromfile, tofile] | match = self.diffgit_re.match(self.header[0]) if match: fromfile, tofile = match.groups() if fromfile == tofile: return [fromfile] return [fromfile, tofile] else: return self.diff_re.match(self.header[0]).groups() | def files(self): fromfile, tofile = self.diff_re.match(self.header[0]).groups() if fromfile == tofile: return [fromfile] return [fromfile, tofile] |
hg.revert(repo, repo.dirstate.parents()[0], backups.has_key) | hg.revert(repo, repo.dirstate.parents()[0], lambda key: key in backups) | def recordfunc(ui, repo, message, match, opts): """This is generic record driver. |
def outgoing(oldoutgoing, ui, repo, source="default", **opts): | def outgoing(oldoutgoing, ui, repo, dest=None, **opts): | def outgoing(oldoutgoing, ui, repo, source="default", **opts): if opts.get('bookmarks'): source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) diffbookmarks(ui, other, repo) else: ol... |
source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) | dest = ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), dest) ui.status(_('comparing with %s\n') % url.hidepassword(dest)) | def outgoing(oldoutgoing, ui, repo, source="default", **opts): if opts.get('bookmarks'): source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) diffbookmarks(ui, other, repo) else: ol... |
oldoutgoing(ui, repo, source, **opts) | oldoutgoing(ui, repo, dest, **opts) | def outgoing(oldoutgoing, ui, repo, source="default", **opts): if opts.get('bookmarks'): source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) diffbookmarks(ui, other, repo) else: ol... |
delattr(repo, attr) | delattr(self, attr) | def invalidate(self): super(bookmark_repo, self).invalidate() for attr in ('_bookmarks', '_bookmarkcurrent'): if attr in self.__dict__: delattr(repo, attr) |
if script and not script[-1].endswith('\n'): script[-1] = script[-1] + '\n' | def tsttest(test, options, replacements): t = open(test) out = [] script = [] salt = "SALT" + str(time.time()) pos = prepos = -1 after = {} expected = {} for n, l in enumerate(t): if l.startswith(' $ '): # commands after.setdefault(pos, []).append(l) prepos = pos pos = n script.append('echo %s %s $?\n' % (salt, n)) s... | |
added = [] | self.added = [] | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) |
added.append(patchname) | self.added.append(patchname) | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) |
self.series_dirty = 1 qrepo = self.qrepo() if qrepo: qrepo[None].add(added) | def checkfile(patchname): if not force and os.path.exists(self.join(patchname)): raise util.Abort(_('patch "%s" already exists') % patchname) | |
q.qimport(repo, filename, patchname=opts['name'], | try: q.qimport(repo, filename, patchname=opts['name'], | def qimport(ui, repo, *filename, **opts): """import a patch The patch is inserted into the series after the last applied patch. If no patches have been applied, qimport prepends the patch to the series. The patch will have the same name as its source file unless you give it a new one with -n/--name. You can register... |
q.save_dirty() | finally: q.save_dirty() qrepo = q.qrepo() if qrepo: qrepo[None].add(q.added) | def qimport(ui, repo, *filename, **opts): """import a patch The patch is inserted into the series after the last applied patch. If no patches have been applied, qimport prepends the patch to the series. The patch will have the same name as its source file unless you give it a new one with -n/--name. You can register... |
hgpatch = True | hgpatchheader = True | def extract(ui, fileobj): '''extract patch from data read from fileobj. patch can be a normal patch or contained in an email message. return tuple (filename, message, user, date, branch, node, p1, p2). Any item in the returned tuple can be None. If filename is None, fileobj did not contain a patch. Caller must unlink... |
elif hgpatch: | elif hgpatchheader: | def extract(ui, fileobj): '''extract patch from data read from fileobj. patch can be a normal patch or contained in an email message. return tuple (filename, message, user, date, branch, node, p1, p2). Any item in the returned tuple can be None. If filename is None, fileobj did not contain a patch. Caller must unlink... |
if not line.startswith(' | if not hgpatchheader and not ignoretext: | def extract(ui, fileobj): '''extract patch from data read from fileobj. patch can be a normal patch or contained in an email message. return tuple (filename, message, user, date, branch, node, p1, p2). Any item in the returned tuple can be None. If filename is None, fileobj did not contain a patch. Caller must unlink... |
self._relpath = path self._path = ctx._repo.wjoin(path) | self._path = path self._relpath = os.path.join(reporelpath(ctx._repo), path) self._abspath = ctx._repo.wjoin(path) | def __init__(self, ctx, path, state): # TODO add git version check. self._state = state self._ctx = ctx self._relpath = path self._path = ctx._repo.wjoin(path) self._ui = ctx._repo.ui |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.