rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.ui.status(_("tag: %s\n") % tag)
self.ui.write(_("tag: %s\n") % tag)
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.debug(_("manifest: %d:%s\n") % (self.repo.manifest.rev(changes[0]), hex(changes[0]))) self.ui.status(_("user: %s\n") % changes[1]) self.ui.status(_("date: %s\n") % date)
if self.ui.debugflag: self.ui.write(_("manifest: %d:%s\n") % (self.repo.manifest.rev(changes[0]), hex(changes[0]))) self.ui.write(_("user: %s\n") % changes[1]) self.ui.write(_("date: %s\n") % date)
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.note("%-12s %s\n" % (key, " ".join(value))) elif changes[3]: self.ui.note(_("files: %s\n") % " ".join(changes[3])) if copies:
self.ui.write("%-12s %s\n" % (key, " ".join(value))) elif changes[3] and self.ui.verbose: self.ui.write(_("files: %s\n") % " ".join(changes[3])) if copies and self.ui.verbose:
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.note(_("copies: %s\n") % ' '.join(copies))
self.ui.write(_("copies: %s\n") % ' '.join(copies))
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.debug(_("extra: %s=%s\n")
self.ui.write(_("extra: %s=%s\n")
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.status(_("description:\n")) self.ui.status(description) self.ui.status("\n\n")
self.ui.write(_("description:\n")) self.ui.write(description) self.ui.write("\n\n")
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.ui.status(_("summary: %s\n") % description.splitlines()[0]) self.ui.status("\n")
self.ui.write(_("summary: %s\n") % description.splitlines()[0]) self.ui.write("\n")
def show(self, rev=0, changenode=None, brinfo=None, copies=None): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode)
self.hook('pretxnchangegroup', throw=True, node=hex(self.changelog.node(cor+1)), source=srctype)
if changesets > 0: self.hook('pretxnchangegroup', throw=True, node=hex(self.changelog.node(cor+1)), source=srctype)
def revmap(x): return cl.rev(x)
hgpatch = False message = fp.getvalue() or message
message = fp.getvalue()
def import_(ui, repo, patch1, *patches, **opts): """import an ordered set of patches Import a list of patches and commit them individually. If there are outstanding changes in the working directory, import will abort unless given the -f flag. You can import a patch straight from a mail message. Even patches as atta...
self.ui.debug("remote deleted %s\n" % f) remove.append(f)
self.ui.debug("local created %s, keeping\n" % f)
def update(self, node, allow=False, force=False): pl = self.dirstate.parents() if not force and pl[1] != nullid: self.ui.warn("aborting: outstanding uncommitted merges\n") return
p1 = hex(p1),
parent = self.parents("filediffparent", cl.parents(n), cl.rev),
def diff(): yield self.diff(p1, n, file)
filenode=hex(mf.get(f, nullid)), file=f))
filenode=hex(mf.get(f, nullid)), file=f, parity=parity)) parity = 1 - parity
def changeset(self, nodeid): cl = self.repo.changelog n = self.repo.lookup(nodeid) nodeid = hex(n) changes = cl.read(n) p1 = cl.parents(n)[0]
(self.series[idx], ' '.join(why)))
(self.series[idx], why))
def explain_pushable(self, idx, all_patches=False): write = all_patches and self.ui.write or self.ui.warn if all_patches or self.ui.verbose: if isinstance(idx, str): idx = self.series.index(idx) pushable, why = self.pushable(idx) if all_patches and pushable: if why is None: write(_('allowing %s - no guards in effect\n'...
except RepoError:
except hg.RepoError:
def footer(**map): yield self.t("footer", **map)
raise RepoError('IPv6 not available on this system')
raise hg.RepoError('IPv6 not available on this system')
def __init__(self, *args, **kwargs): if self.address_family is None: raise RepoError('IPv6 not available on this system') BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
def debugcomplete(ui, cmd):
def debugcomplete(ui, cmd='', **opts):
def debugcomplete(ui, cmd): """returns the completion list associated with the given command""" clist = findpossible(cmd).keys() clist.sort() ui.write("%s\n" % " ".join(clist))
ui.write("%s\n" % " ".join(clist))
ui.write("%s\n" % "\n".join(clist))
def debugcomplete(ui, cmd): """returns the completion list associated with the given command""" clist = findpossible(cmd).keys() clist.sort() ui.write("%s\n" % " ".join(clist))
"debugcomplete": (debugcomplete, [], _('debugcomplete CMD')),
"debugcomplete": (debugcomplete, [('o', 'options', None, _('show the command options'))], _('debugcomplete [-o] CMD')),
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...
handler = httphandler()
handlers = [httphandler()]
def __init__(self, ui, path): self.path = path self.caps = None scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if query or frag: raise util.Abort(_('unsupported URL component: "%s"') % (query or frag)) if not urlpath: urlpath = '/' host, port, user, passwd = netlocsplit(netloc)
handler = urllib2.ProxyHandler({scheme: proxyurl})
handlers.append(urllib2.ProxyHandler({scheme: proxyurl}))
def __init__(self, ui, path): self.path = path self.caps = None scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if query or frag: raise util.Abort(_('unsupported URL component: "%s"') % (query or frag)) if not urlpath: urlpath = '/' host, port, user, passwd = netlocsplit(netloc)
opener = urllib2.build_opener( handler, urllib2.HTTPBasicAuthHandler(passmgr), urllib2.HTTPDigestAuthHandler(passmgr))
handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), urllib2.HTTPDigestAuthHandler(passmgr))) opener = urllib2.build_opener(*handlers)
def __init__(self, ui, path): self.path = path self.caps = None scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) if query or frag: raise util.Abort(_('unsupported URL component: "%s"') % (query or frag)) if not urlpath: urlpath = '/' host, port, user, passwd = netlocsplit(netloc)
if isinstance(data, file): data.seek(0) data = data.read() self.ui.debug(_("sending %d bytes\n") % len(data))
self.ui.debug(_("sending %s bytes\n") % headers.get('content-length', 'X'))
def do_cmd(self, cmd, **args): data = args.pop('data', None) headers = args.pop('headers', {}) self.ui.debug(_("sending %s command\n") % cmd) q = {"cmd": cmd} q.update(args) qs = '?%s' % urllib.urlencode(q) cu = "%s%s" % (self._url, qs) try: if data: if isinstance(data, file): # urllib2 needs string or buffer when usin...
if not ui.interactive:
if not self.ui.interactive:
def find_user_password(self, realm, authuri): authinfo = urllib2.HTTPPasswordMgr.find_user_password( self, realm, authuri) if authinfo != (None, None): return authinfo
class bzread: def __init__(self, f): self.zd = bz2.BZ2Decompressor() self.f = f self.buf = "" def read(self, l): while l > len(self.buf): r = self.f.read(4096) if r: self.buf += self.zd.decompress(r) else: break d, self.buf = self.buf[:l], self.buf[l:] return d repo.addchangegroup(bzread(f))
def bzgenerator(f): zd = bz2.BZ2Decompressor() for chunk in f: yield zd.decompress(chunk) yield zd.flush() bzgen = bzgenerator(util.filechunkiter(f, 4096)) repo.addchangegroup(util.chunkbuffer(bzgen))
def unbundle(ui, repo, fname): """apply a changegroup file""" f = urllib.urlopen(fname) if f.read(4) != "HG10": raise util.Abort("%s: not a Mercurial bundle file" % fname) class bzread: def __init__(self, f): self.zd = bz2.BZ2Decompressor() self.f = f self.buf = "" def read(self, l): while l > len(self.buf): r = self...
if not opts['no-update']:
if not opts['noupdate']:
def clone(ui, source, dest = None, **opts): """make a copy of an existing repository""" paths = {} for name, path in ui.configitems("paths"): paths[name] = path if source in paths: source = paths[source] created = success = False if dest is None: dest = os.getcwd() elif not os.path.exists(dest): os.mkdir(dest) creat...
"clone": (clone, [('U', 'no-update', None, 'skip update after cloning')],
"clone": (clone, [('U', 'noupdate', None, 'skip update after cloning')],
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
if not name.startswith(os.sep):
if not os.path.isabs(name):
def canonpath(root, cwd, myname): """return the canonical path of myname, given cwd and root""" if root == os.sep: rootsep = os.sep else: rootsep = root + os.sep name = myname if not name.startswith(os.sep): name = os.path.join(root, cwd, name) name = os.path.normpath(name) if name.startswith(rootsep): name = name[len(...
changes = repo.changelog.read(tip)
def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write("No patches applied\n") return 1 wlock = repo.wlock() self.check_toppatch(repo) (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(rep...
copies = [(f, repo.dirstate.copied(f)) for f in a]
copies = {} for dst in a: src = repo.dirstate.copied(dst) if src is None: continue copies.setdefault(src, []).append(dst)
def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write("No patches applied\n") return 1 wlock = repo.wlock() self.check_toppatch(repo) (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(rep...
for dst, src in copies: repo.dirstate.copy(src, dst)
if self.diffopts().git: for dst in aaa: f = repo.file(dst) src = f.renamed(man[dst]) if src: copies[src[0]] = copies.get(dst, []) if dst in a: copies[src[0]].append(dst) if dst in copies: del copies[dst] for src, dsts in copies.iteritems(): for dst in dsts: repo.dirstate.copy(src, dst)
def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write("No patches applied\n") return 1 wlock = repo.wlock() self.check_toppatch(repo) (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(rep...
Modified files have backup copies saved before revert. To disable backups, use --no-backup. To change the name of backup files, use --backup to give a format string.
Modified files are saved with a .orig suffix before reverting. To disable these backups, use --no-backup.
def revert(ui, repo, *pats, **opts): """revert modified files or dirs back to their unmodified states In its default mode, it reverts any uncommitted modifications made to the named files or directories. This restores the contents of the affected files to an unmodified state. Modified files have backup copies saved ...
def backup(name, exact): bakname = make_filename(repo, repo.changelog, opts['backup_name'] or '%p.orig', node=parent, pathname=name) if os.path.exists(name): if os.path.exists(bakname): if repo.wread(name) == repo.wread(bakname): return raise util.Abort(_('cannot save current version of %s - ' '%s exists and differs'...
def revert(ui, repo, *pats, **opts): """revert modified files or dirs back to their unmodified states In its default mode, it reverts any uncommitted modifications made to the named files or directories. This restores the contents of the affected files to an unmodified state. Modified files have backup copies saved ...
if dobackup and not opts['no_backup']: backup(rel, exact)
if dobackup and not opts['no_backup'] and os.path.exists(rel): bakname = "%s.orig" % rel ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) shutil.copyfile(rel, bakname) shutil.copymode(rel, bakname)
def handle(xlist, dobackup): xlist[0].append(abs) if dobackup and not opts['no_backup']: backup(rel, exact) if ui.verbose or not exact: ui.status(xlist[1] % rel)
('', 'backup-name', '', _('save backup with formatted 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...
incmatch = matchfn(map(patkind, inc), '(?:/|$)') or always excmatch = matchfn(map(patkind, exc), '(?:/|$)') or (lambda fn: False)
incmatch = always if inc: incmatch = matchfn(map(patkind, inc), '(?:/|$)') excmatch = lambda fn: False if exc: excmatch = matchfn(map(patkind, exc), '(?:/|$)')
def globprefix(pat): '''return the non-glob prefix of a path, e.g. foo/* -> foo''' root = [] for p in pat.split(os.sep): if patkind(p)[0] == 'glob': break root.append(p) return '/'.join(root)
r = runhook(hname, cmd) and r
if cmd.startswith('python:'): r = callhook(hname, cmd[7:].strip()) and r else: r = runhook(hname, cmd) and r
def runhook(name, cmd): self.ui.note(_("running hook %s: %s\n") % (name, cmd)) env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()] + [(k.upper(), v) for k, v in args.iteritems()]) r = util.system(cmd, environ=env, cwd=self.root) if r: desc, r = util.explain_exit(r) if throw: raise util.Abort(_('%s hook %s'...
def showmanifest(**args): args = args.copy() args.update(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0])) yield self.t('manifest', **args)
if self.ui.debugflag: def showmanifest(**args): args = args.copy() args.update(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0])) yield self.t('manifest', **args) else: showmanifest = ''
def showmanifest(**args): args = args.copy() args.update(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0])) yield self.t('manifest', **args)
if fc.path() != orig and fc.path() not in old: old[fc.path()] = 1
def findold(fctx): "find files that path was copied from, back to linkrev limit" old = {} orig = fctx.path() visit = [fctx] while visit: fc = visit.pop() if fc.rev() < limit: continue if fc.path() != orig and fc.path() not in old: old[fc.path()] = 1 visit += fc.parents()
try: os.unlink(repo.wjoin(f)) except: raise
try: os.unlink(repo.wjoin(f)) except OSError, e: if e.errno != errno.ENOENT: raise
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)
node = bin(node)
binnode = bin(node)
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
patchname = [t for t in repo.nodetags(node)
patchname = [t for t in repo.nodetags(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'): break desc.append(line) if not node: raise ValueError
node, idx, total)
binnode, idx, total)
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
patchname = commands.make_filename(repo, '%b.patch', node)
patchname = commands.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'): break desc.append(line) if not node: raise ValueError
return False
return 1
def recover(ui, repo): """roll back an interrupted transaction Recover from an interrupted commit or pull. This command tries to fix the repository status after an interrupted operation. It should only be necessary when Mercurial suggests it. """ if repo.recover(): return repo.verify() return False
def on_exception(exc, inst): u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) if "--traceback" in sys.argv[1:]: traceback.print_exc() sys.exit(0) if x[1]: try:
try: if x[1]:
def on_exception(exc, inst): u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) if "--traceback" in sys.argv[1:]: traceback.print_exc() sys.exit(0)
except Exception, inst: on_exception(Exception, inst) continue else: def importh(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod try:
else: def importh(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod
def on_exception(exc, inst): u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) if "--traceback" in sys.argv[1:]: traceback.print_exc() sys.exit(0)
except Exception, inst: on_exception(Exception, inst) continue external.append(mod)
external.append(mod) except Exception, inst: u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) if "--traceback" in sys.argv[1:]: traceback.print_exc() return 1 continue
def importh(name): mod = __import__(name) components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) return mod
help_(u, cmd, options['version']) sys.exit(0)
return help_(u, cmd, options['version'])
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]))
show_version(u) sys.exit(0)
return show_version(u)
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]))
help_(u, 'shortlist') sys.exit(0)
return help_(u, 'shortlist')
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]))
sys.exit(-1)
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]))
sys.exit(1)
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]))
except SystemExit: raise
except SystemExit, inst: return inst.code
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]))
sys.exit(-1)
return -1
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]))
if leftover: cur = leftover + data[off:off + s - len(leftover)] off += s - len(leftover) leftover = None else: cur = data[off:off + s] off += s
cur = data[off:off + s] off += s
def parseindex(self, fp, st): s = struct.calcsize(self.indexformat) self.index = [] self.nodemap = {nullid: -1} inline = self.inlinedata() n = 0 leftover = None while True: if st: data = fp.read(65536) else: # hack for httprangereader, it doesn't do partial reads well data = fp.read() if not data: break if n == 0 and ...
handle(remove, False)
if pmf is None: pmf = repo.manifest.read(repo.changelog.read(parent)[0]) if abs in pmf: handle(remove, False)
def handle(xlist, dobackup): xlist[0].append(abs) if dobackup and not opts['no_backup'] and os.path.exists(rel): bakname = "%s.orig" % rel ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) shutil.copyfile(rel, bakname) shutil.copymode(rel, bakname) if ui.verbose or not exact: ui.status(xlist[1] % rel)
files, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
cwd = repo.getcwd() if not pats and cwd: opts['include'] = [os.path.join(cwd, i) for i in opts['include']] opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']] files, matchfn, anypats = matchpats(repo, (pats and cwd) or '', pats, opts)
def log(ui, repo, *pats, **opts): """show revision history of entire repository or files""" # This code most commonly needs to iterate backwards over the # history it is interested in. This has awful (quadratic-looking) # performance, so we use iterators that walk forwards through # windows of revisions, yielding revi...
if not exact:
if ui.verbose or not exact:
def addremove(ui, repo, *pats, **opts): """add all new files, delete all missing files""" add, remove = [], [] for src, abs, rel, exact in walk(repo, pats, opts): if src == 'f' and repo.dirstate.state(abs) == '?': add.append(abs) if not exact: ui.status('adding ', rel, '\n') if repo.dirstate.state(abs) != 'r' and not o...
if not exact:
if ui.verbose or not exact:
def forget(ui, repo, *pats, **opts): """don't add the specified files on the next commit""" forget = [] for src, abs, rel, exact in walk(repo, pats, opts): if repo.dirstate.state(abs) == 'a': forget.append(abs) if not exact: ui.status('forgetting ', rel, '\n') repo.forget(forget)
if reason and exact: ui.warn('not removing %s: file %s\n' % (rel, reason))
if reason: if exact: ui.warn('not removing %s: file %s\n' % (rel, reason))
def okaytoremove(abs, rel, exact): c, a, d, u = repo.changes(files = [abs]) reason = None if c: reason = 'is modified' elif a: reason = 'has been marked for add' elif u: reason = 'is not managed' if reason and exact: ui.warn('not removing %s: file %s\n' % (rel, reason)) else: return True
_tz = util.makedate()[1]
def read(f): return repo.file(f).read(mmap2[f])
_f = repo.wopener(f)
return util.datestr((os.lstat(repo.wjoin(f)).st_mtime, tz))
def date2(f): try: _f = repo.wopener(f) except IOError, err: if err[0] != errno.ENOENT: raise return _date2 return util.datestr((os.fstat(_f.fileno())[stat.ST_MTIME], _tz))
if err[0] != errno.ENOENT: raise
if err.errno != errno.ENOENT: raise
def date2(f): try: _f = repo.wopener(f) except IOError, err: if err[0] != errno.ENOENT: raise return _date2 return util.datestr((os.fstat(_f.fileno())[stat.ST_MTIME], _tz))
return util.datestr((os.fstat(_f.fileno())[stat.ST_MTIME], _tz))
def date2(f): try: _f = repo.wopener(f) except IOError, err: if err[0] != errno.ENOENT: raise return _date2 return util.datestr((os.fstat(_f.fileno())[stat.ST_MTIME], _tz))
if not val and val != 0:
if not val and val != 0 and defval is not None:
def revfix(repo, val, defval): if not val and val != 0: val = defval return repo.lookup(val)
def qseries(self, repo, missing=None):
def qseries(self, repo, missing=None, summary=False):
def qseries(self, repo, missing=None): start = self.series_end() if not missing: for p in self.series[:start]: if self.ui.verbose: self.ui.write("%d A " % self.series.index(p)) self.ui.write("%s\n" % p) for p in self.series[start:]: if self.ui.verbose: self.ui.write("%d U " % self.series.index(p)) self.ui.write("%s\n" ...
for p in self.series[:start]:
for i in range(len(self.series)): patch = self.series[i]
def qseries(self, repo, missing=None): start = self.series_end() if not missing: for p in self.series[:start]: if self.ui.verbose: self.ui.write("%d A " % self.series.index(p)) self.ui.write("%s\n" % p) for p in self.series[start:]: if self.ui.verbose: self.ui.write("%d U " % self.series.index(p)) self.ui.write("%s\n" ...
self.ui.write("%d A " % self.series.index(p)) self.ui.write("%s\n" % p) for p in self.series[start:]: if self.ui.verbose: self.ui.write("%d U " % self.series.index(p)) self.ui.write("%s\n" % p)
if i < start: status = 'A' else: status = 'U' self.ui.write('%d %s ' % (i, status)) if summary: msg = self.readheaders(patch)[0] msg = msg and ': ' + msg[0] or ': ' else: msg = '' self.ui.write('%s%s\n' % (patch, msg))
def qseries(self, repo, missing=None): start = self.series_end() if not missing: for p in self.series[:start]: if self.ui.verbose: self.ui.write("%d A " % self.series.index(p)) self.ui.write("%s\n" % p) for p in self.series[start:]: if self.ui.verbose: self.ui.write("%d U " % self.series.index(p)) self.ui.write("%s\n" ...
repo.mq.qseries(repo, missing=opts['missing'])
repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary'])
def series(ui, repo, **opts): """print the entire series file""" repo.mq.qseries(repo, missing=opts['missing']) return 0
[('m', 'missing', None, 'print patches not in series')],
[('m', 'missing', None, 'print patches not in series'), ('s', 'summary', None, _('print first line of patch header'))],
def tags(self): if self.tagscache: return self.tagscache
self.lock()
lock = self.lock()
def recover(self): self.lock() if os.path.exists(self.join("recover")): self.ui.status("attempting to rollback interrupted transaction\n") return rollback(self.opener, self.join("recover")) else: self.ui.warn("no interrupted transaction available\n")
self.lock()
lock = self.lock()
def undo(self): self.lock() if os.path.exists(self.join("undo")): f = self.changelog.read(self.changelog.tip())[3] self.ui.status("attempting to rollback last transaction\n") rollback(self.opener, self.join("undo")) self.manifest = manifest(self.opener) self.changelog = changelog(self.opener)
self.lock()
def revmap(x): return self.changelog.rev(x)
for x in types.split(','):
for x in types:
def unbundle(self, cg, heads, source): # have to stream bundle to a temp file because we do not have # http 1.1 chunked transfer.
def traverse(): for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror))
files.sort() for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) continue if stat.S_ISDIR(st.st_mode): sorted = [ x for x in findfiles(f) ] sorted.sort() for fl in sorted: yi...
def traverse(): for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) continue if stat.S_ISDIR(st.st_mode): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] nd ...
if stat.S_ISDIR(st.st_mode): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] nd = util.normpath(d) if nd == '.': nd = '' if seen(nd): subdirs[:] = [] continue for sd in subdirs: ds = os.path.join(nd, sd +'/') if self.ignore(ds) or not match(ds): subdirs.remove(sd) subdirs.sort() fl.sort() for fn in fl:...
found = False self.blockignore = True if statmatch(ff, st): found = True self.blockignore = False if found:
def traverse(): for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) continue if stat.S_ISDIR(st.st_mode): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] nd ...
else: kind = 'unknown' if stat.S_ISCHR(st.st_mode): kind = 'character device' elif stat.S_ISBLK(st.st_mode): kind = 'block device' elif stat.S_ISFIFO(st.st_mode): kind = 'fifo' elif stat.S_ISLNK(st.st_mode): kind = 'symbolic link' elif stat.S_ISSOCK(st.st_mode): kind = 'socket' self.ui.warn('%s: unsupported file type (...
else: kind = 'unknown' if stat.S_ISCHR(st.st_mode): kind = 'character device' elif stat.S_ISBLK(st.st_mode): kind = 'block device' elif stat.S_ISFIFO(st.st_mode): kind = 'fifo' elif stat.S_ISLNK(st.st_mode): kind = 'symbolic link' elif stat.S_ISSOCK(st.st_mode): kind = 'socket' self.ui.warn('%s: unsupported file type (...
def traverse(): for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) continue if stat.S_ISDIR(st.st_mode): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] nd ...
for src, fn in util.unique(traverse()): fn = util.normpath(fn) if seen(fn): continue if fn not in dc and self.ignore(fn): continue if match(fn): yield src, fn
def traverse(): for ff in util.unique(files): f = os.path.join(self.root, ff) try: st = os.stat(f) except OSError, inst: if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) continue if stat.S_ISDIR(st.st_mode): for dir, subdirs, fl in os.walk(f): d = dir[len(self.root) + 1:] nd ...
for src, fn in self.walk(files, match, dc=dc): try: s = os.stat(os.path.join(self.root, fn)) except OSError: continue
def statmatch(fn, s): def checkappend(l, fn): if match is util.always or match(fn): l.append(fn) if not s or stat.S_ISDIR(s.st_mode): return self.ignore(fn) and False or match(fn)
def changes(self, files=None, match=util.always): self.read() if not files: dc = self.map.copy() else: dc = self.filterfiles(files) lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
continue c = dc.get(fn)
return False c = dc.pop(fn, None)
def changes(self, files=None, match=util.always): self.read() if not files: dc = self.map.copy() else: dc = self.filterfiles(files) lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
del dc[fn] if c[0] == 'm': modified.append(fn) elif c[0] == 'a': added.append(fn) elif c[0] == 'r':
type, mode, size, time = c if type == 'n': if size != s.st_size or (mode ^ s.st_mode) & 0100: checkappend(modified, fn) elif time != s.st_mtime: checkappend(lookup, fn) elif type == 'm': checkappend(modified, fn) elif type == 'a': checkappend(added, fn) elif type == 'r': checkappend(unknown, fn) else: if not self.igno...
def changes(self, files=None, match=util.always): self.read() if not files: dc = self.map.copy() else: dc = self.filterfiles(files) lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
elif c[2] != s.st_size or (c[1] ^ s.st_mode) & 0100: modified.append(fn) elif c[3] != s.st_mtime: lookup.append(fn) else: unknown.append(fn)
return False for src, fn in self.walkhelper(files, statmatch, dc): pass
def changes(self, files=None, match=util.always): self.read() if not files: dc = self.map.copy() else: dc = self.filterfiles(files) lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
self.path = os.path.join(repo.join(""), "bisect")
self.path = repo.join("bisect") self.opener = util.opener(self.path)
def __init__(self, ui, repo): self.repo = repo self.path = os.path.join(repo.join(""), "bisect") self.ui = ui self.goodrevs = [] self.badrev = None self.good_dirty = 0 self.bad_dirty = 0 self.good_path = os.path.join(self.path, "good") self.bad_path = os.path.join(self.path, "bad")
self.good_path = os.path.join(self.path, "good") self.bad_path = os.path.join(self.path, "bad") s = self.good_path if os.path.exists(s): self.goodrevs = self.repo.opener(s).read().splitlines()
self.good_path = "good" self.bad_path = "bad" if os.path.exists(os.path.join(self.path, self.good_path)): self.goodrevs = self.opener(self.good_path).read().splitlines()
def __init__(self, ui, repo): self.repo = repo self.path = os.path.join(repo.join(""), "bisect") self.ui = ui self.goodrevs = [] self.badrev = None self.good_dirty = 0 self.bad_dirty = 0 self.good_path = os.path.join(self.path, "good") self.bad_path = os.path.join(self.path, "bad")
s = self.bad_path if os.path.exists(s): r = self.repo.opener(s).read().splitlines()
if os.path.exists(os.path.join(self.path, self.bad_path)): r = self.opener(self.bad_path).read().splitlines()
def __init__(self, ui, repo): self.repo = repo self.path = os.path.join(repo.join(""), "bisect") self.ui = ui self.goodrevs = [] self.badrev = None self.good_dirty = 0 self.bad_dirty = 0 self.good_path = os.path.join(self.path, "good") self.bad_path = os.path.join(self.path, "bad")
f = self.repo.opener(self.good_path, "w")
f = self.opener(self.good_path, "w")
def __del__(self): if not os.path.isdir(self.path): return f = self.repo.opener(self.good_path, "w") f.write("\n".join([hg.hex(r) for r in self.goodrevs])) if len(self.goodrevs) > 0: f.write("\n") f = self.repo.opener(self.bad_path, "w") if self.badrev: f.write(hg.hex(self.badrev) + "\n")
f = self.repo.opener(self.bad_path, "w")
f = self.opener(self.bad_path, "w")
def __del__(self): if not os.path.isdir(self.path): return f = self.repo.opener(self.good_path, "w") f.write("\n".join([hg.hex(r) for r in self.goodrevs])) if len(self.goodrevs) > 0: f.write("\n") f = self.repo.opener(self.bad_path, "w") if self.badrev: f.write(hg.hex(self.badrev) + "\n")
sl = [self.bad_path, self.good_path]
sl = [os.path.join(self.path, p) for p in [self.bad_path, self.good_path]]
def reset(self): """finish a bisection""" if os.path.isdir(self.path): sl = [self.bad_path, self.good_path] for s in sl: if os.path.exists(s): os.unlink(s) os.rmdir(self.path) # Not sure about this #self.ui.write("Going back to tip\n") #self.repo.update(self.repo.changelog.tip()) return 1
if virtual:
if virtual[1:]:
def run(self): try: virtual = os.environ["PATH_INFO"] except: virtual = ""
url = os.environ["REQUEST_URI"] + "/" + v,
url = url,
def get(sec, val, default): try: return cp2.get(sec, val) except: return default
query = "" p = self.path.find("?") if p: query = self.path[p + 1:] query = query.replace('+', ' ')
path_info, query = splitURI(self.path)
def do_hgweb(self): query = "" p = self.path.find("?") if p: query = self.path[p + 1:] query = query.replace('+', ' ')
hgwebobj = hgwebdir(hgwebdir_conf)
hgwebobj = hgwebdir(webdir_conf)
def do_hgweb(self): query = "" p = self.path.find("?") if p: query = self.path[p + 1:] query = query.replace('+', ' ')
yield {"label": "(0)", "node": hex(nodefunc(0).node())} for label, node in l: yield {"label": label, "node": node} yield {"label": "tip", "node": hex(nodefunc('-1').node())}
try: yield {"label": "(0)", "node": hex(nodefunc('0').node())} for label, node in l: yield {"label": label, "node": node} yield {"label": "tip", "node": hex(nodefunc('-1').node())} except hg.RepoError: pass
def nav(**map): l = [] last = 0 for f in seq(1, pagelen): if f < pagelen or f <= last: continue if f > limit: break last = f if pos + f < limit: l.append(("+%d" % f, hex(nodefunc(pos + f).node()))) if pos - f >= 0: l.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
If no revision is given then working dir parent is used, or tip if no revision is checked out.
If no revision is given, the parent of the working directory is used, or tip if no revision is checked out.
def cat(ui, repo, file1, *pats, **opts): """output the current or given revision 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...
If no revision is given then working dir parent is used, or tip if no revision is checked out.
If no revision is given, the parent of the working directory is used, or tip if no revision is checked out.
def manifest(ui, repo, rev=None): """output the current or given revision of the project manifest Print a list of version controlled files for the given revision. If no revision is given then working dir parent is used, or tip if no revision is checked out. The manifest is the list of files being version controlled. ...
"""add a tag for the current tip or a given revision
"""add a tag for the current or given revision
def tag(ui, repo, name, rev_=None, **opts): """add a tag for the current tip or a given revision Name a particular revision using <name>. Tags are used to name particular revisions of the repository and are very useful to compare different revision, to go back to significant earlier versions or to mark branch points ...
If no revision is given, the parent of the working directory is used.
If no revision is given, the parent of the working directory is used, or tip if no revision is checked out.
def tag(ui, repo, name, rev_=None, **opts): """add a tag for the current tip or a given revision Name a particular revision using <name>. Tags are used to name particular revisions of the repository and are very useful to compare different revision, to go back to significant earlier versions or to mark branch points ...
win_reserved = [ord(x) for x in '|\?*<":>+[]']
win_reserved = [ord(x) for x in '\\:*?"<>|']
def _buildencodefun(): e = '_' win_reserved = [ord(x) for x in '|\?*<":>+[]'] cmap = dict([ (chr(x), chr(x)) for x in xrange(127) ]) for x in (range(32) + range(126, 256) + win_reserved): cmap[chr(x)] = "~%02x" % x for x in range(ord("A"), ord("Z")+1) + [ord(e)]: cmap[chr(x)] = e + chr(x).lower() dmap = {} for k, v in ...
copies=None, **props):
copies=[], **props):
def show(self, rev=0, changenode=None, brinfo=None, changes=None, copies=None, **props): '''show a single changeset or file revision''' log = self.repo.changelog if changenode is None: changenode = log.node(rev) elif not rev: rev = log.rev(changenode) if changes is None: changes = log.read(changenode)
os.environ["HGRCPATH"] = ""
def run_one(test): '''tristate output: None -> skipped True -> passed False -> failed''' vlog("# Test", test) if not verbose: sys.stdout.write('.') sys.stdout.flush() err = os.path.join(TESTDIR, test+".err") ref = os.path.join(TESTDIR, test+".out") if os.path.exists(err): os.remove(err) # Remove any previous o...