rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
qs = urllib.urlencode(q) cu = "%s?%s" % (self._url, qs)
qs = '?%s' % urllib.urlencode(q) cu = "%s%s" % (self._url, qs)
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 = urllib.urlencode(q) cu = "%s?%s" % (self._url, qs) try: resp = urllib2.urlopen(urllib2.Request(cu, data, headers)) except urllib2.HTTPError, ...
parents = [p for p in parents if p != nullrev] if len(parents) == 1 and parents[0] == rev-1: parents = []
if parents[1] == nullrev: if parents[0] >= rev - 1: parents = [] else: parents = [parents[0]]
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)
r = revlog.revlog(file, index, "")
r = revlog.revlog(util.opener(os.getcwd()), index, "")
def debugancestor(ui, index, rev1, rev2): """find the ancestor revision of two revisions in a given index""" r = revlog.revlog(file, index, "") a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) ui.write("%d:%s\n" % (r.rev(a), hex(a)))
r = revlog.revlog(file, file_[:-2] + ".i", file_)
r = revlog.revlog(util.opener(os.getcwd()), file_[:-2] + ".i", file_)
def debugdata(ui, file_, rev): """dump the contents of an data file revision""" r = revlog.revlog(file, file_[:-2] + ".i", file_) try: ui.write(r.revision(r.lookup(rev))) except KeyError: raise util.Abort(_('invalid revision identifier %s'), rev)
r = revlog.revlog(file, file_, "")
r = revlog.revlog(util.opener(os.getcwd()), file_, "")
def debugindex(ui, file_): """dump the contents of an index file""" r = revlog.revlog(file, file_, "") ui.write(" rev offset length base linkrev" + " nodeid p1 p2\n") for i in range(r.count()): e = r.index[i] ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( i, e[0], e[1], e[2], e[3], short(e[6...
r = revlog.revlog(file, file_, "")
r = revlog.revlog(util.opener(os.getcwd()), file_, "")
def debugindexdot(ui, file_): """dump an index DAG as a .dot file""" r = revlog.revlog(file, file_, "") ui.write("digraph G {\n") for i in range(r.count()): e = r.index[i] ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) if e[5] != nullid: ui.write("\t%d -> %d\n" % (r.rev(e[5]), i)) ui.write("}\n")
if str(rev) != id: raise "mismatch"
if str(rev) != id: raise ValueError if rev < 0: rev = self.count() + rev if rev < 0 or rev >= self.count: raise ValueError
def lookup(self, id): try: rev = int(id) if str(rev) != id: raise "mismatch" return self.node(rev) except: c = [] for n in self.nodemap: if id in hex(n): c.append(n) if len(c) > 1: raise KeyError("Ambiguous identifier") if len(c) < 1: raise KeyError("No match found") return c[0] return None
except:
except (ValueError, OverflowError):
def lookup(self, id): try: rev = int(id) if str(rev) != id: raise "mismatch" return self.node(rev) except: c = [] for n in self.nodemap: if id in hex(n): c.append(n) if len(c) > 1: raise KeyError("Ambiguous identifier") if len(c) < 1: raise KeyError("No match found") return c[0] return None
if id in hex(n):
if hex(n).startswith(id):
def lookup(self, id): try: rev = int(id) if str(rev) != id: raise "mismatch" return self.node(rev) except: c = [] for n in self.nodemap: if id in hex(n): c.append(n) if len(c) > 1: raise KeyError("Ambiguous identifier") if len(c) < 1: raise KeyError("No match found") return c[0] return None
diff = list(set(states).symmetric_difference(set(prevstates)))
diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates)))
def display(fn, rev, states, prevstates): diff = list(set(states).symmetric_difference(set(prevstates))) diff.sort(lambda x, y: cmp(x.linenum, y.linenum)) for l in diff: if incrementing: change = ((l in prevstates) and '-') or '+' r = rev else: change = ((l in states) and '-') or '+' r = prev[fn] ui.write('%s:%s:%s:%s%...
self.status("mering %f\n" % f)
self.ui.status("merging %s\n" % f)
def update(self, node): pl = self.dirstate.parents() if pl[1] != nullid: self.ui.warn("aborting: outstanding uncommitted merges\n") return
errmsg = '%s %s' % (os.path.basename(cmd.split(None, 1)[0]),
errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
def py2shell(val): 'convert python object into string that is useful to shell' if val in (None, False): return '0' if val == True: return '1' return str(val)
return None
def qparents(self, repo, rev=None): if rev is None: (p1, p2) = repo.dirstate.parents() if p2 == revlog.nullid: return p1 if len(self.applied) == 0: return None (top, patch) = self.applied[-1].split(':') top = revlog.bin(top) return top pp = repo.changelog.parents(rev) if pp[1] != revlog.nullid: arevs = [ x.split(':')[0...
root = req.env.get('REQUEST_URI', '').split('?', 1)[0] pi = req.env.get('PATH_INFO', '')
def normurl(url): inner = '/'.join([x for x in url.split('/') if x]) tl = len(url) > 1 and url.endswith('/') and '/' or '' return '%s%s%s' % (url.startswith('/') and '/' or '', inner, tl) root = normurl(req.env.get('REQUEST_URI', '').split('?', 1)[0]) pi = normurl(req.env.get('PATH_INFO', ''))
def firstitem(query): return query.split('&', 1)[0].split(';', 1)[0]
root = root[:-len(pi)] if req.env.has_key('REPO_NAME'): base = '/' + req.env['REPO_NAME']
pi = pi[1:] if pi: root = root[:-len(pi)] if req.env.has_key('REPO_NAME'): rn = req.env['REPO_NAME'] + '/' root += rn query = pi[len(rn):] else: query = pi
def firstitem(query): return query.split('&', 1)[0].split(';', 1)[0]
base = root if pi: while pi.startswith('//'): pi = pi[1:] if pi.startswith(base): if len(pi) > len(base): base += '/' query = pi[len(base):] else: if req.env.has_key('REPO_NAME'): base += '/' else: base += '?' query = firstitem(req.env['QUERY_STRING']) else: base += '/' query = pi[1:] else: base += '?'
root += '?'
def firstitem(query): return query.split('&', 1)[0].split(';', 1)[0]
return (root + base, query)
return (root, query)
def firstitem(query): return query.split('&', 1)[0].split(';', 1)[0]
node=hex(n),
node=hex(fctx.node()),
def annotate(**map): parity = 0 last = None for f, l in fctx.annotate(follow=True): fnode = f.filenode() name = self.repo.ui.shortuser(f.user())
f = os.popen("patch -p1 --no-backup-if-mismatch < '%s'" % (pf))
pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') f = os.popen("%s -p1 --no-backup-if-mismatch < '%s'" % (pp, pf))
def apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, wlock=None): # TODO unify with commands.py if not patchdir: patchdir = self.path pwd = os.getcwd() os.chdir(repo.root) err = 0 if not wlock: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction() n = None for...
ui.write("%c %s\n" % (dc[file_][0], file_))
ui.write("%c %3o %10d %s %s\n" % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2], time.strftime("%x %X", time.localtime(dc[file_][3])), file_))
def debugstate(ui, repo): """show the contents of the current dirstate""" repo.dirstate.read() dc = repo.dirstate.map keys = dc.keys() keys.sort() for file_ in keys: ui.write("%c %s\n" % (dc[file_][0], file_))
patch = pname(i)
def pname(i): if status == 'A': return self.applied[i].name else: return self.series[i]
files, self.ignorefunc, anypats = util.matcher(self.root, inc=self.hgignore())
ignore = self.hgignore() if ignore: files, self.ignorefunc, anypats = util.matcher(self.root, inc=ignore) else: self.ignorefunc = util.never
def ignore(self, fn): '''default match function used by dirstate and localrepository. this honours the .hgignore file, and nothing more.''' if self.blockignore: return False if not self.ignorefunc: files, self.ignorefunc, anypats = util.matcher(self.root, inc=self.hgignore()) return self.ignorefunc(fn)
"""add all new files, delete all missing files (DEPRECATED)
"""add all new files, delete all missing files
def addremove(ui, repo, *pats, **opts): """add all new files, delete all missing files (DEPRECATED) Add all new files and remove all missing files from the repository. New files are ignored if they match any of the patterns in .hgignore. As with add, these changes take effect at the next commit. Use the -s option to...
_('guess renamed files by similarity (0<=s<=1)'))],
_('guess renamed files by similarity (0<=s<=100)'))],
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...
self.quiet = self.configbool("ui", "quiet") self.verbose = self.configbool("ui", "verbose") self.debugflag = self.configbool("ui", "debug") self.interactive = self.configbool("ui", "interactive", True) self.traceback = traceback
def __init__(self, verbose=False, debug=False, quiet=False, interactive=True, traceback=False, parentui=None): self.overlay = None self.header = [] self.prev_header = [] if parentui is None: # this is the parent of all ui children self.parentui = None self.readhooks = [] self.cdata = ConfigParser.SafeConfigParser() sel...
self.quiet = self.quiet or quiet self.verbose = self.verbose or verbose self.debugflag = self.debugflag or debug self.verbosity_constraints(quiet, verbose, debug) self.interactive = (self.interactive and interactive) self.traceback = self.traceback or traceback
def updateopts(self, verbose=False, debug=False, quiet=False, interactive=True, traceback=False, config=[]): self.quiet = self.quiet or quiet self.verbose = self.verbose or verbose self.debugflag = self.debugflag or debug
def verbosity_constraints(self, quiet, verbose, debug):
if quiet or verbose or debug: self.setconfig('ui', 'quiet', str(bool(quiet))) self.setconfig('ui', 'verbose', str(bool(verbose))) self.setconfig('ui', 'debug', str(bool(debug))) self.verbosity_constraints() if not interactive: self.setconfig('ui', 'interactive', 'False') self.interactive = False self.traceback = sel...
def verbosity_constraints(self, quiet, verbose, debug): if self.debugflag: self.verbose = True self.quiet = False elif self.verbose and self.quiet: if quiet and not verbose: self.verbose = False elif not quiet and verbose: self.quiet = False else: self.quiet = self.verbose = False
if quiet and not verbose: self.verbose = False elif not quiet and verbose: self.quiet = False else: self.quiet = self.verbose = False
self.quiet = self.verbose = False
def verbosity_constraints(self, quiet, verbose, debug): if self.debugflag: self.verbose = True self.quiet = False elif self.verbose and self.quiet: if quiet and not verbose: self.verbose = False elif not quiet and verbose: self.quiet = False else: self.quiet = self.verbose = False
pmf = None
def revert(ui, repo, *pats, **opts): """revert files or dirs to their states as of some revision With no revision specified, revert the named files or directories to the contents they had in the parent of the working directory. This restores the contents of the affected files to an unmodified state. If the working di...
changes = repo.changes(node, match=names.has_key, wlock=wlock)
changes = repo.changes(match=names.has_key, wlock=wlock)
def revert(ui, repo, *pats, **opts): """revert files or dirs to their states as of some revision With no revision specified, revert the named files or directories to the contents they had in the parent of the working directory. This restores the contents of the affected files to an unmodified state. If the working di...
in_mf = abs in mf
mfentry = mf.get(abs)
def revert(ui, repo, *pats, **opts): """revert files or dirs to their states as of some revision With no revision specified, revert the named files or directories to the contents they had in the parent of the working directory. This restores the contents of the affected files to an unmodified state. If the working di...
if in_mf:
if mfentry:
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)
if not in_mf: if pmf is None: pmf = repo.manifest.read(repo.changelog.read(parent)[0]) if abs in pmf:
if pmf is None: pmf = repo.manifest.read(repo.changelog.read(parent)[0]) if abs in pmf: if mfentry: if pmf[abs] != mfentry: handle(revert, False) else:
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)
update[abs] = True
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)
raise util.Abort(_('outstanding uncommited merges'))
raise util.Abort(_('outstanding uncommitted merges'))
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 ...
paths = {} for name, path in ui.configitems("paths"): paths[name] = path if source in paths: source = paths[source] link = 0 if not source.startswith("http://"): d1 = os.stat(os.getcwd()).st_dev d2 = os.stat(source).st_dev if d1 == d2: link = 1 if link: ui.debug("copying by hardlink\n") os.system("cp -al %s/.hg .hg"...
ui.warn("this use of init is deprecated: use \"hg clone\" instead\n") opts['no-update'] = not opts['update'] clone(ui, source, None, **opts)
def init(ui, source=None, **opts): """create a new repository or copy an existing one""" if source: paths = {} for name, path in ui.configitems("paths"): paths[name] = path if source in paths: source = paths[source] link = 0 if not source.startswith("http://"): d1 = os.stat(os.getcwd()).st_dev d2 = os.stat(source).s...
norepo = "init version help debugindex debugindexdot"
norepo = "clone init version help debugindex debugindexdot"
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
filelog = repo.file(relpath(repo, [f])[0])
files = relpath(repo, [f]) filelog = repo.file(files[0])
def log(ui, repo, f=None, **opts): """show the revision history of the repository or a single file""" if f: filelog = repo.file(relpath(repo, [f])[0]) log = filelog lookup = filelog.lookup else: filelog = None log = repo.changelog lookup = repo.lookup revlist = [] revs = [log.rev(lookup(rev)) for rev in opts['rev']] wh...
[('r', 'rev', [], 'revision')], 'hg log [-r A] [-r B] [file]'),
[('r', 'rev', [], 'revision'), ('p', 'patch', None, 'show patch')], 'hg log [-r A] [-r B] [-p] [file]'),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
fp=None, changes=None, opts=None): patch.diff(repo, node1, node2, files,
fp=None, changes=None, opts={}): fns, matchfn, anypats = cmdutil.matchpats(repo, files, opts) patch.diff(repo, node1, node2, fns, match=matchfn,
def printdiff(self, repo, node1, node2=None, files=None, fp=None, changes=None, opts=None): patch.diff(repo, node1, node2, files, fp=fp, changes=changes, opts=self.diffopts())
def diff(self, repo, files):
def diff(self, repo, pats, opts):
def diff(self, repo, files): top = self.check_toppatch(repo) if not top: self.ui.write("No patches applied\n") return qp = self.qparents(repo, top) self.printdiff(repo, qp, files=files)
self.printdiff(repo, qp, files=files)
self.printdiff(repo, qp, files=pats, opts=opts)
def diff(self, repo, files): top = self.check_toppatch(repo) if not top: self.ui.write("No patches applied\n") return qp = self.qparents(repo, top) self.printdiff(repo, qp, files=files)
def diff(ui, repo, *files, **opts):
def diff(ui, repo, *pats, **opts):
def diff(ui, repo, *files, **opts): """diff of the current patch""" # deep in the dirstate code, the walkhelper method wants a list, not a tuple repo.mq.diff(repo, list(files)) return 0
repo.mq.diff(repo, list(files))
repo.mq.diff(repo, pats, opts)
def diff(ui, repo, *files, **opts): """diff of the current patch""" # deep in the dirstate code, the walkhelper method wants a list, not a tuple repo.mq.diff(repo, list(files)) return 0
"^qdiff": (diff, [], 'hg qdiff [FILE]...'),
"^qdiff": (diff, [('I', 'include', [], _('include names matching the given patterns')), ('X', 'exclude', [], _('exclude names matching the given patterns'))], 'hg qdiff [-I] [-X] [FILE]...'),
def tags(self): if self.tagscache: return self.tagscache
raise RevlogError(_("unknown parent %s") % short(p1))
raise RevlogError(_("unknown parent %s") % short(p))
def addgroup(self, revs, linkmapper, transaction, unique=0): """ add a delta group
transaction.add(self.indexfile, (n + 1) * len(entry))
transaction.add(self.indexfile, n * len(entry))
def addrevision(self, text, transaction, link, p1=None, p2=None): if text is None: text = "" if p1 is None: p1 = self.tip() if p2 is None: p2 = nullid
msg = MIMEText(body)
msg = email.MIMEText.MIMEText(body)
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
msg = MIMEMultipart()
msg = email.MIMEMultipart.MIMEMultipart()
def close(self): self.container.append(''.join(self.lines).split('\n')) self.lines = []
msg.attach(MIMEText('\n'.join(body) + '\n'))
msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n'))
def getaddrs(opt, prpt, default = None): addrs = opts[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(MIMEText(d))
if d: msg.attach(email.MIMEText.MIMEText(d))
def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()]
sender_addr = parseaddr(sender)[1]
sender_addr = email.Utils.parseaddr(sender)[1]
def getaddrs(opt, prpt, default = None): addrs = opts[opt] or (ui.config('patchbomb', opt) or prompt(prpt, default = default)).split(',') return [a.strip() for a in addrs if a.strip()]
yield self.t("naventry", rev = count - 1, label="tip")
yield self.t("naventry", label="tip")
def seq(factor = 1): yield 1 * factor yield 3 * factor #yield 5 * factor for f in seq(factor * 10): yield f
fp = os.popen('patch -p%d < "%s"' % (strip, patchname))
patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') 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""" fp = os.popen('patch -p%d < "%s"' % (strip, patchname)) files = {} for line in fp: line = line.rstrip() ui.status("%s\n" % line) if line.startswith('patching file '): pf = parse_patch_output(...
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: return defval return repo.changelog.rev(repo.lookup(val))
def diffopts(ui, opts={}):
def diffopts(ui, opts={}, untrusted=False): def get(key, name=None): return (opts.get(key) or ui.configbool('diff', name or key, None, untrusted=untrusted))
def diffopts(ui, opts={}): return mdiff.diffopts( text=opts.get('text'), git=(opts.get('git') or ui.configbool('diff', 'git', None)), nodates=(opts.get('nodates') or ui.configbool('diff', 'nodates', None)), showfunc=(opts.get('show_function') or ui.configbool('diff', 'showfunc', None)), ignorews=(opts.get('ignore_all_s...
git=(opts.get('git') or ui.configbool('diff', 'git', None)), nodates=(opts.get('nodates') or ui.configbool('diff', 'nodates', None)), showfunc=(opts.get('show_function') or ui.configbool('diff', 'showfunc', None)), ignorews=(opts.get('ignore_all_space') or ui.configbool('diff', 'ignorews', None)), ignorewsamount=(opts....
git=get('git'), nodates=get('nodates'), showfunc=get('show_function', 'showfunc'), ignorews=get('ignore_all_space', 'ignorews'), ignorewsamount=get('ignore_space_change', 'ignorewsamount'), ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'))
def diffopts(ui, opts={}): return mdiff.diffopts( text=opts.get('text'), git=(opts.get('git') or ui.configbool('diff', 'git', None)), nodates=(opts.get('nodates') or ui.configbool('diff', 'nodates', None)), showfunc=(opts.get('show_function') or ui.configbool('diff', 'showfunc', None)), ignorews=(opts.get('ignore_all_s...
if rev < 0 or rev >= self.count: raise ValueError
if rev < 0 or rev >= self.count(): raise ValueError
def lookup(self, id): try: rev = int(id) if str(rev) != id: raise ValueError if rev < 0: rev = self.count() + rev if rev < 0 or rev >= self.count: raise ValueError return self.node(rev) except (ValueError, OverflowError): c = [] for n in self.nodemap: if hex(n).startswith(id): c.append(n) if len(c) > 1: raise KeyError(...
seen[n[0]] = 1
def getchangegroup(self, remote): m = self.changelog.nodemap search = [] fetch = [] seen = {} seenbranch = {}
if n[1] in seenbranch:
if n in seenbranch:
def getchangegroup(self, remote): m = self.changelog.nodemap search = [] fetch = [] seen = {} seenbranch = {}
seenbranch[n[1]] = 1
seenbranch[n] = 1
def getchangegroup(self, remote): m = self.changelog.nodemap search = [] fetch = [] seen = {} seenbranch = {}
for i in l + [n[1]]:
for i in l: self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
def getchangegroup(self, remote): m = self.changelog.nodemap search = [] fetch = [] seen = {} seenbranch = {}
address_family = socket.AF_INET6
address_family = getattr(socket, 'AF_INET6', None) 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 create_server(path, name, templates, address, port, use_ipv6 = False, accesslog = sys.stdout, errorlog = sys.stderr): import BaseHTTPServer class IPv6HTTPServer(BaseHTTPServer.HTTPServer): address_family = socket.AF_INET6 class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler): def log_error(self, format, *arg...
repo.lookup(0) i = repo.tags.items() n = [] for e in i: try: l = repo.changelog.rev(e[1]) except KeyError: l = -2 n.append((l, e))
n = tags_load(repo)
def tags(ui, repo): """list repository tags""" repo.lookup(0) # prime the cache i = repo.tags.items() n = [] for e in i: try: l = repo.changelog.rev(e[1]) except KeyError: l = -2 n.append((l, e)) n.sort() n.reverse() i = [ e[1] for e in n ] for k, n in i: try: r = repo.changelog.rev(n) except KeyError: r = "?" print "...
yield {"label": "tip", "rev": ""}
yield {"label": "tip", "rev": "tip"}
def seq(factor=1): yield 1 * factor yield 3 * factor #yield 5 * factor for f in seq(factor * 10): yield f
for rev in opts.get('prune'):
for rev in opts.get('prune', ()):
def realparents(rev): if self.onlyfirst: return repo.changelog.parentrevs(rev)[0:1] else: return filter(lambda x: x != -1, repo.changelog.parentrevs(rev))
for r in list: yield self.revision(r)
for node in list: yield self.revision(node)
def revisions(self, list): # this can be optimized to do spans, etc # be stupid for now for r in list: yield self.revision(r)
transaction.add(self.datafile, e[0])
transaction.add(self.datafile, e[0] - 1)
def addrevision(self, text, transaction, link, p1=None, p2=None): if text is None: text = "" if p1 is None: p1 = self.tip() if p2 is None: p2 = nullid
transaction.add(self.indexfile, n * len(entry))
transaction.add(self.indexfile, (n + 1) * len(entry) - 1)
def addrevision(self, text, transaction, link, p1=None, p2=None): if text is None: text = "" if p1 is None: p1 = self.tip() if p2 is None: p2 = nullid
rep = {}
req = dict.fromkeys(unknown)
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
if n[0] == nullid: break if n in seenbranch:
if n[0] == nullid: pass elif n in seenbranch:
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
if n[1] and n[1] in m:
elif n[1] and n[1] in m:
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
base[n[2]] = 1 continue for a in n[2:4]: if a not in rep: r.append(a) rep[a] = 1
for p in n[2:4]: if p in m: base[p] = 1 for p in n[2:4]: if p not in req and p not in m: r.append(p) req[p] = 1
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
if b[0] in m: self.ui.debug(_("found base node %s\n") % short(b[0])) base[b[0]] = 1 elif b[0] not in seen: unknown.append(b)
unknown.append(b)
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
repo.add(a)
repo.add(u)
def addremove(ui, repo): """add all new files, delete all missing files""" (c, a, d, u) = repo.diffdir(repo.root) repo.add(a) repo.remove(d)
elif m2[f] != a:
elif mw[f] == m1[f] or force:
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
files = [] match = util.always if pats: roots, match, results = makewalk(repo, pats, opts) for src, abs, rel, exact in results: files.append(abs) dodiff(sys.stdout, ui, repo, node1, node2, files, match=match,
fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts) dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
def diff(ui, repo, *pats, **opts): """diff working directory (or selected files)""" node1, node2 = None, None revs = [repo.lookup(x) for x in opts['rev']] if len(revs) > 0: node1 = revs[0] if len(revs) > 1: node2 = revs[1] if len(revs) > 2: raise util.Abort("too many revisions to diff") files = [] match = util.always...
def make_filename(repo, r, pat, node=None,
def make_filename(repo, pat, node,
def make_filename(repo, r, pat, node=None, total=None, seqno=None, revwidth=None, pathname=None): node_expander = { 'H': lambda: hex(node), 'R': lambda: str(r.rev(node)), 'h': lambda: short(node), } expander = { '%': lambda: '%', 'b': lambda: os.path.basename(repo.root), } try: if node: expander.update(node_expander) ...
'R': lambda: str(r.rev(node)),
'R': lambda: str(repo.changelog.rev(node)),
def make_filename(repo, r, pat, node=None, total=None, seqno=None, revwidth=None, pathname=None): node_expander = { 'H': lambda: hex(node), 'R': lambda: str(r.rev(node)), 'h': lambda: short(node), } expander = { '%': lambda: '%', 'b': lambda: os.path.basename(repo.root), } try: if node: expander.update(node_expander) ...
def make_file(repo, r, pat, node=None,
def make_file(repo, pat, node=None,
def make_file(repo, r, pat, node=None, total=None, seqno=None, revwidth=None, mode='wb', pathname=None): if not pat or pat == '-': return 'w' in mode and sys.stdout or sys.stdin if hasattr(pat, 'write') and 'w' in mode: return pat if hasattr(pat, 'read') and 'r' in mode: return pat return open(make_filename(repo, r, pa...
return open(make_filename(repo, r, pat, node, total, seqno, revwidth,
return open(make_filename(repo, pat, node, total, seqno, revwidth,
def make_file(repo, r, pat, node=None, total=None, seqno=None, revwidth=None, mode='wb', pathname=None): if not pat or pat == '-': return 'w' in mode and sys.stdout or sys.stdin if hasattr(pat, 'write') and 'w' in mode: return pat if hasattr(pat, 'read') and 'r' in mode: return pat return open(make_filename(repo, r, pa...
dest = make_filename(repo, repo.changelog, dest, node)
dest = make_filename(repo, dest, node)
def archive(ui, repo, dest, **opts): '''create unversioned archive of a repository revision By default, the revision used is the parent of the working directory; use "-r" to specify a different revision. To specify the type of archive to create, use "-t". Valid types are: "files" (default): a directory full of file...
prefix = make_filename(repo, repo.changelog, prefix, node)
prefix = make_filename(repo, prefix, node)
def archive(ui, repo, dest, **opts): '''create unversioned archive of a repository revision By default, the revision used is the parent of the working directory; use "-r" to specify a different revision. To specify the type of archive to create, use "-t". Valid types are: "files" (default): a directory full of file...
fp = make_file(repo, r, opts['output'], node=n, pathname=abs)
fp = make_file(repo, opts['output'], node, pathname=abs)
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 the tip is used. Output may be to a file, in which case the name of the file is given using a format string. The formatting rules are th...
fp = make_file(repo, repo.changelog, opts['output'], node=node, total=total, seqno=seqno,
fp = make_file(repo, opts['output'], node, total=total, seqno=seqno,
def doexport(ui, repo, changeset, seqno, total, revwidth, opts): node = repo.lookup(changeset) parents = [p for p in repo.changelog.parents(node) if p != nullid] if opts['switch_parent']: parents.reverse() prev = (parents and parents[0]) or nullid change = repo.changelog.read(node) fp = make_file(repo, repo.changelog,...
ui.status("date: %s\n" % time.asctime( time.localtime(float(changes[2].split(' ')[0]))))
ui.status("date: %s\n" % date)
def show_changeset(ui, repo, rev=0, changenode=None, filelog=None, brinfo=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(chang...
for fn, c in [(fn, c) for fn, c in dc.items() if match(fn)]:
for fn, c in dc.iteritems(): if not match(fn): continue
def checkappend(l, fn): if match is util.always or match(fn): l.append(fn)
u.warn(_("abort: error: %s\n") % inst.reason[1])
try: reason = inst.reason.args[1] except: reason = inst.reason u.warn(_("abort: error: %s\n") % reason)
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]))
ok_types = ('text/plain', 'text/x-patch')
ok_types = ('application/x-patch', 'text/plain', 'text/x-patch')
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...
success = False
success = created = False
def clone(ui, source, dest = None, **opts): """make a copy of an existing repository""" source = ui.expandpath(source) success = False if dest is None: dest = os.getcwd() elif not os.path.exists(dest): os.mkdir(dest) created = True try: dest = os.path.realpath(dest) link = 0 if not source.startswith("http://"): sou...
opts = mdiff.diffopts() opts.text = text
def read(f): return repo.wfile(f).read()
def date(c): return time.asctime(time.gmtime(c[2][0]))
def date(c): return time.asctime(time.gmtime(c[2][0]))
def read(f): return repo.file(f).read(mmap2[f]) date2 = date(change)
def read(f): return repo.file(f).read(mmap2[f])
date2 = time.asctime()
def read(f): return repo.file(f).read(mmap2[f])
def read(f): return file(os.path.join(repo.root, f)).read()
def read(f): return file(os.path.join(repo.root, f)).read()
date1 = date(change)
def read(f): return file(os.path.join(repo.root, f)).read()
elif full is "commit":
elif full == "commit":
def is_reachable(ar, reachable, sha): if len(ar) == 0: return 1 mask = 0 for i in range(len(ar)): if sha in reachable[i]: mask |= 1 << i
or tmpl("error", error="%r not found" % fname))
or self.t("error", error="%r not found" % fname))
def expand_form(form): shortcuts = { 'cl': [('cmd', ['changelog']), ('rev', None)], 'cs': [('cmd', ['changeset']), ('node', None)], 'f': [('cmd', ['file']), ('filenode', None)], 'fl': [('cmd', ['filelog']), ('filenode', None)], 'fd': [('cmd', ['filediff']), ('node', None)], 'fa': [('cmd', ['annotate']), ('filenode', No...
args.append('-d "%s"' % cwd) fp = os.popen('%s %s -p%d < "%s"' % (patcher, ' '.join(args), strip, patchname))
args.append('-d %s' % shellquote(cwd)) fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, shellquote(patchname)))
def patch(strip, patchname, ui, cwd=None): """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') args = [] if cwd: args.append('-d "%s"' % cwd) fp = os.popen('%s %s -p%d < "%s"' % (patcher, ' '.join(args), st...
for f in lookup: if fcmp(f, mf):
for f in l: if fcmp(f, mf1):
def fcmp(fn, mf): t1 = self.wfile(fn).read() t2 = self.file(fn).revision(mf[fn]) return cmp(t1, t2)