rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
yield 'f', util.pconvert(np), st | yield 'f', np, st | def findfiles(s): work = [s] while work: top = work.pop() names = os.listdir(top) names.sort() # nd is the top of the repository dir tree nd = util.normpath(top[len(self.root) + 1:]) if nd == '.': nd = '' for f in names: np = os.path.join(nd, f) if seen(np): continue p = os.path.join(top, f) # don't trip over symlinks ... |
version='0.4f', | version='0.5', | def finalize_options(self): self.set_undefined_options('install', ('install_lib', 'install_dir')) install_data.finalize_options(self) |
for rev in range(1,cl.count()): | for rev in range(0,cl.count()): | def gather_stats(ui, repo, amap): stats = {} cl = repo.changelog for rev in range(1,cl.count()): node2 = cl.node(rev) node1 = cl.parents(node2)[0] who, lines = __gather(ui, repo, node1, node2) # remap the owner if possible if amap.has_key(who): ui.note("using '%s' alias for '%s'\n" % (amap[who], who)) who ... |
file(f + ".tmp", "wb").write(file(f, "rb").read()) rename(f+".tmp", f) | d, fn = os.path.split(f) fd, temp = tempfile.mkstemp(prefix=fn, dir=d) fp = os.fdopen(fd, "wb") try: fp.write(file(f, "rb").read()) except: try: os.unlink(temp) except: pass raise fp.close() rename(temp, f) | def o(path, mode="r", text=False): f = os.path.join(p, path) |
files.append(l[14:]) f.close() | pf = l[14:] if pf not in files: files.append(pf) patcherr = f.close() if patcherr: sys.stderr.write("patch failed") sys.exit(1) | def import_(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" try: import psyco psyco.full() except: pass patches = (patch1,) + patches d = opts["base"] strip = opts["strip"] quiet = ui.quiet and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.join(... |
patch.diff(self.repo, fp, prev, ref) | patch.diff(self.repo, prev, ref, fp=fp) | def diff(self, node, ref): maxdiff = int(self.ui.config('notify', 'maxdiff', 300)) if maxdiff == 0: return fp = templater.stringio() prev = self.repo.changelog.parents(node)[0] patch.diff(self.repo, fp, prev, ref) difflines = fp.getvalue().splitlines(1) if maxdiff > 0 and len(difflines) > maxdiff: self.sio.write(_('\nd... |
msg.attach(email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')) | p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch') node = bin(node) patchname = [t for t in repo.nodetags(node) if t.endswith('.patch') or t.endswith('.diff')] if patchname: patchname = patchname[0] elif total > 1: patchname = commands.make_filename(repo, '%b-%n.patch', node, idx, total) else: patchname = comman... | def makepatch(patch, idx, total): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r'): break desc.append(line) if not node: raise ValueError |
if not opts['dry_run']: | if not opts.get('dry_run'): | def add(ui, repo, *pats, **opts): """add the specified files on the next commit Schedule files to be version controlled and added to the repository. The files will be added to the repository at the next commit. If no names are given, add all files in the repository. """ names = [] for src, abs, rel, exact in walk(r... |
if not opts['after'] and not opts['dry_run']: | if not opts['after'] and not opts.get('dry_run'): | def copy(origsrc, abssrc, relsrc, target, exact): abstarget = util.canonpath(repo.root, cwd, target) reltarget = util.pathto(cwd, abstarget) prevsrc = targets.get(abstarget) if prevsrc is not None: ui.warn(_('%s: not overwriting - %s collides with %s\n') % (reltarget, abssrc, prevsrc)) return if (not opts['after'] and ... |
if not os.path.isdir(targetdir) and not opts['dry_run']: | if not os.path.isdir(targetdir) and not opts.get('dry_run'): | def copy(origsrc, abssrc, relsrc, target, exact): abstarget = util.canonpath(repo.root, cwd, target) reltarget = util.pathto(cwd, abstarget) prevsrc = targets.get(abstarget) if prevsrc is not None: ui.warn(_('%s: not overwriting - %s collides with %s\n') % (reltarget, abssrc, prevsrc)) return if (not opts['after'] and ... |
if restore and not opts['dry_run']: | if restore and not opts.get('dry_run'): | def copy(origsrc, abssrc, relsrc, target, exact): abstarget = util.canonpath(repo.root, cwd, target) reltarget = util.pathto(cwd, abstarget) prevsrc = targets.get(abstarget) if prevsrc is not None: ui.warn(_('%s: not overwriting - %s collides with %s\n') % (reltarget, abssrc, prevsrc)) return if (not opts['after'] and ... |
if not opts['dry_run']: | if not opts.get('dry_run'): | def copy(origsrc, abssrc, relsrc, target, exact): abstarget = util.canonpath(repo.root, cwd, target) reltarget = util.pathto(cwd, abstarget) prevsrc = targets.get(abstarget) if prevsrc is not None: ui.warn(_('%s: not overwriting - %s collides with %s\n') % (reltarget, abssrc, prevsrc)) return if (not opts['after'] and ... |
if abstarget != origsrc and not opts['dry_run']: | if abstarget != origsrc and not opts.get('dry_run'): | def copy(origsrc, abssrc, relsrc, target, exact): abstarget = util.canonpath(repo.root, cwd, target) reltarget = util.pathto(cwd, abstarget) prevsrc = targets.get(abstarget) if prevsrc is not None: ui.warn(_('%s: not overwriting - %s collides with %s\n') % (reltarget, abssrc, prevsrc)) return if (not opts['after'] and ... |
if not opts['dry_run']: | if not opts.get('dry_run'): | def rename(ui, repo, *pats, **opts): """rename files; equivalent of copy + remove Mark dest as copies of sources; mark sources for deletion. If dest is a directory, copies are put in that directory. If dest is a file, there can only be one source. By default, this command copies the contents of files as they stand ... |
pf = os.path.normpath(l[14:]) if pf[0] == "'" and pf[-1] == "'": pf = pf[1:-1] | pf = os.path.normpath(util.parse_patch_output(l)) | def patch(self, repo, patchfile): '''Apply patchfile to the working directory. patchfile: file name of patch''' try: pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') f = os.popen("%s -d %s -p1 --no-backup-if-mismatch < %s" % (pp, util.shellquote(repo.root), util.shellquote(patchfile))) except: sel... |
def rawcommit(ui, repo, flist, **rc): | def rawcommit(ui, repo, *flist, **rc): | def rawcommit(ui, repo, flist, **rc): "raw commit interface" text = rc['text'] if not text and rc['logfile']: try: text = open(rc['logfile']).read() except IOError: pass if not text and not rc['logfile']: print "missing commit text" return 1 files = relpath(repo, flist) if rc['files']: files += open(rc['files']).read... |
files = relpath(repo, flist) | files = relpath(repo, list(flist)) | def rawcommit(ui, repo, flist, **rc): "raw commit interface" text = rc['text'] if not text and rc['logfile']: try: text = open(rc['logfile']).read() except IOError: pass if not text and not rc['logfile']: print "missing commit text" return 1 files = relpath(repo, flist) if rc['files']: files += open(rc['files']).read... |
"""output the latest or given revisions of files | """output the current or given revision of files | def cat(ui, repo, file1, *pats, **opts): """output the latest or given revisions of files Print the specified files as they were at the given revision. If no revision is given then working dir parent is used, or tip if no revision is checked out. Output may be to a file, in which case the name of the file is given us... |
"""output the latest or given revision of the project manifest | """output the current or given revision of the project manifest | def manifest(ui, repo, rev=None): """output the latest or given revision of the project manifest Print a list of version controlled files for the given revision. The manifest is the list of files being version controlled. If no revision is given then the first parent of the working directory is used. With -v flag, p... |
try: del self[f] except: pass | try: del self.map[f] except KeyError: pass | def remove(self, files): if not files: return self.read() self.dirty = 1 for f in files: try: del self[f] except: pass |
class httphandler(keepalive.HTTPHandler): | class basehttphandler(keepalive.HTTPHandler): | def send(self, data): if isinstance(data, str): keepalive.HTTPConnection.send(self, data) else: # if auth required, some data sent twice, so rewind here data.seek(0) for chunk in util.filechunkiter(data): keepalive.HTTPConnection.send(self, chunk) |
class httpsconnection(httplib.HTTPSConnection): def send(self, data): if isinstance(data, str): httplib.HTTPSConnection.send(self, data) else: data.seek(0) for chunk in util.filechunkiter(data): httplib.HTTPSConnection.send(self, chunk) class httpshandler(urllib2.HTTPSHandler): def https_open(self, req): return sel... | has_https = hasattr(urllib2, 'HTTPSHandler') if has_https: class httpsconnection(httplib.HTTPSConnection): response_class = keepalive.HTTPResponse def send(self, data): if isinstance(data, str): httplib.HTTPSConnection.send(self, data) else: data.seek(0) for chunk in util.filechunkiter(data): httplib.HTTPSConnection... | def http_open(self, req): return self.do_open(httpconnection, req) |
httpshandler(), | def __init__(self, ui, path): self.caps = None scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if query or frag: raise util.Abort(_('unsupported URL component: "%s"') % (query or frag)) if not urlpath: urlpath = '/' host, port, user, passwd = netlocsplit(netloc) | |
pass | def __init__(self, ui, path): if not has_https: raise util.Abort(_('Python support for SSL and HTTPS ' 'is not installed')) httprepository.__init__(self, ui, path) | def unbundle(self, cg, heads, source): # have to stream bundle to a temp file because we do not have # http 1.1 chunked transfer. |
self.note(_('sending mail: smtp host %s, port %s\n') % (mailhost, mailport)) | ui.note(_('sending mail: smtp host %s, port %s\n') % (mailhost, mailport)) | def _smtp(ui): '''send mail using smtp.''' local_hostname = ui.config('smtp', 'local_hostname') s = smtplib.SMTP(local_hostname=local_hostname) mailhost = ui.config('smtp', 'host') if not mailhost: raise util.Abort(_('no [smtp]host in hgrc - cannot send mail')) mailport = int(ui.config('smtp', 'port', 25)) self.note(_... |
needed = {} | needed = {node:1} | def pair(parent, child): new = [] sm = SequenceMatcher(None, strip(parent), strip(child)) for o, m, n, s, t in sm.get_opcodes(): if o == 'equal': new += parent[m:n] else: new += child[s:t] return new |
fp = os.popen('"%s" -p%d < "%s"' % (patcher, strip, patchname)) | fp = os.popen('%s -p%d < "%s"' % (patcher, strip, patchname)) | def patch(strip, patchname, ui): """apply the patch <patchname> to the working directory. a list of patched files is returned""" patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') fp = os.popen('"%s" -p%d < "%s"' % (patcher, strip, patchname)) files = {} for line in fp: line = line.rstrip() ui.status... |
subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) | if total == 1: subj = '[PATCH] ' + desc[0].strip() else: subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) | def makepatch(patch, idx, total): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if line.startswith('diff -r'): break desc.append(line) if not node: raise ValueError |
commands.setremoteconfig(**opts) | commands.setremoteconfig(ui, opts) | def clone(ui, source, dest=None, **opts): '''clone main and patch repository at same time If source is local, destination will have no patches applied. If source is remote, this command can not check if patches are applied in source, so cannot guarantee that patches are not applied in destination. If you clone remot... |
patchname = commands.make_filename(repo, '%b-%n.patch', | patchname = cmdutil.make_filename(repo, '%b-%n.patch', | def makepatch(patch, idx, total): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if (line.startswith('diff -r') or line.startswith('diff --git')): break desc.append(line) if not node: raise ValueError |
patchname = commands.make_filename(repo, '%b.patch', binnode) | patchname = cmdutil.make_filename(repo, '%b.patch', binnode) | def makepatch(patch, idx, total): desc = [] node = None body = '' for line in patch: if line.startswith('#'): if line.startswith('# Node ID'): node = line.split()[-1] continue if (line.startswith('diff -r') or line.startswith('diff --git')): break desc.append(line) if not node: raise ValueError |
du.write("\n\n") | dui.write("\n\n") | def __getattr__(self, key): return getattr(self.ui, key) |
"rawcommit": | "debugrawcommit|rawcommit": | def verify(ui, repo): """verify the integrity of the repository Verify the integrity of the current repository. This will perform an extensive check of the repository's integrity, validating the hashes and checksums of each entry in the changelog, manifest, and tracked files, as well as the integrity of their crossli... |
_('hg rawcommit [OPTION]... [FILE]...')), | _('hg debugrawcommit [OPTION]... [FILE]...')), | def verify(ui, repo): """verify the integrity of the repository Verify the integrity of the current repository. This will perform an extensive check of the repository's integrity, validating the hashes and checksums of each entry in the changelog, manifest, and tracked files, as well as the integrity of their crossli... |
print repr(header) | def check_heads(): heads = map(hex, self.repo.heads()) return their_heads == [hex('force')] or their_heads == heads | |
_("failed to remove %s from manifest\n") % f) | _("failed to remove %s from manifest") % f) | def addlistdelta(addlist, x): # start from the bottom up # so changes to the offsets don't mess things up. i = len(x) while i > 0: i -= 1 start = x[i][0] end = x[i][1] if x[i][2]: addlist[start:end] = array.array('c', x[i][2]) else: del addlist[start:end] return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2... |
('b', 'base', "", 'base path')], | ('b', 'base', "", 'base path'), ('m', 'mail-like', None, 'apply a patch that looks like email')], | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
self.write(*msg) | self.write_err(*msg) | def warn(self, *msg): self.write(*msg) |
return (nullid, "", "0", [], "") | return (nullid, "", (0, 0), [], "") | def extract(self, text): if not text: return (nullid, "", "0", [], "") last = text.index("\n\n") desc = text[last + 2:] l = text[:last].splitlines() manifest = bin(l[0]) user = l[1] date = l[2].split(' ') time = float(date.pop(0)) try: # various tools did silly things with the time zone field. timezone = int(date[0]) e... |
self.hook("precommit", throw=True, p1=xp1, p2=xp2) | self.hook("precommit", throw=True, parent1=xp1, parent2=xp2) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, wlock=None): commit = [] remove = [] changed = [] |
self.hook('pretxncommit', throw=True, node=hex(n), p1=xp1, p2=xp2) | self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, parent2=xp2) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, wlock=None): commit = [] remove = [] changed = [] |
self.hook("commit", node=hex(n), p1=xp1, p2=xp2) | self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, wlock=None): commit = [] remove = [] changed = [] |
class repository: | class localrepository: | def o(path, mode="r"): if p[:7] == "http://": f = os.path.join(p, urllib.quote(path)) return httprangereader(f) |
tip = remote.branches([]) | tip = remote.branches([])[0] | def getchangegroup(self, remote): tip = remote.branches([]) cl = self.changelog unknown = tip search = [] fetch = [] |
unknown = tip | unknown = [tip] | def getchangegroup(self, remote): tip = remote.branches([]) cl = self.changelog unknown = tip search = [] fetch = [] |
return "" | return None | def getchangegroup(self, remote): tip = remote.branches([]) cl = self.changelog unknown = tip search = [] fetch = [] |
if f == 1: | if f <= 4: | def getchangegroup(self, remote): tip = remote.branches([]) cl = self.changelog unknown = tip search = [] fetch = [] |
cg = [] | def changegroup(self, basenodes): nodes = self.newer(basenodes) | |
g = self.changelog.group(linkmap) cg.append(g) g = self.manifest.group(linkmap) cg.append(g) | yield self.changelog.group(linkmap) yield self.manifest.group(linkmap) | def changegroup(self, basenodes): nodes = self.newer(basenodes) |
cg += [l, f, g] return "".join(cg) | yield "".join([l, f, g]) | def changegroup(self, basenodes): nodes = self.newer(basenodes) |
ignore = [] | ignore = ['_hashlib', 'email.mime'] | def _demandimport(name, globals=None, locals=None, fromlist=None): if not locals or name in ignore or fromlist == ('*',): # these cases we can't really delay return _origimport(name, globals, locals, fromlist) elif not fromlist: # import a [as b] if '.' in name: # a.b base, rest = name.split('.', 1) # if a is already d... |
def date(self, t): return util.datestr(t) | def date(self, t): return util.datestr(t) | |
date1 = self.date(change1) date2 = self.date(change2) | date1 = util.datestr(change1[2]) date2 = util.datestr(change2[2]) | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line=l) elif l.startswith('-'): yield self.t("difflineminus", line=l) elif l.startswith('@'): yield self.t("difflineat", line=l) else: yield self.t("diffline", line=l) |
if options["version"]: return ("version", show_version, [], options, cmdoptions) elif not args: return ("help", help_, ["shortlist"], options, cmdoptions) | if args: cmd, args = args[0], args[1:] i = find(cmd)[1] c = list(i[1]) | def parse(args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if options["version"]: return ("version", show_version, [], options, cmdoptions) elif not args: return ("help", help_, ["shortlist"], options... |
cmd, args = args[0], args[1:] i = find(cmd)[1] | cmd = None c = [] | def parse(args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if options["version"]: return ("version", show_version, [], options, cmdoptions) elif not args: return ("help", help_, ["shortlist"], options... |
c = list(i[1]) | def parse(args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if options["version"]: return ("version", show_version, [], options, cmdoptions) elif not args: return ("help", help_, ["shortlist"], options... | |
return (cmd, i[0], args, options, cmdoptions) | return (cmd, cmd and i[0] or None, args, options, cmdoptions) | def parse(args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if options["version"]: return ("version", show_version, [], options, cmdoptions) elif not args: return ("help", help_, ["shortlist"], options... |
def debugconfig(ui, repo): """show combined config settings from all hgrc files""" | def debugconfig(ui, repo, *values): """show combined config settings from all hgrc files With no args, print names and values of all config items. With one arg of the form section.name, print just the value of that config item. With multiple args, print names and values of all config items with matching section name... | def debugconfig(ui, repo): """show combined config settings from all hgrc files""" for section, name, value in ui.walkconfig(): ui.write('%s.%s=%s\n' % (section, name, value)) |
ui.write('%s.%s=%s\n' % (section, name, value)) | sectname = section + '.' + name if values: for v in values: if v == section: ui.write('%s=%s\n' % (sectname, value)) elif v == sectname: ui.write(value, '\n') else: ui.write('%s=%s\n' % (sectname, value)) | def debugconfig(ui, repo): """show combined config settings from all hgrc files""" for section, name, value in ui.walkconfig(): ui.write('%s.%s=%s\n' % (section, name, value)) |
"debugconfig": (debugconfig, [], _('debugconfig')), | "debugconfig": (debugconfig, [], _('debugconfig [NAME]...')), | def verify(ui, repo): """verify the integrity of the repository Verify the integrity of the current repository. This will perform an extensive check of the repository's integrity, validating the hashes and checksums of each entry in the changelog, manifest, and tracked files, as well as the integrity of their crossli... |
counts = {'-': 0, '+': 0} | found = False | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
if not opts['all']: a, b, r = prevstates, states, rev | r = prev.get(fn, -1) if opts['all']: iter = difflinestates(states, prevstates) | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): | iter = [('', l) for l in prevstates] for change, l in iter: | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
counts[change] += 1 return counts['+'], counts['-'] | found = True return found | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
count = 0 | found = False | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
if not opts['all'] or fstate[fn]: pos, neg = display(fn, rev, m, fstate[fn]) count += pos + neg if pos and not opts['all']: | if fn in prev or fstate[fn]: r = display(fn, rev, m, fstate[fn]) found = found or r if r and not opts['all']: | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
display(fn, rev, {}, state) return (count == 0 and 1) or 0 | found = display(fn, rev, {}, state) or found return (not found and 1) or 0 | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if not opts['all']: a, b, r = prevstates, states, rev else: a, b, r = states, prevstates, prev.get(fn, -1) for change, l in difflinestates(a, b): cols = [fn, str(r)] if opts['line_number']: cols.append(str(l.linenum)) if opts['all']... |
def debugconfig(ui): | def debugconfig(ui, repo): | def debugconfig(ui): """show combined config settings from all hgrc files""" try: repo = hg.repository(ui) ui = repo.ui except hg.RepoError: pass for section, name, value in ui.walkconfig(): ui.write('%s.%s=%s\n' % (section, name, value)) |
try: repo = hg.repository(ui) ui = repo.ui except hg.RepoError: pass | def debugconfig(ui): """show combined config settings from all hgrc files""" try: repo = hg.repository(ui) ui = repo.ui except hg.RepoError: pass for section, name, value in ui.walkconfig(): ui.write('%s.%s=%s\n' % (section, name, value)) | |
def paths(ui, search=None): | def paths(ui, repo, search=None): | def paths(ui, search=None): """show definition of symbolic path names Show definition of symbolic path name NAME. If no name is given, show definition of available names. Path names are defined in the [paths] section of /etc/mercurial/hgrc and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. """ try: ... |
try: repo = hg.repository(ui) ui = repo.ui except hg.RepoError: pass | def paths(ui, search=None): """show definition of symbolic path names Show definition of symbolic path name NAME. If no name is given, show definition of available names. Path names are defined in the [paths] section of /etc/mercurial/hgrc and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. """ try: ... | |
norepo = ("clone init version help debugancestor debugconfig debugdata" " debugindex debugindexdot paths") | norepo = ("clone init version help debugancestor debugdata" " debugindex debugindexdot") optionalrepo = ("paths debugconfig") | def verify(ui, repo): """verify the integrity of the repository Verify the integrity of the current repository. This will perform an extensive check of the repository's integrity, validating the hashes and checksums of each entry in the changelog, manifest, and tracked files, as well as the integrity of their crossli... |
if not repo: repo = hg.repository(u, path=path) u = repo.ui for x in external: if hasattr(x, 'reposetup'): x.reposetup(u, repo) | try: if not repo: repo = hg.repository(u, path=path) u = repo.ui for x in external: if hasattr(x, 'reposetup'): x.reposetup(u, repo) except hg.RepoError: if cmd not in optionalrepo.split(): raise | def print_time(): t = get_times() u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
c, a, d, u, mf2 = [], [], [], [], None | mf2, u = None, [] | def changes(self, node1, node2, files=None): # changed, added, deleted, unknown c, a, d, u, mf2 = [], [], [], [], None |
path.replace(".hg/", ".hg.hg/") path.replace(".i/", ".i.hg/") path.replace(".d/", ".i.hg/") return path | return (path .replace(".hg/", ".hg.hg/") .replace(".i/", ".i.hg/") .replace(".d/", ".d.hg/")) | def encodedir(self, path): path.replace(".hg/", ".hg.hg/") path.replace(".i/", ".i.hg/") path.replace(".d/", ".i.hg/") return path |
path.replace(".d.hg/", ".d/") path.replace(".i.hg/", ".i/") path.replace(".hg.hg/", ".hg/") return path | return (path .replace(".d.hg/", ".d/") .replace(".i.hg/", ".i/") .replace(".hg.hg/", ".hg/")) | def decodedir(self, path): path.replace(".d.hg/", ".d/") path.replace(".i.hg/", ".i/") path.replace(".hg.hg/", ".hg/") return path |
pos = fctx.filerev() start = max(0, pos - pagelen + 1) end = min(count, start + pagelen) pos = end - 1 | def entries(**map): pos = fctx.filerev() start = max(0, pos - pagelen + 1) end = min(count, start + pagelen) pos = end - 1 l = [] parity = (count - 1) & 1 | |
nav = revnavgen(fctx.filerev(), self.maxshortchanges, count) | nav = revnavgen(pos, pagelen, count) | def entries(**map): pos = fctx.filerev() start = max(0, pos - pagelen + 1) end = min(count, start + pagelen) pos = end - 1 l = [] parity = (count - 1) & 1 |
def pop(self, repo, patch=None, force=False, update=True, wlock=None): | def pop(self, repo, patch=None, force=False, update=True, all=False, wlock=None): | def pop(self, repo, patch=None, force=False, update=True, wlock=None): def getfile(f, rev): t = repo.file(f).read(rev) try: repo.wfile(f, "w").write(t) except IOError: try: os.makedirs(os.path.dirname(repo.wjoin(f))) except OSError, err: if err.errno != errno.EEXIST: raise repo.wfile(f, "w").write(t) |
info = [len(self.applied) - 1] + self.applied[-1].split(':') | if all: popi = 0 else: popi = len(self.applied) - 1 else: popi = info[0] + 1 if popi >= end: self.ui.warn("qpop: %s is already at the top\n" % patch) return info = [ popi ] + self.applied[popi].split(':') | def getfile(f, rev): t = repo.file(f).read(rev) try: repo.wfile(f, "w").write(t) except IOError: try: os.makedirs(os.path.dirname(repo.wjoin(f))) except OSError, err: if err.errno != errno.EEXIST: raise repo.wfile(f, "w").write(t) |
if opts['all'] and len(q.applied) > 0: patch = q.applied[0].split(':')[1] q.pop(repo, patch, force=opts['force'], update=localupdate) | q.pop(repo, patch, force=opts['force'], update=localupdate, all=opts['all']) | def pop(ui, repo, patch=None, **opts): """pop the current patch off the stack""" localupdate = True if opts['name']: q = queue(ui, repo.join(""), repo.join(opts['name'])) ui.warn('using patch queue: %s\n' % q.path) localupdate = False else: q = repomap[repo] if opts['all'] and len(q.applied) > 0: patch = q.applied[0].s... |
self._changeset = changectx(self._repo, self._id) | self._changeset = self._repo.changelog.read(self._id) | def __init__(self, repo, path, changeid=None, fileid=None): """changeid can be a changeset revision, node, or tag. fileid can be a file revision or node.""" self._repo = repo self._path = path self._id = changeid self._fileid = fileid |
self._node = node | def __init__(self, repo, path, changeid=None, fileid=None): """changeid can be a changeset revision, node, or tag. fileid can be a file revision or node.""" self._repo = repo self._path = path self._id = changeid self._fileid = fileid | |
def filterfiles(list, files): l = [ x for x in list if x in files ] for f in files: if f[-1] != os.sep: f += os.sep l += [ x for x in list if x.startswith(f) ] | def filterfiles(filters, files): l = [ x for x in files if x in filters ] for t in filters: if t and t[-1] != os.sep: t += os.sep l += [ x for x in files if x.startswith(t) ] | def filterfiles(list, files): l = [ x for x in list if x in files ] for f in files: if f[-1] != os.sep: f += os.sep l += [ x for x in list if x.startswith(f) ] return l |
def relfilter(repo, args): | def relfilter(repo, files): | def relfilter(repo, args): if os.getcwd() != repo.root: p = os.getcwd()[len(repo.root) + 1: ] return filterfiles(p, args) return args |
return filterfiles(p, args) return args | return filterfiles(p, files) return files | def relfilter(repo, args): if os.getcwd() != repo.root: p = os.getcwd()[len(repo.root) + 1: ] return filterfiles(p, args) return args |
return [ os.path.join(p, x) for x in args ] | return [ os.path.normpath(os.path.join(p, x)) for x in args ] | def relpath(repo, args): if os.getcwd() != repo.root: p = os.getcwd()[len(repo.root) + 1: ] return [ os.path.join(p, x) for x in args ] return args |
def init(ui): """create a repository""" hg.repository(ui, ".", create=1) def branch(ui, path): '''branch from a local repository''' os.system("cp -al %s/.hg .hg" % path) def checkout(ui, repo, changeset=None): '''checkout a given changeset or the current tip''' | def add(ui, repo, file, *files): '''add the specified files on the next commit''' repo.add(relpath(repo, (file,) + files)) def addremove(ui, repo): | def init(ui): """create a repository""" hg.repository(ui, ".", create=1) |
if c or a or d: ui.warn("aborting (outstanding changes in working directory)\n") sys.exit(1) node = repo.changelog.tip() if changeset: node = repo.lookup(changeset) repo.checkout(node) def annotate(u, repo, *args, **ops): | repo.add(a) repo.remove(d) def annotate(u, repo, file, *files, **ops): | def checkout(ui, repo, changeset=None): '''checkout a given changeset or the current tip''' (c, a, d, u) = repo.diffdir(repo.root) if c or a or d: ui.warn("aborting (outstanding changes in working directory)\n") sys.exit(1) node = repo.changelog.tip() if changeset: node = repo.lookup(changeset) repo.checkout(node) |
args = relpath(repo, args) | def getname(rev): try: return bcache[rev] except KeyError: cl = repo.changelog.read(repo.changelog.node(rev)) name = cl[1] f = name.find('@') if f >= 0: name = name[:f] bcache[rev] = name return name | |
for f in args: | for f in relpath(repo, (file,) + files): | def getname(rev): try: return bcache[rev] except KeyError: cl = repo.changelog.read(repo.changelog.node(rev)) name = cl[1] f = name.find('@') if f >= 0: name = name[:f] bcache[rev] = name return name |
def resolve(ui, repo, node = None): | def recover(ui, repo): repo.recover() def remove(ui, repo, file, *files): """remove the specified files on the next commit""" repo.remove(relpath(repo, (file,) + files)) def resolve(ui, repo, node=None): | def resolve(ui, repo, node = None): '''merge a given node or the current tip into the working dir''' if not node: node = repo.changelog.tip() else: node = repo.lookup(node) repo.resolve(node) |
"init": (init, [], 'hg init'), "branch|clone": (branch, [], 'hg branch [path]'), "heads": (heads, [], 'hg heads'), "help": (help, [], 'hg help [command]'), "checkout|co": (checkout, [], 'hg checkout [changeset]'), | "add": (add, [], "hg add [files]"), "addremove": (addremove, [], "hg addremove"), | def undo(ui, repo): repo.undo() |
if ui.verbose: | if ui.debugflag: | def show_changeset(ui, repo, rev=0, changenode=None, filelog=None): """show a single changeset or file revision""" changelog = repo.changelog if filelog: log = filelog filerev = rev node = filenode = filelog.node(filerev) changerev = filelog.linkrev(filenode) changenode = changenode or changelog.node(changerev) else: l... |
msg = email.MIMEMultipart.MIMEMultipart() msg['Subject'] = '[PATCH 0 of %d] %s' % ( | subj = '[PATCH 0 of %d] %s' % ( | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('email', opt) or ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] |
msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n')) | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('email', opt) or ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] | |
if d: msg.attach(email.MIMEText.MIMEText(d)) | if d: body.append('\n' + d) body = '\n'.join(body) + '\n' msg = email.MIMEText.MIMEText(body) msg['Subject'] = subj | def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('email', opt) or ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()] |
raise hg.RepoError(_("push refused: %s"), d) | raise hg.RepoError(_("push refused: %s") % d) | def addchangegroup(self, cg, source): d = self.call("addchangegroup") if d: raise hg.RepoError(_("push refused: %s"), d) |
print regexp | def match(self, x): return on_empty | |
base = -1 | base = prev = -1 | def addgroup(self, revs, linkmapper, transaction, unique = 0): # given a set of deltas, add them to the revision log. the # first delta is against its parent, which should be in our # log, the rest are against the previous delta. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.