rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
args = [cmd] + defaults.split() + args try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) cmd, args = args[0], args[1:]
args = defaults.split() + args
def parse(ui, args): options = {} cmdoptions = {} try: args = fancyopts.fancyopts(args, globalopts, options) except fancyopts.getopt.GetoptError, inst: raise ParseError(None, inst) if args: cmd, args = args[0], args[1:] defaults = ui.config("defaults", cmd) if defaults: # reparse with command defaults added args = [c...
nd = util.normpath(top[len(self.root) + 1:])
nd = util.normpath(top[root_subtract_len:])
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 = '' else: # do not recurse into a repo contained in this # one. use bisect to find .hg directory so speed # is good on ...
except ValueError: vargs.update([(name, v)])
except (AttributeError, ValueError): try: for a, b in v: vargs[a] = b except ValueError: vargs[name] = v
def one(v, tag=name): try: vargs.update(v) except ValueError: vargs.update([(name, v)]) return self.t(tag, **vargs)
args.update(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0]))
args.update(dict(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0])))
def showmanifest(**args): args = args.copy() args.update(rev=self.repo.manifest.rev(changes[0]), node=hex(changes[0])) yield self.t('manifest', **args)
s = self.encodepath(path) revlog.__init__(self, opener, os.path.join("data", s + "i"), os.path.join("data", s)) def encodepath(self, path): s = sha.sha(path).digest() s = base64.encodestring(s)[:-3] s = re.sub("\+", "%", s) s = re.sub("/", "_", s) return s
revlog.__init__(self, opener, path + ".i", path + ".d")
def __init__(self, opener, path): s = self.encodepath(path) revlog.__init__(self, opener, os.path.join("data", s + "i"), os.path.join("data", s))
if mode != "r" and os.path.isfile(f): s = os.stat(f) if s.st_nlink > 1: file(f + ".tmp", "w").write(file(f).read()) os.rename(f+".tmp", f)
if mode != "r": try: s = os.stat(f) except OSError: d = os.path.dirname(f) if not os.path.isdir(d): os.makedirs(d) else: if s.st_nlink > 1: file(f + ".tmp", "w").write(file(f).read()) os.rename(f+".tmp", f)
def o(path, mode="r"): if p[:7] == "http://": f = os.path.join(p, urllib.quote(path)) return httprangereader(f)
ok_types = ('application/x-patch', 'text/plain', 'text/x-patch')
ok_types = ('text/plain', 'text/x-diff', '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...
if not p.copymod:
if not p.copymod and not p.binary:
def dogitpatch(patchname, gitpatches, cwd=None): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p...
copyfile(p.oldpath, p.path, basedir=cwd)
def dogitpatch(patchname, gitpatches, cwd=None): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p...
tmpfp.write('diff --git a/%s b/%s\n' % (p.path, p.path)) line = pf.readline() pfline += 1 while not line.startswith('--- a/'): tmpfp.write(line)
if p.binary: text = extractbin(pf) if not text: raise util.Abort(_('binary patch extraction failed')) if not cwd: cwd = os.getcwd() absdst = os.path.join(cwd, p.path) basedir = os.path.dirname(absdst) if not os.path.isdir(basedir): os.makedirs(basedir) out = file(absdst, 'wb') out.write(text) out.close() elif p.copymod...
def dogitpatch(patchname, gitpatches, cwd=None): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p...
tmpfp.write('--- a/%s\n' % p.path)
while not line.startswith('--- a/'): tmpfp.write(line) line = pf.readline() pfline += 1 tmpfp.write('--- a/%s\n' % p.path)
def dogitpatch(patchname, gitpatches, cwd=None): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p...
if dopatch == 'filter':
if dopatch in ('filter', 'binary'):
def __patch(patchname): """patch and updates the files and fuzz variables""" files = {} fuzz = False
files, fuzz = __patch(patchname)
if dopatch != 'binary': files, fuzz = __patch(patchname)
def __patch(patchname): """patch and updates the files and fuzz variables""" files = {} fuzz = False
else: files, fuzz = {}, False
def __patch(patchname): """patch and updates the files and fuzz variables""" files = {} fuzz = False
if dodiff:
if dodiff == 'binary': fp.write(''.join(header)) b85diff(fp, to, tn) elif dodiff:
def addmodehdr(header, omode, nmode): if omode != nmode: header.append('old mode %s\n' % omode) header.append('new mode %s\n' % nmode)
fdict.pop(fn, None)
for ffn in fdict: if ffn == fn or fn.startswith("%s/" % ffn): del fdict[ffn] break
def walk(self, node=None, files=[], match=util.always, badmatch=None): if node: fdict = dict.fromkeys(files) for fn in self.manifest.read(self.changelog.read(node)[0]): fdict.pop(fn, None) if match(fn): yield 'm', fn for fn in fdict: if badmatch and badmatch(fn): if match(fn): yield 'b', fn else: self.ui.warn(_('%s: No...
def patch(ui, repo, patches, **opts):
def patch(ui, repo, patch1, *patches, **opts):
def patch(ui, repo, patches, **opts): """import an ordered set of patches""" try: import psyco psyco.full() except: pass d = opts["base"] strip = opts["strip"] quiet = opts["quiet"] and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.join(d, patch) text = "" for l in file(pf...
is given then the tip is used. """ if rev: try: n = repo.lookup(rev) change = repo.changelog.read(n) n = change[0] except hg.RepoError: n = repo.manifest.lookup(rev) else: n = repo.manifest.tip() m = repo.manifest.read(n)
is given then the first parent of the working directory is used. With -v flag, print file permissions. With --debug flag, print file revision hashes. """ m = repo.changectx(rev).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 tip is used. """ if rev: try: # assume all revision numbers are...
ui.write("%40s %3s %s\n" % (hex(m[f]), m.execf(f) and "755" or "644", f))
if ui.debugflag: ui.write("%40s " % hex(m[f])) if ui.verbose: ui.write("%3s " % (m.execf(f) and "755" or "644")) ui.write("%s\n" % f)
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 tip is used. """ if rev: try: # assume all revision numbers are...
return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
return time.asctime(time.gmtime(c[2][0]))
def date(c): return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
date_ar = changes[2].split(' ')
date_ar = changes[2]
def catcommit(repo, n, prefix, changes=None): nlprefix = '\n' + prefix; (p1, p2) = repo.changelog.parents(n) (h, h1, h2) = map(hg.hex, (n, p1, p2)) (i1, i2) = map(repo.changelog.rev, (p1, p2)) if not changes: changes = repo.changelog.read(n) print "tree %s" % (hg.hex(changes[0])) if i1 != -1: print "parent %s" % (h1) i...
date = changes[2].split(' ')[0]
date = changes[2][0]
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
dest = os.getcwd() elif not os.path.exists(dest): os.mkdir(dest) created = True
dest = os.path.basename(source) if dest == source: ui.warn('abort: source and destination are the same\n') sys.exit(1) os.mkdir(dest)
def clone(ui, source, dest = None, **opts): """make a copy of an existing repository""" source = ui.expandpath(source) success = created = 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...
p = p.split(':')[1]
p = pname else: p = str(self.series.index(pname)) + " " + p
def appliedname(self, index): p = self.applied[index] if not self.ui.verbose: p = p.split(':')[1] return p
self.ui.write(self.series[end] + '\n')
p = self.series[end] if self.ui.verbose: self.ui.write("%d " % self.series.index(p)) self.ui.write(p + '\n')
def next(self, repo): end = self.series_end() if end == len(self.series): self.ui.write("All patches applied\n") else: self.ui.write(self.series[end] + '\n')
" debugindex debugindexdot")
" debugindex debugindexdot debugdate")
def version_(ui): """output version and copyright information""" ui.write(_("Mercurial Distributed SCM (version %s)\n") % version.get_version()) ui.status(_( "\nCopyright (C) 2005, 2006 Matt Mackall <mpm@selenic.com>\n" "This is free software; see the source for copying conditions. " "There is NO\nwarranty; " "not even...
if not isinstance(dest, str) and not hasattr(dest, 'tell'): dest = tellable(dest)
if not isinstance(dest, str): try: dest.tell() except AttributeError: dest = tellable(dest) except IOError: dest = tellable(dest)
def __init__(self, dest, prefix, compress=True): self.prefix = tidyprefix(dest, prefix, ('.zip',)) if not isinstance(dest, str) and not hasattr(dest, 'tell'): dest = tellable(dest) self.z = zipfile.ZipFile(dest, 'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) self.date_time = time.gmtime(time.time())[:6]
return (nullid, "", (0, 0), [], "")
return (nullid, "", (0, 0), [], "", {})
def extract(self, text): """ format used: nodeid\n : manifest node in ascii user\n : user, no \n or \r allowed time tz extra\n : date (time is int or float, timezone is int) : extra is metadatas, encoded and separated by '\0' : older versions ignore it files\n\n : files modified by the cset, no \n...
ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
def close(self): self.container.append(''.join(self.lines).split('\n')) self.lines = []
msg = email.MIMEMultipart.MIMEMultipart() msg['Subject'] = '[PATCH 0 of %d] %s' % ( len(patches), opts['subject'] or prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches)))
def close(self): self.container.append(''.join(self.lines).split('\n')) self.lines = []
ui.write(_('Finish with ^D or a dot on a line by itself.\n\n')) body = [] while True: try: l = raw_input() except EOFError: break if l == '.': break body.append(l) msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n'))
if len(patches) > 1: ui.write(_('\nWrite the introductory message for the patch series.\n\n')) msg = email.MIMEMultipart.MIMEMultipart() msg['Subject'] = '[PATCH 0 of %d] %s' % ( len(patches), opts['subject'] or prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches))) ui.write(_('Finish with ^D or a dot on a li...
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 opts['diffstat']: d = cdiffstat(_('Final summary:\n'), jumbo) if d: msg.attach(email.MIMEText.MIMEText(d)) msgs.insert(0, msg)
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()]
def patches(a, bins): if not bins: return a plens = [len(x) for x in bins] pl = sum(plens) bl = len(a) + pl tl = bl + bl + pl b1, b2 = 0, bl if not tl: return a m = mmap.mmap(devzero.fileno(), tl, mmap.MAP_PRIVATE) m.write(a) frags = [(len(a), b1)] pos = b2 + bl m.seek(pos) for p in bins: m.write(p) def pull(ds...
def patchtext(bin): pos = 0 t = [] while pos < len(bin): p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12]) pos += 12 t.append(bin[pos:pos + l]) pos += l return "".join(t)
try: import mpatch patches = mpatch.patches except: pass
def patch(a, bin): return patches(a, [bin])
print port
def openlog(opt, default): if opt and opt != '-': return open(opt, 'w') return default
if not heads: heads = remote.heads()
def findincoming(self, remote, base=None, heads=None, force=False): m = self.changelog.nodemap search = [] fetch = {} seen = {} seenbranch = {} if base == None: base = {}
if self.changelog.tip() == nullid:
fetch = self.findincoming(remote, force=force) if fetch == [nullid]:
def pull(self, remote, heads=None, force=False): l = self.lock()
fetch = [nullid] else: fetch = self.findincoming(remote, force=force)
def pull(self, remote, heads=None, force=False): l = self.lock()
dc = repo.dirstate.dup()
repo.dirstate.read() dc = repo.dirstate.map
def debugcheckdirstate(ui, repo): parent1, parent2 = repo.dirstate.parents() dc = repo.dirstate.dup() keys = dc.keys() keys.sort() m1n = repo.changelog.read(parent1)[0] m2n = repo.changelog.read(parent2)[0] m1 = repo.manifest.read(m1n) m2 = repo.manifest.read(m2n) errors = 0 for f in dc: state = repo.dirstate.state(f) ...
dc = repo.dirstate.dup()
repo.dirstate.read() dc = repo.dirstate.map
def debugdumpdirstate(ui, repo): dc = repo.dirstate.dup() keys = dc.keys() keys.sort() for file in keys: print "%s => %c" % (file, dc[file][0])
(top, patch) = (self.applied[-1].rev, self.applied[-1].name)
(top, patchfn) = (self.applied[-1].rev, self.applied[-1].name)
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, patch) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo,...
message, comments, user, date, patchfound = self.readheaders(patch) patchf = self.opener(patch, "w")
message, comments, user, date, patchfound = self.readheaders(patchfn) patchf = self.opener(patchfn, "w")
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, patch) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo,...
self.printdiff(repo, patchparent, files=filelist, changes=(m, a, r, [], u), fp=patchf)
patch.diff(repo, patchparent, files=filelist, match=matchfn, fp=patchf, changes=(m, a, r, [], u), opts=self.diffopts())
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, patch) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo,...
message = "patch queue: %s\n" % patch
message = "patch queue: %s\n" % patchfn
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, patch) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo,...
self.applied[-1] = statusentry(revlog.hex(n), patch)
self.applied[-1] = statusentry(revlog.hex(n), patchfn)
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, patch) = (self.applied[-1].rev, self.applied[-1].name) top = revlog.bin(top) cparents = repo.changelog.parents(top) patchparent = self.qparents(repo,...
max_noise = 100
max_noise = 500
def __init__(self, ui, path): self.url = path self.ui = ui
ui.status(_("remote: %s") % l1)
ui.debug(_("remote: "), l1)
def __init__(self, ui, path): self.url = path self.ui = ui
h = hgweb.hgweb(real)
h = hgweb(real)
def run(self): try: virtual = os.environ["PATH_INFO"] except: virtual = ""
def dogitpatch(patchname, gitpatches):
def dogitpatch(patchname, gitpatches, cwd=None):
def dogitpatch(patchname, gitpatches): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p.oldpath, ...
copyfile(p.oldpath, p.path)
copyfile(p.oldpath, p.path, basedir=cwd)
def dogitpatch(patchname, gitpatches): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 fd, patchname = tempfile.mkstemp(prefix='hg-patch-') tmpfp = os.fdopen(fd, 'w') try: for i in range(len(gitpatches)): p = gitpatches[i] if not p.copymod: continue copyfile(p.oldpath, ...
patchname = dogitpatch(patchname, gitpatches)
patchname = dogitpatch(patchname, gitpatches, cwd=cwd)
def patch(patchname, ui, strip=1, cwd=None): """apply the patch <patchname> to the working directory. a list of patched files is returned""" (dopatch, gitpatches) = readgitpatch(patchname) files = {} fuzz = False if dopatch: if dopatch == 'filter': patchname = dogitpatch(patchname, gitpatches) patcher = util.find_in_...
def version(ui):
def show_version(ui):
def version(ui): """output version and copyright information""" ui.write("Mercurial version %s\n" % version.get_version()) ui.status( "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n" "This is free software; see the source for copying conditions. " "There is NO\nwarranty; " "not even for MERCHANTABILITY or FITNES...
version(ui)
show_version(ui)
def help(ui, cmd=None): '''show help for a given command or all commands''' if cmd: try: i = find(cmd) ui.write("%s\n\n" % i[2]) if i[1]: for s, l, d, c in i[1]: opt=' ' if s: opt = opt + '-' + s + ' ' if l: opt = opt + '--' + l + ' ' if d: opt = opt + '(' + str(d) + ')' ui.write(opt, "\n") if c: ui.write(' %s\n' % ...
for e in table.values(): f = e[0] if f.__name__.startswith("debug"): continue
for c,e in table.items(): f = c aliases = None if "|" in f: l = f.split("|") f, aliases = l[0], l[1:] if f.startswith("debug"): continue
def help(ui, cmd=None): '''show help for a given command or all commands''' if cmd: try: i = find(cmd) ui.write("%s\n\n" % i[2]) if i[1]: for s, l, d, c in i[1]: opt=' ' if s: opt = opt + '-' + s + ' ' if l: opt = opt + '--' + l + ' ' if d: opt = opt + '(' + str(d) + ')' ui.write(opt, "\n") if c: ui.write(' %s\n' % ...
if f.__doc__: d = f.__doc__.splitlines(0)[0].rstrip() h[f.__name__.rstrip("_")] = d
if e[0].__doc__: d = e[0].__doc__.splitlines(0)[0].rstrip() h[f] = d
def help(ui, cmd=None): '''show help for a given command or all commands''' if cmd: try: i = find(cmd) ui.write("%s\n\n" % i[2]) if i[1]: for s, l, d, c in i[1]: opt=' ' if s: opt = opt + '-' + s + ' ' if l: opt = opt + '--' + l + ' ' if d: opt = opt + '(' + str(d) + ')' ui.write(opt, "\n") if c: ui.write(' %s\n' % ...
"version": (version, [], 'hg version'),
"version": (show_version, [], 'hg version'),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
def dodiff(ui, repo, files = None, node1 = None, node2 = None):
revrangesep = ':' def revrange(ui, repo, revs = [], revlog = None): if revlog is None: revlog = repo.changelog revcount = revlog.count() def fix(val, defval): if not val: return defval try: num = int(val) if str(num) != val: raise ValueError if num < 0: num += revcount if not (0 <= num < revcount): raise ValueError ex...
def dodiff(ui, repo, files = None, node1 = None, node2 = None): def date(c): return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) (c, a, d, u) = repo.changes(node1, node2, files) if files: c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) if not c and not a and not d: return if node2: change = repo.ch...
sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f, r))
fp.write(mdiff.unidiff(to, date1, tn, date2, f, r))
def read(f): return repo.wfile(f).read()
dodiff(ui, repo, files, *revs) def export(ui, repo, changeset): """dump the changeset header and diffs for a revision"""
dodiff(sys.stdout, ui, repo, files, *revs) def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
def diff(ui, repo, *files, **opts): """diff working directory (or selected files)""" revs = [] if opts['rev']: revs = map(lambda x: repo.lookup(x), opts['rev']) if len(revs) > 2: ui.warn("too many revisions to diff\n") sys.exit(1) if files: files = relpath(repo, files) else: files = relpath(repo, [""]) dodiff(ui, re...
print " print " print " print " print
def expand(name): expansions = { '%': lambda: '%', 'H': lambda: hg.hex(node), 'N': lambda: str(total), 'R': lambda: str(repo.changelog.rev(node)), 'b': lambda: os.path.basename(repo.root), 'h': lambda: hg.short(node), 'n': lambda: str(seqno).zfill(len(str(total))), 'r': lambda: str(repo.changelog.rev(node)).zfill(revwi...
def export(ui, repo, changeset): """dump the changeset header and diffs for a revision""" node = repo.lookup(changeset) prev, other = repo.changelog.parents(node) change = repo.changelog.read(node) print "# HG changeset patch" print "# User %s" % change[1] print "# Node ID %s" % hg.hex(node) print "# Parent %s" % hg.h...
print " print change[4].rstrip() print dodiff(ui, repo, None, prev, node)
print >> fp, " print >> fp, change[4].rstrip() print >> fp dodiff(fp, ui, repo, None, prev, node) def export(ui, repo, *changesets, **opts): """dump the header and diffs for one or more changesets""" seqno = 0 revs = list(revrange(ui, repo, changesets)) total = len(revs) revwidth = max(len(revs[0]), len(revs[-1])) fo...
def export(ui, repo, changeset): """dump the changeset header and diffs for a revision""" node = repo.lookup(changeset) prev, other = repo.changelog.parents(node) change = repo.changelog.read(node) print "# HG changeset patch" print "# User %s" % change[1] print "# Node ID %s" % hg.hex(node) print "# Parent %s" % hg.h...
ui.warn("abort: 'tip' is a reserved name!\n") return -1
ui.warn("abort: 'tip' is a reserved name!\n") return -1 if name.find(revrangesep) >= 0: ui.warn("abort: '%s' cannot be used in a tag name\n" % revrangesep) return -1
def tag(ui, repo, name, rev = None, **opts): """add a tag for the current tip or a given revision""" if name == "tip": ui.warn("abort: 'tip' is a reserved name!\n") return -1 (c, a, d, u) = repo.changes(None, None) for x in (c, a, d, u): if ".hgtags" in x: ui.warn("abort: working copy of .hgtags is changed!\n") ui.st...
"export": (export, [], "hg export <changeset>"),
"export": (export, [('o', 'output', "", 'output to file')], "hg export [-o file] <changeset> ..."),
def verify(ui, repo): """verify the integrity of the repository""" return repo.verify()
print "%s in state %s, but not listed in either manifest" % (f, state)
print "%s in state %s, but not listed in either manifest" % \ (f, state)
def debugcheckdirstate(ui, repo): parent1, parent2 = repo.dirstate.parents() dc = repo.dirstate.dup() keys = dc.keys() keys.sort() m1n = repo.changelog.read(parent1)[0] m2n = repo.changelog.read(parent2)[0] m1 = repo.manifest.read(m1n) m2 = repo.manifest.read(m2n) errors = 0 for f in dc: state = repo.dirstate.state(f) ...
print ".hg/dirstate inconsistent with current parent's manifest, aborting"
print ".hg/dirstate inconsistent with current parent's manifest"
def debugcheckdirstate(ui, repo): parent1, parent2 = repo.dirstate.parents() dc = repo.dirstate.dup() keys = dc.keys() keys.sort() m1n = repo.changelog.read(parent1)[0] m2n = repo.changelog.read(parent2)[0] m1 = repo.manifest.read(m1n) m2 = repo.manifest.read(m2n) errors = 0 for f in dc: state = repo.dirstate.state(f) ...
d = Dircleanup(dest)
def __del__(self): if self.dir_: self.rmtree(self.dir_, True)
if self.mapcache or self.mapcache[0] != node:
if not self.mapcache or self.mapcache[0] != node:
def readflags(self, node): if node == nullid: return {} # don't upset local cache if self.mapcache or self.mapcache[0] != node: self.read(node) return self.mapcache[2]
if not message and mailre.match(line) and not opts['force']:
if (not message and not hgpatch and mailre.match(line) and not opts['force']):
def import_(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" patches = (patch1,) + patches if not opts['force']: (c, a, d, u) = repo.changes() if c or a or d: ui.warn("abort: outstanding uncommitted changes!\n") return 1 d = opts["base"] strip = opts["strip"] mailre = re.compile(r'(?:From ...
p1, p2 = cl.parents(n)
def changelist(): parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in range(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) p1, p2 = cl.parents(n) t = float(changes[2].split(' ')[0])
p1 = hex(p1), p2 = hex(p2), p1rev = cl.rev(p1), p2rev = cl.rev(p2),
def changelist(): parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in range(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) p1, p2 = cl.parents(n) t = float(changes[2].split(' ')[0])
p1, p2 = cl.parents(n)
def revgen(): for i in range(cl.count() - 1, 0, -100): l = [] for j in range(max(0, i - 100), i): n = cl.node(j) changes = cl.read(n) l.insert(0, (n, j, changes)) for e in l: yield e
p1 = hex(p1), p2 = hex(p2), p1rev = cl.rev(p1), p2rev = cl.rev(p2),
def revgen(): for i in range(cl.count() - 1, 0, -100): l = [] for j in range(max(0, i - 100), i): n = cl.node(j) changes = cl.read(n) l.insert(0, (n, j, changes)) for e in l: yield e
p1, p2 = cl.parents(n) p1rev, p2rev = cl.rev(p1), cl.rev(p2)
p1 = cl.parents(n)[0]
def changeset(self, nodeid): n = bin(nodeid) cl = self.repo.changelog changes = cl.read(n) p1, p2 = cl.parents(n) p1rev, p2rev = cl.rev(p1), cl.rev(p2) t = float(changes[2].split(' ')[0])
p1 = hex(p1), p2 = hex(p2), p1rev = cl.rev(p1), p2rev = cl.rev(p2),
def diff(): yield self.diff(p1, n, changes[3])
p1, p2 = fl.parents(n)
def entries(): l = [] parity = (count - 1) & 1
desc = cs[4], p1 = hex(p1), p2 = hex(p2), p1rev = fl.rev(p1), p2rev = fl.rev(p2)))
parent = self.parents("filelogparent", fl.parents(n), fl.rev, file=f), desc = cs[4]))
def entries(): l = [] parity = (count - 1) & 1
p1, p2 = fl.parents(n)
def filerevision(self, f, node): fl = self.repo.file(f) n = bin(node) text = fl.read(n) changerev = fl.linkrev(n) cl = self.repo.changelog cn = cl.node(changerev) cs = cl.read(cn) p1, p2 = fl.parents(n) t = float(cs[2].split(' ')[0]) mfn = cs[0]
p1 = hex(p1), p2 = hex(p2), permissions = self.repo.manifest.readflags(mfn)[f], p1rev = fl.rev(p1), p2rev = fl.rev(p2))
permissions = self.repo.manifest.readflags(mfn)[f])
def lines(): for l, t in enumerate(text.splitlines(1)): yield self.t("fileline", line = t, linenumber = "% 6d" % (l + 1), parity = l & 1)
p1, p2 = fl.parents(n)
def fileannotate(self, f, node): bcache = {} ncache = {} fl = self.repo.file(f) n = bin(node) changerev = fl.linkrev(n)
p1 = hex(p1), p2 = hex(p2), permissions = self.repo.manifest.readflags(mfn)[f], p1rev = fl.rev(p1), p2rev = fl.rev(p2))
permissions = self.repo.manifest.readflags(mfn)[f])
def annotate(): parity = 1 last = None for r, l in fl.annotate(n): try: cnode = ncache[r] except KeyError: cnode = ncache[r] = self.repo.changelog.node(r)
p1rev = self.repo.changelog.rev(p1),
def diff(): yield self.diff(p1, n, file)
if old == a: return new
if old == a: return None
def resolvedag(self, old, new, transaction, link): """resolve unmerged heads in our DAG""" if old == new: return None a = self.ancestor(old, new) if old == a: return new return self.merge3(old, new, a, transaction, link)
def write(str):
def write(self, str):
def write(str): self.writelines(str.split('\n'))
def writelines(seq):
def writelines(self, seq):
def writelines(seq): for msg in seq: self.handler.log_error("HG error: %s", msg)
('X', 'exclude', [], _('include names matching the given patterns')),
('X', 'exclude', [], _('exclude names matching the given patterns')),
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...
repo.commit(files, text)
repo.commit(files, text, user)
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"] for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.join(d, patch) text = "" for l in file(pf): i...
repomap[repo].diff(repo, files)
repomap[repo].diff(repo, list(files))
def diff(ui, repo, *files, **opts): """diff of the current patch""" repomap[repo].diff(repo, files) return 0
yield np
yield util.pconvert(np)
def findfiles(s): retfiles = [] 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 ...
def supported_type(f, st): if stat.S_ISREG(st.st_mode): return True 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...
def supported_type(f, st): if stat.S_ISREG(st.st_mode): return True 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...
elif statmatch(np, st) and supported_type(np, st): yield util.pconvert(np), st
if statmatch(np, st) and np in dc: yield 'm', util.pconvert(np), st elif statmatch(np, st): if self.supported_type(np, st): yield 'f', util.pconvert(np), st elif np in dc: yield 'm', util.pconvert(np), st
def findfiles(s): retfiles = [] 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 ...
cmp0 = (lambda x, y: cmp(x[0], y[0]))
cmp1 = (lambda x, y: cmp(x[1], y[1]))
def seen(fn): if fn in known: return True known[fn] = 1
sorted.sort(cmp0) for fl, stl in sorted: yield 'f', fl, stl
sorted.sort(cmp1) for e in sorted: yield e
def seen(fn): if fn in known: return True known[fn] = 1
found = False
def seen(fn): if fn in known: return True known[fn] = 1
if statmatch(ff, st) and supported_type(ff, st): found = True
if statmatch(ff, st): if self.supported_type(ff, st): yield 'f', ff, st elif ff in dc: yield 'm', ff, st
def seen(fn): if fn in known: return True known[fn] = 1
if found: yield 'f', ff, st
def seen(fn): if fn in known: return True known[fn] = 1
try: st = os.stat(fn) except OSError, inst:
nonexistent = True if not st: try: st = os.lstat(fn) except OSError, inst: if inst.errno != errno.ENOENT: raise st = None if st and self.supported_type(fn, st): nonexistent = False
def changes(self, files=None, match=util.always): lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
if inst.errno != errno.ENOENT: raise
if nonexistent:
def changes(self, files=None, match=util.always): lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], []
parents = [(log.rev(p), self.ui.verbose and hex(p) or short(p)) for p in log.parents(changenode)
hexfunc = self.ui.debugflag and hex or short parents = [(log.rev(p), hexfunc(p)) for p in log.parents(changenode)
def show(self, rev=0, changenode=None, brinfo=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)
if self.ui.verbose: self.ui.write(_("changeset: %d:%s\n") % (rev, hex(changenode))) else: self.ui.write(_("changeset: %d:%s\n") % (rev, short(changenode)))
self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)))
def show(self, rev=0, changenode=None, brinfo=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)
hexfunc = ui.verbose and hex or short
hexfunc = ui.debugflag and hex or short
def identify(ui, repo): """print information about the working copy Print a short summary of the current state of the repo. This summary identifies the repository state using one or two parent hash identifiers, followed by a "+" if there are uncommitted changes in the working directory, followed by a list of tags for...