rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
cmd = 'p4 -G print "%s | cmd = 'p4 -G print %s' % util.shellquote("%s | def getfile(self, name, rev): cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev) stdout = util.popen(cmd, mode='rb') |
('p', 'port', '', _('port to listen on (default: 8000')), | ('p', 'port', '', _('port to listen on (default: 8000)')), | 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... |
l.append(r) | if r not in seen: l.append(r) | def revfix(repo, val, defval): if not val and val != 0 and defval is not None: return defval return repo.changelog.rev(repo.lookup(val)) |
if opts.get('diffstat'): | if opts.get('diffstat') or opts.get('confirm'): | def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if opt != 'reply-to': showaddr = '%s:' % opt.capitalize() else: showaddr = 'Reply-To:' |
def rejlines(): base = os.path.basename(self.fname) yield "--- %s\n+++ %s\n" % (base, base) for x in self.rej: for l in x.hunk: yield l if l[-1] != '\n': yield "\n\ No newline at end of file\n" self.writelines(fname, rejlines()) | fp = self.opener(fname, 'w') fp.writelines(self.makerejlines(self.fname)) fp.close() | def rejlines(): base = os.path.basename(self.fname) yield "--- %s\n+++ %s\n" % (base, base) for x in self.rej: for l in x.hunk: yield l if l[-1] != '\n': yield "\n\ No newline at end of file\n" |
def _match(self, m): | def _match(self, m, pos): | def _match(self, m): 'make sure the tokenizer matches an end condition' if self.current[0] != m: raise error.ParseError("unexpected token: %s" % self.current[0], self.current[2]) self._advance() |
self._match(prefix[2]) | self._match(prefix[2], pos) | def _parse(self, bind=0): token, value, pos = self._advance() # handle prefix rules on current token prefix = self._elements[token][1] if not prefix: raise error.ParseError("not a prefix: %s" % token, pos) if len(prefix) == 1: expr = (prefix[0], value) else: if len(prefix) > 2 and prefix[2] == self.current[0]: self._ma... |
self._match(infix[2]) | self._match(infix[2], pos) | def _parse(self, bind=0): token, value, pos = self._advance() # handle prefix rules on current token prefix = self._elements[token][1] if not prefix: raise error.ParseError("not a prefix: %s" % token, pos) if len(prefix) == 1: expr = (prefix[0], value) else: if len(prefix) > 2 and prefix[2] == self.current[0]: self._ma... |
return top return None | return top, patch return None, None | def check_toppatch(self, repo): if len(self.applied) > 0: top = bin(self.applied[-1].rev) pp = repo.dirstate.parents() if top not in pp: raise util.Abort(_("working directory revision is not qtip")) return top return None |
top = self.check_toppatch(repo) | top = self.check_toppatch(repo)[0] | def getfile(f, rev, flags): t = repo.file(f).read(rev) repo.wwrite(f, t, flags) |
top = self.check_toppatch(repo) | top, patch = self.check_toppatch(repo) | 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 diffopts = self.diffopts(opts) self.printdiff(repo, diffopts, node1, node2, files=pats... |
diffopts = self.diffopts(opts) | diffopts = self.diffopts(opts, patch) | 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 diffopts = self.diffopts(opts) self.printdiff(repo, diffopts, node1, node2, files=pats... |
if not q.check_toppatch(repo): | if not q.check_toppatch(repo)[0]: | 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... |
st = list(repo.status(unknown=True))[:7] | st = list(repo.status(unknown=True))[:6] | def summary(ui, repo, **opts): """summarize working directory state This generates a brief summary of the working directory state, including parents, branch, commit status, and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming.... |
st.append([f for f in ms if f == 'u']) | st.append([f for f in ms if ms[f] == 'u']) | def summary(ui, repo, **opts): """summarize working directory state This generates a brief summary of the working directory state, including parents, branch, commit status, and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming.... |
o = repo.changelog.nodesbetween(o, revs)[0] | o = repo.changelog.nodesbetween(o, None)[0] | def summary(ui, repo, **opts): """summarize working directory state This generates a brief summary of the working directory state, including parents, branch, commit status, and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming.... |
return [repo[x].parents()[0].rev()] | p = repo[x].parents()[0].rev() return [r for r in subset if r == p] | def p1(repo, subset, x): """``p1([set])`` First parent of changesets in set, or the working directory. """ if x is None: return [repo[x].parents()[0].rev()] ps = set() cl = repo.changelog for r in getset(repo, range(len(repo)), x): ps.add(cl.parentrevs(r)[0]) return [r for r in subset if r in ps] |
return [ps[1].rev()] | p = ps[1].rev() return [r for r in subset if r == p] | def p2(repo, subset, x): """``p2([set])`` Second parent of changesets in set, or the working directory. """ if x is None: ps = repo[x].parents() try: return [ps[1].rev()] except IndexError: return [] ps = set() cl = repo.changelog for r in getset(repo, range(len(repo)), x): ps.add(cl.parentrevs(r)[1]) return [r for r ... |
return [r.rev() for r in repo[x].parents()] | ps = tuple(p.rev() for p in repo[x].parents()) return [r for r in subset if r in ps] | 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: return [r.rev() for r in repo[x].parents()] ps = set() cl = repo.changelog for r in getset(repo, range(len(repo)), x): ps.update(cl.parentrevs(r... |
def reset_retry_count(self): pass | def http_error_auth_reqed(self, auth_header, host, req, headers): try: return urllib2.HTTPDigestAuthHandler.http_error_auth_reqed( self, auth_header, host, req, headers) except ValueError, inst: arg = inst.args[0] if arg.startswith("AbstractDigestAuthHandler doesn't know "): return raise | |
sys.stdout.write(_("(%s)\n") % inst.hint) | sys.stderr.write(_("(%s)\n") % inst.hint) | def dispatch(args): "run the command specified in args" try: u = uimod.ui() if '--traceback' in args: u.setconfig('ui', 'traceback', 'on') except util.Abort, inst: sys.stderr.write(_("abort: %s\n") % inst) if inst.hint: sys.stdout.write(_("(%s)\n") % inst.hint) return -1 except error.ParseError, inst: if len(inst.args)... |
ui.status(_("(%s)\n") % inst.hint) | ui.warn(_("(%s)\n") % inst.hint) | def catchterm(*args): raise error.SignalInterrupt |
handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), | handlers.extend((httpbasicauthhandler(passmgr), | def opener(ui, authinfo=None): ''' construct an opener suitable for urllib2 authinfo will be added to the password manager ''' handlers = [httphandler()] if has_https: handlers.append(httpshandler(ui)) handlers.append(proxyhandler(ui)) passmgr = passwordmgr(ui) if authinfo is not None: passmgr.add_password(*authinfo)... |
if not e.startswith('Not trusting file') \ and not e.startswith('warning: Not importing')] | if not e.startswith(b('Not trusting file')) \ and not e.startswith(b('warning: Not importing'))] | def runcmd(cmd, env): p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) out, err = p.communicate() # If root is executing setup.py, but the repository is owned by # another user (as in "sudo python setup.py install") we will get # trust warnings since the .hg/hgrc file is untrusted. Tha... |
('f', 'force', None, _('import uncommitted changes into patch (deprecated)')), | ('f', 'force', None, _('import uncommitted changes (DEPRECATED)')), | def uisetup(ui): extensions.wrapcommand(commands.table, 'import', mqimport) for cmd in ('commit', 'export', 'incoming', 'log', 'outgoing', 'pull', 'push', 'status', 'tag', 'tags', 'tip', 'update'): entry = extensions.wrapcommand(commands.table, cmd, mqcommand) entry[1].extend([('Q', 'mq', None, _("operate on patch repo... |
fctx = f in pctxs[0] and pctxs[0] or pctxs[1] | fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f] | def undelete(self, list): pctxs = self.parents() wlock = self._repo.wlock() try: for f in list: if self._repo.dirstate[f] != 'r': self._repo.ui.warn(_("%s not removed!\n") % f) else: fctx = f in pctxs[0] and pctxs[0] or pctxs[1] t = fctx.data() self._repo.wwrite(f, t, fctx.flags()) self._repo.dirstate.normal(f) finally... |
realpatches.append(patch) | if patch not in realpatches: realpatches.append(patch) | def delete(self, repo, patches, opts): if not patches and not opts.get('rev'): raise util.Abort(_('qdelete requires at least one revision or ' 'patch name')) |
for m, subj, ds in msgs: | for i, (m, subj, ds) in enumerate(msgs): | def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if opt != 'reply-to': showaddr = '%s:' % opt.capitalize() else: showaddr = 'Reply-To:' |
name = tempfile.mktemp(dir=path) | name = tempfile.mktemp(dir=path, prefix='hg-checklink-') | def checklink(path): """check whether the given path is on a symlink-capable filesystem""" # mktemp is not racy because symlink creation will fail if the # file already exists name = tempfile.mktemp(dir=path) try: os.symlink(".", name) os.unlink(name) return True except (OSError, AttributeError): return False |
try: if context is None and x.startswith('***************'): context = True gpatch = changed.get(bfile) create = afile == '/dev/null' or gpatch and gpatch.op == 'ADD' remove = bfile == '/dev/null' or gpatch and gpatch.op == 'DELETE' current_hunk = hunk(x, hunknum + 1, lr, context, create, remove) except PatchError, err... | if context is None and x.startswith('***************'): context = True gpatch = changed.get(bfile) create = afile == '/dev/null' or gpatch and gpatch.op == 'ADD' remove = bfile == '/dev/null' or gpatch and gpatch.op == 'DELETE' current_hunk = hunk(x, hunknum + 1, lr, context, create, remove) | 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 ... |
def write(self, dest=None): if not self.dirty: return if not dest: dest = self.fname self.writelines(dest, self.lines) | def rejlines(): base = os.path.basename(self.fname) yield "--- %s\n+++ %s\n" % (base, base) for x in self.rej: for l in x.hunk: yield l if l[-1] != '\n': yield "\n\ No newline at end of file\n" | |
current_file.write() | if current_file.dirty: current_file.writelines(current_file.fname, current_file.lines) | def closefile(): if not current_file: return 0 current_file.write() current_file.write_rej() return len(current_file.rej) |
def writefile(fname, text, fmode="w"): | def writefile(fname, text, fmode="wb"): | def writefile(fname, text, fmode="w"): f = open(fname, fmode) try: f.write(text) finally: f.close() |
f = open("mf", "r+") | f = open("mf", "rb+") | def writefile(fname, text, fmode="w"): f = open(fname, fmode) try: f.write(text) finally: f.close() |
writefile("af", "r%i\n" % id, "a") | writefile("af", "r%i\n" % id, "ab") | def writefile(fname, text, fmode="w"): f = open(fname, fmode) try: f.write(text) finally: f.close() |
if m1.flags(f) != rflags: | if m1.flags(f) != rflags or n[20:]: | def act(msg, m, f, *args): repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) action.append((f, m) + args) |
If no changeset is specified, attempt to update to the head of the current branch. If this head is a descendant of the working | If no changeset is specified, attempt to update to the tip of the current branch. If this changeset is a descendant of the working | def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): """update working directory (or switch revisions) Update the repository's working directory to the specified changeset. If no changeset is specified, attempt to update to the head of the current branch. If this head is a descendant of the... |
if stat: opts['unified'] = '0' | def printdiff(self, repo, diffopts, node1, node2=None, files=None, fp=None, changes=None, opts={}): stat = opts.get('stat') if stat: opts['unified'] = '0' | |
['hgext/inotify/linux/_inotify.c']) | ['hgext/inotify/linux/_inotify.c'], ['mercurial']) | 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 |
self.name = name | self.name = self.cmd = name | def __init__(self, name, definition, cmdtable): self.name = name self.definition = definition self.args = [] self.opts = [] self.help = '' self.norepo = True self.badalias = False |
cmdutil.findcmd(self.name, cmdtable, True) | aliases, entry = cmdutil.findcmd(self.name, cmdtable) for alias, e in cmdtable.iteritems(): if e is entry: self.cmd = alias break | def __init__(self, name, definition, cmdtable): self.name = name self.definition = definition self.args = [] self.opts = [] self.help = '' self.norepo = True self.badalias = False |
cmdtable[alias] = (aliasdef, aliasdef.opts, aliasdef.help) | cmdtable[aliasdef.cmd] = (aliasdef, aliasdef.opts, aliasdef.help) | aliasdef = cmdalias(alias, definition, cmdtable) |
return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) | return _urlunparse(scheme, netloc, path, params, query, fragment, url) | def hidepassword(url): '''hide user credential in a url string''' scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc) return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) |
return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) | return _urlunparse(scheme, netloc, path, params, query, fragment, url) | def removeauth(url): '''remove all authentication information from a url string''' scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) netloc = netloc[netloc.find('@')+1:] return urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) |
defpath = os.path.join(_abssource(ctx._repo), path) | defpath = _abssource(self._repo) defpushpath = _abssource(self._repo, True) | def addpathconfig(key, value): fp.write('%s = %s\n' % (key, value)) self._repo.ui.setconfig('paths', key, value) |
path = cmdutil.findrepo(os.getcwd()) or "" | try: wd = os.getcwd() except OSError, e: raise util.Abort(_("error getting current working directory: %s") % e.strerror) path = cmdutil.findrepo(wd) or "" | def _dispatch(ui, args): # read --config before doing anything else # (e.g. to change trust settings for reading .hg/hgrc) _parseconfig(ui, _earlygetopt(['--config'], args)) # check for cwd cwd = _earlygetopt(['--cwd'], args) if cwd: os.chdir(cwd[-1]) # read the local repository .hgrc into a local ui object path = cm... |
diffbookmarks(ui, repo, other) | return diffbookmarks(ui, repo, other) | def incoming(oldincoming, 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, repo, other) else: ol... |
oldincoming(ui, repo, source, **opts) | return oldincoming(ui, repo, source, **opts) | def incoming(oldincoming, 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, repo, other) else: ol... |
diffbookmarks(ui, other, repo) | return diffbookmarks(ui, other, repo) | def outgoing(oldoutgoing, ui, repo, dest=None, **opts): if opts.get('bookmarks'): 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)) diffb... |
oldoutgoing(ui, repo, dest, **opts) | return oldoutgoing(ui, repo, dest, **opts) | def outgoing(oldoutgoing, ui, repo, dest=None, **opts): if opts.get('bookmarks'): 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)) diffb... |
if not ui.interactive(): if default is not None: return default | if not ui.interactive() and default is None: | def prompt(ui, prompt, default=None, rest=':'): if not ui.interactive(): if default is not None: return default raise util.Abort(_("%s Please enter a valid value" % (prompt + rest))) if default: prompt += ' [%s]' % default prompt += rest while True: r = ui.prompt(prompt, default=default) if r: return r if default is no... |
def interhg_escape(x): escstr = orig_escape(x) for regexp, format in interhg_table: escstr = regexp.sub(format, escstr) return escstr | def uisetup(ui): orig_escape = templatefilters.filters["escape"] | def interhg_escape(x): escstr = orig_escape(x) for regexp, format in interhg_table: escstr = regexp.sub(format, escstr) return escstr |
templatefilters.filters["escape"] = interhg_escape | def interhg_escape(x): escstr = orig_escape(x) for regexp, format in interhg_table: escstr = regexp.sub(format, escstr) return escstr templatefilters.filters["escape"] = interhg_escape | def interhg_escape(x): escstr = orig_escape(x) for regexp, format in interhg_table: escstr = regexp.sub(format, escstr) return escstr |
self._loadingbookmarks = True | def _bookmarks(self): '''Parse .hg/bookmarks file and return a dictionary | |
bookmarks[refspec] = super(bookmark_repo, self).lookup(sha) | bookmarks[refspec] = self.changelog.lookup(sha) | def _bookmarks(self): '''Parse .hg/bookmarks file and return a dictionary |
self._loadingbookmarks = False | def _bookmarks(self): '''Parse .hg/bookmarks file and return a dictionary | |
if not getattr(self, '_loadingbookmarks', False): if key in self._bookmarks: key = self._bookmarks[key] | if key in self._bookmarks: key = self._bookmarks[key] | def lookup(self, key): if not getattr(self, '_loadingbookmarks', False): if key in self._bookmarks: key = self._bookmarks[key] return super(bookmark_repo, self).lookup(key) |
if not getattr(self, '_loadingbookmarks', False): tags.update(self._bookmarks) | tags.update(self._bookmarks) | def _findtags(self): """Merge bookmarks with normal tags""" (tags, tagtypes) = super(bookmark_repo, self)._findtags() if not getattr(self, '_loadingbookmarks', False): tags.update(self._bookmarks) return (tags, tagtypes) |
raise util.Abort(_('unknown subrepo type %s') % t) | raise util.Abort(_('unknown subrepo type %s') % state[2]) | def subrepo(ctx, path): # subrepo inherently violates our import layering rules # because it wants to make repo objects from deep inside the stack # so we manually delay the circular imports to not break # scripts that don't use our demand-loading global hg import hg as h hg = h util.path_auditor(ctx._repo.root)(path)... |
self._repo.ui.warn(_('not removing repo %s because ' 'it has changes.\n' % self._path)) | self._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)) |
self._repo.ui.note('removing subrepo %s\n' % self._path) | self._ui.note('removing subrepo %s\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)) |
args = fancyopts.fancyopts(args, commands.globalopts, options) | try: args = fancyopts.fancyopts(args, commands.globalopts, options) except fancyopts.getopt.GetoptError: return | def _checkshellalias(ui, args): cwd = os.getcwd() norepo = commands.norepo options = {} args = fancyopts.fancyopts(args, commands.globalopts, options) if not args: return _parseconfig(ui, options['config']) if options['cwd']: os.chdir(options['cwd']) path, lui = _getlocal(ui, [options['repository']]) cmdtable = com... |
elif el and rematch(el, l): | elif el and el[2:] and rematch(el, 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 |
("second", 1),] | ("second", 1)] | def stringify(thing): '''turn nested template iterator into string.''' if hasattr(thing, '__iter__') and not isinstance(thing, str): return "".join([stringify(t) for t in thing if t is not None]) return str(thing) |
u = u'\n\n'.join([t.ugettext(m) for m in message.split('\n\n')]) | paragraphs = message.split('\n\n') u = u'\n\n'.join([p and t.ugettext(p) or '' for p in paragraphs]) | def gettext(message): """Translate message. The message is looked up in the catalog to get a Unicode string, which is encoded in the local encoding before being returned. Important: message is restricted to characters in the encoding given by sys.getdefaultencoding() which is most likely 'ascii'. """ # If message is ... |
try: val = opts[o] except KeyError: continue else: if val == '': continue baseui.setconfig("web", o, val) if repo and repo.ui != baseui: repo.ui.setconfig("web", o, val) | val = opts.get(o, '') if val is None or val == '': continue baseui.setconfig("web", o, val) if repo and repo.ui != baseui: repo.ui.setconfig("web", o, val) | def serve(ui, repo, **opts): """export the repository via HTTP Start a local HTTP repository browser and pull server. By default, the server logs accesses to stdout and errors to stderr. Use the -A/--accesslog and -E/--errorlog options to log to files. To have the server choose a free port number to listen on, speci... |
source, revs, checkout = hg.parseurl(ui.expandpath('default'), opts.get('rev')) | source, branches = hg.parseurl(ui.expandpath('default')) | def summary(ui, repo, **opts): """summarize working directory state This generates a brief summary of the working directory state, including parents, branch, commit status, and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming.... |
dest, revs, checkout = hg.parseurl( ui.expandpath('default-push', 'default')) | dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) revs, checkout = hg.addbranchrevs(repo, repo, branches, None) | def summary(ui, repo, **opts): """summarize working directory state This generates a brief summary of the working directory state, including parents, branch, commit status, and available updates. With the --remote option, this will check the default paths for incoming and outgoing changes. This can be time-consuming.... |
gitpatches = None opener = util.opener(os.getcwd()) | cwd = os.getcwd() opener = util.opener(cwd) | def _applydiff(ui, fp, patcher, copyfn, changed, strip=1, sourcefile=None, eolmode='strict'): rejects = 0 err = 0 current_file = None gitpatches = None opener = util.opener(os.getcwd()) def closefile(): if not current_file: return 0 current_file.close() return len(current_file.rej) for state, values in iterhunks(ui, ... |
current_hunk = values ret = current_file.apply(current_hunk) | ret = current_file.apply(values) | def closefile(): if not current_file: return 0 current_file.close() return len(current_file.rej) |
current_file, current_hunk = None, None | current_file = None | def closefile(): if not current_file: return 0 current_file.close() return len(current_file.rej) |
gitpatches = values cwd = os.getcwd() for gp in gitpatches: | for gp in values: | def closefile(): if not current_file: return 0 current_file.close() return len(current_file.rej) |
if total == 1 and not opts.get('intro'): | if not introneeded(opts, total): | def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r') or line.startswith('diff --git'): break desc.append(line) if not pat... |
if len(patches) > 1 or opts.get('intro'): | if introneeded(opts, len(patches)): | def getpatchmsgs(patches, patchnames=None): jumbo = [] msgs = [] |
def buildtext(cachedelta): if text is not None: return text | btext = [text] def buildtext(): if btext[0] is not None: return btext[0] | def buildtext(cachedelta): if text is not None: return text # flush any pending writes here so we can read it in revision if dfh: dfh.flush() ifh.flush() basetext = self.revision(self.node(cachedelta[0])) patchedtext = mdiff.patch(basetext, cachedelta[1]) chk = hash(patchedtext, p1, p2) if chk != node: raise RevlogErro... |
patchedtext = mdiff.patch(basetext, cachedelta[1]) chk = hash(patchedtext, p1, p2) | btext[0] = mdiff.patch(basetext, cachedelta[1]) chk = hash(btext[0], p1, p2) | def buildtext(cachedelta): if text is not None: return text # flush any pending writes here so we can read it in revision if dfh: dfh.flush() ifh.flush() basetext = self.revision(self.node(cachedelta[0])) patchedtext = mdiff.patch(basetext, cachedelta[1]) chk = hash(patchedtext, p1, p2) if chk != node: raise RevlogErro... |
return patchedtext | return btext[0] | def buildtext(cachedelta): if text is not None: return text # flush any pending writes here so we can read it in revision if dfh: dfh.flush() ifh.flush() basetext = self.revision(self.node(cachedelta[0])) patchedtext = mdiff.patch(basetext, cachedelta[1]) chk = hash(patchedtext, p1, p2) if chk != node: raise RevlogErro... |
text = buildtext(cachedelta) | text = buildtext() | def buildtext(cachedelta): if text is not None: return text # flush any pending writes here so we can read it in revision if dfh: dfh.flush() ifh.flush() basetext = self.revision(self.node(cachedelta[0])) patchedtext = mdiff.patch(basetext, cachedelta[1]) chk = hash(patchedtext, p1, p2) if chk != node: raise RevlogErro... |
repo.mq.strip(repo, list(rootnodes), backup=backup, update=update, | revs = list(rootnodes) if update and opts.get('keep'): wlock = repo.wlock() try: urev = repo.mq.qparents(repo, revs[0]) repo.dirstate.rebuild(urev, repo[urev].manifest()) repo.dirstate.write() update = False finally: wlock.release() repo.mq.strip(repo, revs, backup=backup, update=update, | def strip(ui, repo, *revs, **opts): """strip changesets and all their descendants from the repository The strip command removes the specified changesets and all their descendants. If the working directory has uncommitted changes, the operation is aborted unless the --force flag is supplied. If a parent of the working... |
('n', 'no-backup', None, _('no backups')), ('', 'nobackup', None, _('no backups (DEPRECATED)'))], _('hg strip [-f] [-n] REV...')), | ('n', 'no-backup', None, _('no backups')), ('', 'nobackup', None, _('no backups (DEPRECATED)')), ('k', 'keep', None, _("do not modify working copy during strip"))], _('hg strip [-k] [-f] [-n] REV...')), | def dotable(cmdtable): for cmd in cmdtable.keys(): cmd = cmdutil.parsealiases(cmd)[0] if cmd in nowrap: continue entry = extensions.wrapcommand(cmdtable, cmd, mqcommand) entry[1].extend(mqopt) |
raise Exception(_('need at least one of -m, -a, -o, -n')) | raise util.Abort(_('need at least one of -m, -a, -o, -n')) | def debugbuilddag(ui, repo, text, mergeable_file=False, appended_file=False, overwritten_file=False, new_file=False): """builds a repo with a given dag from scratch in the current empty repo Elements: - "+n" is a linear run of n nodes based on the current default parent - "." is a single node based on the current def... |
raise Exception(_('repository is not empty')) | raise util.Abort(_('repository is not empty')) | def debugbuilddag(ui, repo, text, mergeable_file=False, appended_file=False, overwritten_file=False, new_file=False): """builds a repo with a given dag from scratch in the current empty repo Elements: - "+n" is a linear run of n nodes based on the current default parent - "." is a single node based on the current def... |
for i in xrange(min(revs) + 1, len(self)): | for i in xrange(first + 1, len(self)): | def descendants(self, *revs): """Generate the descendants of 'revs' in revision order. |
def patchopts(self, diffopts, patchfn): | def patchopts(self, diffopts, *patches): | def patchopts(self, diffopts, patchfn): """Return a copy of input diff options with git set to true if referenced patch is a git patch. """ diffopts = diffopts.copy() patchf = self.opener(patchfn, 'r') # if the patch was a git patch, refresh it as a git patch for line in patchf: if line.startswith('diff --git'): diffop... |
patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): diffopts.git = True break patchf.close() | for patchfn in patches: patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): diffopts.git = True break patchf.close() | def patchopts(self, diffopts, patchfn): """Return a copy of input diff options with git set to true if referenced patch is a git patch. """ diffopts = diffopts.copy() patchf = self.opener(patchfn, 'r') # if the patch was a git patch, refresh it as a git patch for line in patchf: if line.startswith('diff --git'): diffop... |
q.refresh(repo, msg=message) | diffopts = q.patchopts(q.diffopts(), *patches) q.refresh(repo, msg=message, git=diffopts.git) | 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... |
def descendant(self, a, b): if a > b: return False for i in self.descendants(a): if i == b: | def descendant(self, start, end): for i in self.descendants(start): if i == end: | def descendant(self, a, b): if a > b: return False for i in self.descendants(a): if i == b: return True elif i > b: break return False |
elif i > b: | elif i > end: | def descendant(self, a, b): if a > b: return False for i in self.descendants(a): if i == b: return True elif i > b: break return False |
if self.descendant(a, b): | if self.descendant(start, end): | def ancestor(self, a, b): """calculate the least common ancestor of nodes a and b""" |
el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout)) or el.endswith(" (esc)\n") and el.decode('string-escape') == l): | el.endswith(" (glob)\n") and globmatch(el[:-8] + '\n', lout) or el.endswith(" (esc)\n") and el.decode('string-escape') == l)): | def globmatch(el, l): # The only supported special characters are * and ?. Escaping is # supported. i, n = 0, len(el) res = '' while i < n: c = el[i] i += 1 if c == '\\' and el[i] in '*?\\': res += el[i - 1:i + 1] i += 1 elif c == '*': res += '.*' elif c == '?': res += '.' else: res += re.escape(c) return rematch(res, ... |
modified = [f for f in modified if f in recctx] added = [f for f in added if f in recctx] | changed = recctx.files() modified = [f for f in modified if f in changed] added = [f for f in added if f in changed] | def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts): '''Wraps record.dorecord expanding keywords after recording.''' wlock = repo.wlock() try: # record returns 0 even when nothing has changed # therefore compare nodes before and after kwt.record = True ctx = repo['.'] modified, added = repo[None].status()[:2] re... |
if s[offset] == '\\' and offset + 1 < len(s) and s[offset + 1] == '"': | if (s[offset] == '\\' and offset + 1 < len(s) and s[offset + 1] == '"'): | def _parse_quote(parts, s, offset): if offset < len(s) and s[offset] == '"': # "" parts.append('') offset += 1 while offset < len(s) and (s[offset].isspace() or s[offset] == ','): offset += 1 return _parse_plain, parts, offset |
def cdiffstat(ui, summary, patchlines): s = patch.diffstat(patchlines) if summary: ui.write(summary, '\n') ui.write(s, '\n') if ui.promptchoice(_('does the diffstat above look okay (yn)?'), (_('&Yes'), _('&No'))): raise util.Abort(_('diffstat rejected')) return s | def cdiffstat(ui, summary, patchlines): s = patch.diffstat(patchlines) if summary: ui.write(summary, '\n') ui.write(s, '\n') if ui.promptchoice(_('does the diffstat above look okay (yn)?'), (_('&Yes'), _('&No'))): raise util.Abort(_('diffstat rejected')) return s | |
body += cdiffstat(ui, '\n'.join(desc), patchlines) + '\n\n' | body += ds + '\n\n' | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, patchname=None): desc = [] node = None body = '' for line in patchlines: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r') or line.startswith('diff --git'): break desc.append(line) ... |
return msg, subj | return msg, subj, ds | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, patchname=None): desc = [] node = None body = '' for line in patchlines: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r') or line.startswith('diff --git'): break desc.append(line) ... |
if opts.get('diffstat'): d = cdiffstat(ui, _('Final summary:\n'), jumbo) if d: body = '\n' + d | ds = patch.diffstat(jumbo) if ds and opts.get('diffstat'): body = '\n' + ds | def getpatchmsgs(patches, patchnames=None): jumbo = [] msgs = [] |
msgs.insert(0, (msg, subj)) | msgs.insert(0, (msg, subj, ds)) | def getpatchmsgs(patches, patchnames=None): jumbo = [] msgs = [] |
return [(msg, subj)] | return [(msg, subj, None)] | def getbundlemsgs(bundle): subj = (opts.get('subject') or prompt(ui, 'Subject:', 'A bundle for your repository')) |
for m, subj in msgs: | for m, subj, ds in msgs: | def getaddrs(opt, prpt=None, default=None): addrs = opts.get(opt.replace('-', '_')) if addrs: return mail.addrlistencode(ui, addrs, _charsets, opts.get('test')) |
hgpatch = 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.