rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
prev = self.tip() | def addgroup(self, revs, linkmapper, transaction, unique = 0): # given a set of deltas, add them to the revision log. the # first delta is against its parent, which should be in our # log, the rest are against the previous delta. | |
import shutil shutil.rmtree(self.dir, True) | self.rmtree(self.dir, True) | def __del__(self): if self.dir: import shutil shutil.rmtree(self.dir, True) |
fetch = repo.findincoming(other) if fetch: cg = other.changegroup(fetch) repo.addchangegroup(cg) | repo.pull(other) | def __del__(self): if self.dir: import shutil shutil.rmtree(self.dir, True) |
fetch = repo.findincoming(other) if not fetch: ui.status("no changes found\n") return cg = other.changegroup(fetch) r = repo.addchangegroup(cg) if cg and not r: | r = repo.pull(other) if not r: | def pull(ui, repo, source="default", **opts): """pull changes from the specified source""" source = ui.expandpath(source) ui.status('pulling from %s\n' % (source)) other = hg.repository(ui, source) fetch = repo.findincoming(other) if not fetch: ui.status("no changes found\n") return cg = other.changegroup(fetch) r =... |
c, a, d = r.changes(node1, node2) | c, a, d, u = r.changes(node1, node2) | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line = l) elif l.startswith('-'): yield self.t("difflineminus", line = l) elif l.startswith('@'): yield self.t("difflineat", line = l) else: yield self.t("diffline", line = l) |
u.warn(_("abort: %s - %s\n") % (inst.strerror, inst.filename)) | u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) | 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 hasattr(inst, "filename"): | if getattr(inst, "filename", None): | 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])) |
for prefix in 're:', 'glob:', 'path:': | for prefix in 're:', 'glob:', 'path:', 'relpath:': | def patkind(name): for prefix in 're:', 'glob:', 'path:': if name.startswith(prefix): return name.split(':', 1) for c in name: if c in _globchars: return 'glob', name return 'relpath', name |
def regex(name, tail): | def regex(kind, name, tail): | def regex(name, tail): '''convert a pattern into a regular expression''' kind, name = patkind(name) if kind == 're': return name elif kind == 'path': return '^' + re.escape(name) + '$' return head + globre(name, '', tail) |
kind, name = patkind(name) | def regex(name, tail): '''convert a pattern into a regular expression''' kind, name = patkind(name) if kind == 're': return name elif kind == 'path': return '^' + re.escape(name) + '$' return head + globre(name, '', tail) | |
return '^' + re.escape(name) + '$' | return '^' + re.escape(name) + '(?:/|$)' elif kind == 'relpath': return head + re.escape(name) + tail | def regex(name, tail): '''convert a pattern into a regular expression''' kind, name = patkind(name) if kind == 're': return name elif kind == 'path': return '^' + re.escape(name) + '$' return head + globre(name, '', tail) |
pat = '(?:%s)' % '|'.join([regex(p, tail) for p in pats]) | pat = '(?:%s)' % '|'.join([regex(k, p, tail) for (k, p) in pats]) | def matchfn(pats, tail): """build a matching function from a set of patterns""" if pats: pat = '(?:%s)' % '|'.join([regex(p, tail) for p in pats]) return re.compile(pat).match |
if kind in ('glob', 're'): pats.append(name) | if kind in ('glob', 'path', 're'): pats.append((kind, name)) | 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) |
files.append(name) | files.append((kind, name)) | 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) |
incmatch = matchfn(inc, '(?:/|$)') or always excmatch = matchfn(exc, '(?:/|$)') or (lambda fn: False) | incmatch = matchfn(map(patkind, inc), '(?:/|$)') or always excmatch = matchfn(map(patkind, exc), '(?:/|$)') or (lambda fn: False) | 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) |
p = util.normpath(path) if p[:2] == "..": raise Exception("suspicious path") return p | return util.canonpath(self.repo.root, '', path) | def cleanpath(self, path): p = util.normpath(path) if p[:2] == "..": raise Exception("suspicious path") return p |
raise RevlogError(_("unknown parent %s") % short(p1)) | raise revlog.RevlogError(_("unknown parent %s") % short(p1)) | def chunkpositer(): for chunk in changegroup.chunkiter(bundlefile): pos = bundlefile.tell() yield chunk, pos - len(chunk) |
def chunk(self, rev, df=None): | def chunk(self, rev, df=None, cachelen=4096): | def chunk(self, rev, df=None): # Warning: in case of bundle, the diff is against bundlebase, # not against rev - 1 # XXX: could use some caching if not self.bundle(rev): return revlog.revlog.chunk(self, rev) self.bundlefile.seek(self.start(rev)) return self.bundlefile.read(self.length(rev)) |
return revlog.revlog.chunk(self, rev) | return revlog.revlog.chunk(self, rev, df, cachelen) | def chunk(self, rev, df=None): # Warning: in case of bundle, the diff is against bundlebase, # not against rev - 1 # XXX: could use some caching if not self.bundle(rev): return revlog.revlog.chunk(self, rev) self.bundlefile.seek(self.start(rev)) return self.bundlefile.read(self.length(rev)) |
raise RevlogError(_("integrity check failed on %s:%d") | raise revlog.RevlogError(_("integrity check failed on %s:%d") | def revision(self, node): """return an uncompressed revision of a given""" if node == nullid: return "" |
s = util.fstat(f) | def __init__(self, ui, path, bundlename): localrepo.localrepository.__init__(self, ui, path) f = open(bundlename, "rb") s = util.fstat(f) self.bundlefile = f header = self.bundlefile.read(6) if not header.startswith("HG"): raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename) elif not header.startswith("H... | |
elif a == None: | elif not a: | def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif a == None: b = b.splitlines(1) l1 = "--- %s\t%s\n" % ("/dev/null", epoch) l2 ... |
l1 = "--- %s\t%s\n" % ("/dev/null", epoch) | if a is None: l1 = "--- %s\t%s\n" % ("/dev/null", epoch) else: l1 = "--- %s\t%s\n" % ("a/" + fn, ad) | def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif a == None: b = b.splitlines(1) l1 = "--- %s\t%s\n" % ("/dev/null", epoch) l2 ... |
elif b == None: | elif not b: | def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif a == None: b = b.splitlines(1) l1 = "--- %s\t%s\n" % ("/dev/null", epoch) l2 ... |
l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) | if b is None: l2 = "+++ %s\t%s\n" % ("/dev/null", epoch) else: l2 = "+++ %s\t%s\n" % ("b/" + fn, bd) | def unidiff(a, ad, b, bd, fn, r=None, text=False, showfunc=False, ignorews=False): if not a and not b: return "" epoch = util.datestr((0, 0)) if not text and (util.binary(a) or util.binary(b)): l = ['Binary file %s has changed\n' % fn] elif a == None: b = b.splitlines(1) l1 = "--- %s\t%s\n" % ("/dev/null", epoch) l2 ... |
patches = patch1 + patches | patches = (patch1,) + patches | def patch(ui, repo, patch1, *patches, **opts): """import an ordered set of patches""" try: import psyco psyco.full() except: pass patches = patch1 + patches d = opts["base"] strip = opts["strip"] quiet = opts["quiet"] and "> /dev/null" or "" for patch in patches: ui.status("applying %s\n" % patch) pf = os.path.join(... |
pwd = os.getcwd() os.chdir(repo.root) | 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... | |
f = os.popen("%s -p1 --no-backup-if-mismatch < '%s'" % (pp, pf)) | f = os.popen("%s -d '%s' -p1 --no-backup-if-mismatch < '%s'" % (pp, repo.root, 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... |
os.chdir(pwd) | 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... | |
"hg add [FILE]..."), | "hg add [OPTION]... [FILE]..."), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
'hg annotate [-r REV] [-u] [-n] [-c] FILE...'), | 'hg annotate [OPTION]... FILE...'), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
'debugwalk [OPTIONS]... [FILE]...'), | 'debugwalk [OPTION]... [FILE]...'), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
'hg diff [-r REV1 [-r REV2]] [FILE]...'), | 'hg diff [-I] [-X] [-r REV1 [-r REV2]] [FILE]...'), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
"hg forget FILE..."), | "hg forget [OPTION]... FILE..."), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
'hg locate [-r REV] [-f] [-0] [PATTERN]...'), | 'hg locate [OPTION]... [PATTERN]...'), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
'hg push [DEST]'), | 'hg push [-f] [DEST]'), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
"hg status [FILE]..."), | "hg status [OPTION]... [FILE]..."), | def verify(ui, repo): """verify the integrity of the repository""" return repo.verify() |
if src == 'm' and not type == 'r': deleted.append(fn) continue | if src == 'm': try: st = os.stat(fn) except OSError, inst: if inst.errno != errno.ENOENT: raise deleted.append(fn) continue | def changes(self, files=None, match=util.always): lookup, modified, added, unknown = [], [], [], [] removed, deleted = [], [] |
optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems()]) os.system(ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))) | optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v]) cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc)) ui.debug("running %s\n" % cmd) os.system(cmd) | def view(ui, repo, *etc, **opts): "start interactive history viewer" os.chdir(repo.root) optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems()]) os.system(ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))) |
(dopatch, gitpatches) = readgitpatch(patchname) files = {} fuzz = False if dopatch: if dopatch == 'filter': patchname = dogitpatch(patchname, gitpatches, cwd=cwd) patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') | def __patch(patchname): """patch and updates the files and fuzz variables""" files = {} fuzz = False patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') | 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, cwd=cwd) patcher = util... |
if dopatch == 'filter': os.unlink(patchname) | 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, cwd=cwd) patcher = util... | |
if dopatch == 'filter': False and os.unlink(patchname) | 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, cwd=cwd) patcher = util... | |
cl = r.changelog mf = r.manifest change1 = cl.read(node1) change2 = cl.read(node2) mmap1 = mf.read(change1[0]) mmap2 = mf.read(change2[0]) date1 = util.datestr(change1[2]) date2 = util.datestr(change2[2]) | c1 = r.changectx(node1) c2 = r.changectx(node2) date1 = util.datestr(c1.date()) date2 = util.datestr(c2.date()) | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line=l) elif l.startswith('-'): yield self.t("difflineminus", line=l) elif l.startswith('@'): yield self.t("difflineat", line=l) else: yield self.t("diffline", line=l) |
to = r.file(f).read(mmap1[f]) tn = r.file(f).read(mmap2[f]) | to = c1.filectx(f).data() tn = c2.filectx(f).data() | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line=l) elif l.startswith('-'): yield self.t("difflineminus", line=l) elif l.startswith('@'): yield self.t("difflineat", line=l) else: yield self.t("diffline", line=l) |
tn = r.file(f).read(mmap2[f]) | tn = c2.filectx(f).data() | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line=l) elif l.startswith('-'): yield self.t("difflineminus", line=l) elif l.startswith('@'): yield self.t("difflineat", line=l) else: yield self.t("diffline", line=l) |
to = r.file(f).read(mmap1[f]) | to = c1.filectx(f).data() | def prettyprintlines(diff): for l in diff.splitlines(1): if l.startswith('+'): yield self.t("difflineplus", line=l) elif l.startswith('-'): yield self.t("difflineminus", line=l) elif l.startswith('@'): yield self.t("difflineat", line=l) else: yield self.t("diffline", line=l) |
cl = self.repo.changelog | def tags(self): cl = self.repo.changelog | |
"date": cl.read(n)[2], | "date": self.repo.changectx(n).date(), | def entries(notip=False, **map): parity = 0 for k, n in i: if notip and k == "tip": continue yield {"parity": self.stripes(parity), "tag": k, "date": cl.read(n)[2], "node": hex(n)} parity += 1 |
cl = self.repo.changelog | def summary(self): cl = self.repo.changelog | |
c = cl.read(n) t = c[2] | def tagentries(**map): parity = 0 count = 0 for k, n in i: if k == "tip": # skip tip continue; | |
parity = self.stripes(parity), tag = k, node = hex(n), date = t) | parity=self.stripes(parity), tag=k, node=hex(n), date=self.repo.changectx(n).date()) | def tagentries(**map): parity = 0 count = 0 for k, n in i: if k == "tip": # skip tip continue; |
cl = self.repo.changelog | def changelist(**map): parity = 0 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in xrange(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) t = changes[2] | |
n = cl.node(i) changes = cl.read(n) hn = hex(n) t = changes[2] | ctx = self.repo.changectx(i) hn = hex(ctx.node()) | def changelist(**map): parity = 0 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in xrange(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) t = changes[2] |
parity = parity, author = changes[1], desc = changes[4], date = t, rev = i, node = hn)) | parity=parity, author=ctx.user(), desc=ctx.description(), date=ctx.date(), rev=i, node=hn)) | def changelist(**map): parity = 0 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in xrange(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) t = changes[2] |
if ff not in dc: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) | nf = util.normpath(ff) found = False for fn in dc: if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'): found = True break if not found: self.ui.warn('%s: %s\n' % ( util.pathto(self.getcwd(), ff), inst.strerror)) | def seen(fn): if fn in known: return True known[fn] = 1 |
mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], (new, remove)) | removed.append(f) mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], (new, removed)) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, lock=None, wlock=None, force_editor=False, p1=None, p2=None, extra={}): |
edittext.extend(["HG: removed %s" % f for f in remove]) | edittext.extend(["HG: removed %s" % f for f in removed]) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, lock=None, wlock=None, force_editor=False, p1=None, p2=None, extra={}): |
n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, | n = self.changelog.add(mn, changed + removed, text, tr, p1, p2, | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, lock=None, wlock=None, force_editor=False, p1=None, p2=None, extra={}): |
self.dirstate.forget(remove) | self.dirstate.forget(removed) | def commit(self, files=None, text="", user=None, date=None, match=util.always, force=False, lock=None, wlock=None, force_editor=False, p1=None, p2=None, extra={}): |
copies.clear() | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: a, b = prevstates, states else: a, b = states, prevstates for change, l in difflinestates(a, b): if incrementing or not opts['all']: r = rev else: r = prev[fn] cols = [fn, str(r)] if opts['line_nu... | |
copies.setdefault(rev, {}) | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: a, b = prevstates, states else: a, b = states, prevstates for change, l in difflinestates(a, b): if incrementing or not opts['all']: r = rev else: r = prev[fn] cols = [fn, str(r)] if opts['line_nu... | |
copies[rev][fn] = copied[0] | copies.setdefault(rev, {})[fn] = copied[0] | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: a, b = prevstates, states else: a, b = states, prevstates for change, l in difflinestates(a, b): if incrementing or not opts['all']: r = rev else: r = prev[fn] cols = [fn, str(r)] if opts['line_nu... |
copy = copies[rev].get(fn) | copy = copies.get(rev, {}).get(fn) | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: a, b = prevstates, states else: a, b = states, prevstates for change, l in difflinestates(a, b): if incrementing or not opts['all']: r = rev else: r = prev[fn] cols = [fn, str(r)] if opts['line_nu... |
if fn not in copies[prev[fn]]: | if fn not in copies.get(prev[fn], {}): | def display(fn, rev, states, prevstates): counts = {'-': 0, '+': 0} filerevmatches = {} if incrementing or not opts['all']: a, b = prevstates, states else: a, b = states, prevstates for change, l in difflinestates(a, b): if incrementing or not opts['all']: r = rev else: r = prev[fn] cols = [fn, str(r)] if opts['line_nu... |
Show new changesets found in the specified repo or the default pull repo. These are the changesets that would be pulled if a pull | Show new changesets found in the specified path/URL or the default pull location. These are the changesets that would be pulled if a pull | def incoming(ui, repo, source="default", **opts): """show new changesets found in source Show new changesets found in the specified repo or the default pull repo. These are the changesets that would be pulled if a pull was requested. For remote repository, using --bundle avoids downloading the changesets twice if the... |
Show changesets not found in the specified destination repo or the default push repo. These are the changesets that would be pushed | Show changesets not found in the specified destination repository or the default push location. These are the changesets that would be pushed | def outgoing(ui, repo, dest="default-push", **opts): """show changesets not found in destination Show changesets not found in the specified destination repo or the default push repo. These are the changesets that would be pushed if a push was requested. See pull for valid source format details. """ dest = ui.expandpa... |
See pull for valid source format details. | See pull for valid destination format details. | def outgoing(ui, repo, dest="default-push", **opts): """show changesets not found in destination Show changesets not found in the specified destination repo or the default push repo. These are the changesets that would be pushed if a push was requested. See pull for valid source format details. """ dest = ui.expandpa... |
SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path. With SSH, paths are relative to the remote user's home directory by default; use two slashes at the start of a path to specify it as relative to the filesystem root. | Some notes about using SSH with Mercurial: - SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path or specified with as remotecmd. - /path is relative to the remote user's home directory by default. Use two slashes at the start of a path to specify an absolute path. - M... | def pull(ui, repo, source="default", **opts): """pull changes from the specified source Pull changes from a remote repository to a local one. This finds all changes from the repository at the specified path or URL and adds them to the local repository. By default, this does not update the copy of the project in the w... |
SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path. | Look at the help text for the pull command for important details about ssh:// URLs. | def push(ui, repo, dest="default-push", **opts): """push changes to the specified destination Push changes from the local repository to the given destination. This is the symmetrical operation for pull. It helps to move changes from the current repository to a different one. If the destination is local this is identi... |
self.applied = [statusentry(l) for l in self.opener(self.status_path).read().splitlines()] | lines = self.opener(self.status_path).read().splitlines() self.applied = [statusentry(l) for l in lines] | def __init__(self, ui, path, patchdir=None): self.basepath = path self.path = patchdir or os.path.join(path, "patches") self.opener = util.opener(self.path) self.ui = ui self.applied = [] self.full_series = [] self.applied_dirty = 0 self.series_dirty = 0 self.series_path = "series" self.status_path = "status" |
s = l.split(' if s: self.series.append(s) | h = l.find(' if h == -1: patch = l comment = '' elif h == 0: continue else: patch = l[:h] comment = l[h:] patch = patch.strip() if patch: self.series.append(patch) self.series_guards.append(self.guard_re.findall(comment)) def check_guard(self, guard): bad_chars = ' first = guard[0] for c in '-+': if first == c: return... | def parse_series(self): self.series = [] for l in self.full_series: s = l.split('#', 1)[0].strip() if s: self.series.append(s) |
pushable, reason = self.pushable(patch) if not pushable: self.explain_pushable(patch, all_patches=True) continue | def mergepatch(self, repo, mergeq, series, wlock): if len(self.applied) == 0: # each of the patches merged in will have two parents. This # can confuse the qrefresh, qdiff, and strip code because it # needs to know which parent is actually in the patch queue. # so, we insert a merge marker with only one parent. This ... | |
patch = self.series[sno] return patch | return self.series[sno] | def partial_name(s): if s in self.series: return s matches = [x for x in self.series if s in x] if len(matches) > 1: self.ui.warn(_('patch name "%s" is ambiguous:\n') % s) for m in matches: self.ui.warn(' %s\n' % m) return None if matches: return matches[0] if len(self.series) > 0 and len(self.applied) > 0: if s == 'q... |
return [(i, self.series[i]) for i in xrange(start, len(self.series))] | unapplied = [] for i in xrange(start, len(self.series)): pushable, reason = self.pushable(i) if pushable: unapplied.append((i, self.series[i])) self.explain_pushable(i) return unapplied | def unapplied(self, repo, patch=None): if patch and patch not in self.series: raise util.Abort(_("patch %s is not in series file") % patch) if not patch: start = self.series_end() else: start = self.series.index(patch) + 1 return [(i, self.series[i]) for i in xrange(start, len(self.series))] |
start = self.series_end() | start = self.series_end(all_patches=True) | def qseries(self, repo, missing=None, summary=False): start = self.series_end() if not missing: for i in range(len(self.series)): patch = self.series[i] if self.ui.verbose: 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 ': '... |
status = 'U' | status = 'G' | def qseries(self, repo, missing=None, summary=False): start = self.series_end() if not missing: for i in range(len(self.series)): patch = self.series[i] if self.ui.verbose: 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 ': '... |
def series_end(self): | def series_end(self, all_patches=False): | def series_end(self): end = 0 if len(self.applied) > 0: p = self.applied[-1].name try: end = self.series.index(p) except ValueError: return 0 return end + 1 return end |
return end + 1 return end | return next(end + 1) return next(end) | def series_end(self): end = 0 if len(self.applied) > 0: p = self.applied[-1].name try: end = self.series.index(p) except ValueError: return 0 return end + 1 return end |
def delete(self, repo, patch): | def delete(self, repo, patch, force=False): | def delete(self, repo, patch): patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: raise util.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: raise util.Abort(_("patch %s not in series file") % patch) i = self.find_series(patch) del self.full_series[i] self.read... |
q.delete(repo, patch) | q.delete(repo, patch, force=opts.get('force')) | def delete(ui, repo, patch, **opts): """remove a patch from the series file""" q = repo.mq q.delete(repo, patch) q.save_dirty() return 0 |
"qdelete": (delete, [], 'hg qdelete PATCH'), | "qdelete": (delete, [('f', 'force', None, _('delete patch file'))], 'hg qdelete [-f] PATCH'), | def tags(self): if self.tagscache: return self.tagscache |
def commit(self, update = None, parent, text = ""): | def commit(self, parent, update = None, text = ""): | def commit(self, update = None, parent, text = ""): tr = self.transaction() try: remove = [ l[:-1] for l in self.opener("to-remove") ] os.unlink(self.join("to-remove")) |
date = date or "%d %d" % (time.time(), time.timezone) | if date: date = util.date_parser(date) else: if time.daylight: offset = time.altzone else: offset = time.timezone date = "%d %d" % (time.time(), offset) | def add(self, manifest, list, desc, transaction, p1=None, p2=None, user=None, date=None): date = date or "%d %d" % (time.time(), time.timezone) list.sort() l = [hex(manifest), user, date] + list + ["", desc] text = "\n".join(l) return self.addrevision(text, transaction, self.count(), p1, p2) |
rcpath = rcfiles(os.path.dirname(sys.argv[0]) + '/../etc/mercurial') | rcpath = [] if len(sys.argv) > 0: rcpath.extend(rcfiles(os.path.dirname(sys.argv[0]) + '/../etc/mercurial')) | def rcfiles(path): rcs = [os.path.join(path, 'hgrc')] rcdir = os.path.join(path, 'hgrc.d') try: rcs.extend([os.path.join(rcdir, f) for f in os.listdir(rcdir) if f.endswith(".rc")]) except OSError, inst: pass return rcs |
oldlookup = repo.lookup def qlookup(key): try: return oldlookup(key) except hg.RepoError: q = repomap[repo] qpatchnames = { 'qtip': -1, 'qbase': 0 } if key in qpatchnames: if len(q.applied) == 0: self.ui.warn('No patches applied\n') raise patch = q.applied[qpatchnames[key]].split(':')[0] return revlog.bin(patch) pat... | oldtags = repo.tags def qtags(): if repo.tagscache: return repo.tagscache tagscache = oldtags() q = repomap[repo] if len(q.applied) == 0: return tagscache mqtags = [patch.split(':') for patch in q.applied] mqtags.append((mqtags[-1][0], 'qtip')) mqtags.append((mqtags[0][0], 'qbase')) for patch in mqtags: if patch[1]... | def reposetup(ui, repo): repomap[repo] = queue(ui, repo.join("")) oldlookup = repo.lookup def qlookup(key): try: return oldlookup(key) except hg.RepoError: q = repomap[repo] qpatchnames = { 'qtip': -1, 'qbase': 0 } if key in qpatchnames: if len(q.applied) == 0: self.ui.warn('No patches applied\n') raise patch = q.app... |
def debugrebuildstate(ui, repo, rev=None): | def debugrebuildstate(ui, repo, rev=""): | def debugrebuildstate(ui, repo, rev=None): """rebuild the dirstate as it would look like for the given revision""" if not rev: rev = repo.changelog.tip() else: rev = repo.lookup(rev) change = repo.changelog.read(rev) n = change[0] files = repo.manifest.read(n) wlock = repo.wlock() repo.dirstate.rebuild(rev, files) |
if not rev: | if rev == "": | def debugrebuildstate(ui, repo, rev=None): """rebuild the dirstate as it would look like for the given revision""" if not rev: rev = repo.changelog.tip() else: rev = repo.lookup(rev) change = repo.changelog.read(rev) n = change[0] files = repo.manifest.read(n) wlock = repo.wlock() repo.dirstate.rebuild(rev, files) |
else: rev = repo.lookup(rev) change = repo.changelog.read(rev) n = change[0] files = repo.manifest.read(n) | ctx = repo.changectx(rev) files = ctx.manifest() | def debugrebuildstate(ui, repo, rev=None): """rebuild the dirstate as it would look like for the given revision""" if not rev: rev = repo.changelog.tip() else: rev = repo.lookup(rev) change = repo.changelog.read(rev) n = change[0] files = repo.manifest.read(n) wlock = repo.wlock() repo.dirstate.rebuild(rev, files) |
m1n = repo.changelog.read(parent1)[0] m2n = repo.changelog.read(parent2)[0] m1 = repo.manifest.read(m1n) m2 = repo.manifest.read(m2n) | m1 = repo.changectx(parent1).manifest() m2 = repo.changectx(parent2).manifest() | def debugcheckstate(ui, repo): """validate the correctness of the current dirstate""" parent1, parent2 = repo.dirstate.parents() repo.dirstate.read() dc = repo.dirstate.map keys = dc.keys() keys.sort() m1n = repo.changelog.read(parent1)[0] m2n = repo.changelog.read(parent2)[0] m1 = repo.manifest.read(m1n) m2 = repo.man... |
node = repo.changectx(opts['rev']).node() mf = repo.manifest.read(repo.changelog.read(node)[0]) | ctx = repo.changectx(opts['rev']) node = ctx.node() mf = ctx.manifest() | 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 and unschedules add... |
pmf = repo.manifest.read(repo.changelog.read(parent)[0]) | pmf = repo.changectx(parent).manifest() | def handle(xlist, dobackup): xlist[0].append(abs) update[abs] = 1 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)) if not opts.get('dry_run'): util.copyfile(rel, bakname) if ui.verbose or not exact: ui.status(xli... |
ui.write("\n") | 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 %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_)) ui.write(... | |
ui.write("%s -> %s\n" % (repo.dirstate.copies[f], f)) | ui.write("copy: %s -> %s\n" % (repo.dirstate.copies[f], f)) | 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 %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_)) ui.write(... |
self.nodemap = {nullid: -1} | def __init__(self, opener, indexfile, datafile): self.indexfile = indexfile self.datafile = datafile self.index = [] self.opener = opener self.cache = None self.nodemap = {nullid: -1} # read the whole index for now, handle on-demand later try: n = 0 i = self.opener(self.indexfile).read() s = struct.calcsize(indexformat... | |
self.nodemap[e[6]] = n self.index.append(e) | self.index[n] = e m[n] = (e[6], n) | def __init__(self, opener, indexfile, datafile): self.indexfile = indexfile self.datafile = datafile self.index = [] self.opener = opener self.cache = None self.nodemap = {nullid: -1} # read the whole index for now, handle on-demand later try: n = 0 i = self.opener(self.indexfile).read() s = struct.calcsize(indexformat... |
except IOError: pass | self.nodemap = dict(m) except IOError: self.nodemap = {} self.nodemap[nullid] = -1 | def __init__(self, opener, indexfile, datafile): self.indexfile = indexfile self.datafile = datafile self.index = [] self.opener = opener self.cache = None self.nodemap = {nullid: -1} # read the whole index for now, handle on-demand later try: n = 0 i = self.opener(self.indexfile).read() s = struct.calcsize(indexformat... |
text = self.patch(text, delta) | text = self.patches(text, [delta]) | def addgroup(self, data, linkmapper, transaction): # given a set of deltas, add them to the revision log. the # first delta is against its parent, which should be in our # log, the rest are against the previous delta. |
if i[:4] != "\0\0\0\0": | if i and i[:4] != "\0\0\0\0": | def __init__(self, opener, indexfile, datafile): """ create a revlog object |
nonpos = [g for g in pos if g[1:] not in guards] | exactpos = [g for g in pos if g[1:] in guards] | def pushable(self, idx): if isinstance(idx, str): idx = self.series.index(idx) patchguards = self.series_guards[idx] if not patchguards: return True, None default = False guards = self.active() exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards] if exactneg: return False, exactneg[0] pos = [g for g i... |
if not nonpos: return True, '' return False, nonpos | if exactpos: return True, exactpos[0] return False, pos | def pushable(self, idx): if isinstance(idx, str): idx = self.series.index(idx) patchguards = self.series_guards[idx] if not patchguards: return True, None default = False guards = self.active() exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards] if exactneg: return False, exactneg[0] pos = [g for g i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.