rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return self._gitnodir(commands, env=env, stream=stream, cwd=self._path) | return self._gitnodir(commands, env=env, stream=stream, cwd=self._abspath) | def _gitdir(self, commands, env=None, stream=False): return self._gitnodir(commands, env=env, stream=stream, cwd=self._path) |
if not os.path.exists('%s/.git' % self._path): | if not os.path.exists(os.path.join(self._abspath, '.git')): | def _fetch(self, source, revision): if not os.path.exists('%s/.git' % self._path): self._ui.status(_('cloning subrepo %s\n') % self._relpath) self._gitnodir(['clone', source, self._path]) if self._githavelocally(revision): return self._ui.status(_('pulling subrepo %s\n') % self._relpath) # first try from origin self._g... |
self._gitnodir(['clone', source, self._path]) | self._gitnodir(['clone', source, self._abspath]) | def _fetch(self, source, revision): if not os.path.exists('%s/.git' % self._path): self._ui.status(_('cloning subrepo %s\n') % self._relpath) self._gitnodir(['clone', source, self._path]) if self._githavelocally(revision): return self._ui.status(_('pulling subrepo %s\n') % self._relpath) # first try from origin self._g... |
(revision, self._path)) | (revision, self._relpath)) | def _fetch(self, source, revision): if not os.path.exists('%s/.git' % self._path): self._ui.status(_('cloning subrepo %s\n') % self._relpath) self._gitnodir(['clone', source, self._path]) if self._githavelocally(revision): return self._ui.status(_('pulling subrepo %s\n') % self._relpath) # first try from origin self._g... |
'it has changes.\n') % self._path) | 'it has changes.\n') % self._relpath) | def remove(self): if self.dirty(): self._ui.warn(_('not removing repo %s because ' 'it has changes.\n') % self._path) return # we can't fully delete the repository as it may contain # local-only history self._ui.note(_('removing subrepo %s\n') % self._path) self._gitcommand(['config', 'core.bare', 'true']) for f in os.... |
self._ui.note(_('removing subrepo %s\n') % self._path) | self._ui.note(_('removing subrepo %s\n') % self._relpath) | def remove(self): if self.dirty(): self._ui.warn(_('not removing repo %s because ' 'it has changes.\n') % self._path) return # we can't fully delete the repository as it may contain # local-only history self._ui.note(_('removing subrepo %s\n') % self._path) self._gitcommand(['config', 'core.bare', 'true']) for f in os.... |
for f in os.listdir(self._path): | for f in os.listdir(self._abspath): | def remove(self): if self.dirty(): self._ui.warn(_('not removing repo %s because ' 'it has changes.\n') % self._path) return # we can't fully delete the repository as it may contain # local-only history self._ui.note(_('removing subrepo %s\n') % self._path) self._gitcommand(['config', 'core.bare', 'true']) for f in os.... |
path = os.path.join(self._path, f) | path = os.path.join(self._abspath, f) | def remove(self): if self.dirty(): self._ui.warn(_('not removing repo %s because ' 'it has changes.\n') % self._path) return # we can't fully delete the repository as it may contain # local-only history self._ui.note(_('removing subrepo %s\n') % self._path) self._gitcommand(['config', 'core.bare', 'true']) for f in os.... |
archiver.addfile(os.path.join(prefix, self._relpath, info.name), | archiver.addfile(os.path.join(prefix, self._path, info.name), | def archive(self, ui, archiver, prefix): source, revision = self._state self._fetch(source, revision) |
if os.path.exists(absdst): | if os.path.lexists(absdst): | def copyfile(src, dst, basedir): abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]] if os.path.exists(absdst): raise util.Abort(_("cannot create %s: destination already exists") % dst) dstdir = os.path.dirname(absdst) if dstdir and not os.path.isdir(dstdir): try: os.makedirs(dstdir) except IOEr... |
bheads = repo.branchheads(branch, start, closed=closed) | bheads = repo.branchheads(b, start, closed=closed) | def heads(ui, repo, *branchrevs, **opts): """show current repository heads or show branch heads With no arguments, show all repository head changesets. Repository "heads" are changesets with no child changesets. They are where development generally takes place and are the usual targets for update and merge operations... |
elif branch != branchrev: ui.warn(_("no changes on branch %s containing %s are " "reachable from %s\n") % (encodedbranch, branchrev, opts.get('rev'))) | def heads(ui, repo, *branchrevs, **opts): """show current repository heads or show branch heads With no arguments, show all repository head changesets. Repository "heads" are changesets with no child changesets. They are where development generally takes place and are the usual targets for update and merge operations... | |
or name.startswith('.mq')): | or name.startswith('.mq') or ' or (os.name == 'nt' and ':' in name)): | def check_reserved_name(self, name): if (name in self._reserved or name.startswith('.hg') or name.startswith('.mq')): raise util.Abort(_('"%s" cannot be used as the name of a patch') % name) |
self.path = patchdir or os.path.join(path, "patches") | try: fh = open(os.path.join(path, '.queue')) curpath = os.path.join(path, fh.read().rstrip()) except IOError: curpath = os.path.join(path, 'patches') self.path = patchdir or curpath | 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_dirty = 0 self.series_dirty = 0 self.series_path = "series" self.status_path = "status" self.guards_path = "guards" self.active_guards = ... |
if listclean: clean += fixup | def bad(f, msg): if f not in ctx1: self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg)) | |
def pathstrip(path, strip): pathlen = len(path) i = 0 if strip == 0: return '', path.rstrip() count = strip while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d of %d dirs from %s") % (count, strip, path)) i += 1 while i < pathlen - 1 and path[i] == '/': i += 1 count -= 1 retu... | def pathstrip(path, strip): pathlen = len(path) i = 0 if strip == 0: return '', path.rstrip() count = strip while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d of %d dirs from %s") % (count, strip, path)) i += 1 # consume '//' in the path while i < pathlen - 1 and path[i] == '... | |
return | return 0 | def push(self, repo, patch=None, force=False, list=False, mergeq=None, all=False, move=False): diffopts = self.diffopts() wlock = repo.wlock() try: heads = [] for b, ls in repo.branchmap().iteritems(): heads += ls if not heads: heads = [nullid] if repo.dirstate.parents()[0] not in heads: self.ui.status(_("(working dire... |
GP_PATCH = 1 << 0 GP_FILTER = 1 << 1 GP_BINARY = 1 << 2 | def extract(ui, fileobj): '''extract patch from data read from fileobj. patch can be a normal patch or contained in an email message. return tuple (filename, message, user, date, branch, node, p1, p2). Any item in the returned tuple can be None. If filename is None, fileobj did not contain a patch. Caller must unlink... | |
dopatch = 0 | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... | |
if gp.op in ('COPY', 'RENAME'): dopatch |= GP_FILTER | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... | |
dopatch |= GP_PATCH | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... | |
dopatch |= GP_BINARY | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... | |
if not gitpatches: dopatch = GP_PATCH return (dopatch, gitpatches) | return gitpatches | def readgitpatch(lr): """extract git-style metadata about patches from <patchname>""" # Filter patch for git information gp = None gitpatches = [] # Can have a git patch with only metadata, causing patch to complain dopatch = 0 lineno = 0 for line in lr: lineno += 1 line = line.rstrip(' \r\n') if line.startswith('dif... |
(dopatch, gitpatches) = readgitpatch(gitlr) | gitpatches = readgitpatch(gitlr) | def scangitpatch(lr, firstline): """ Git patches can emit: - rename a to b - change b - copy a to c - change c We cannot apply this sequence as-is, the renamed 'a' could not be found for it would have been renamed already. And we cannot copy from 'b' instead because 'b' would have been changed already. So we scan the ... |
return dopatch, gitpatches | return gitpatches | def scangitpatch(lr, firstline): """ Git patches can emit: - rename a to b - change b - copy a to c - change c We cannot apply this sequence as-is, the renamed 'a' could not be found for it would have been renamed already. And we cannot copy from 'b' instead because 'b' would have been changed already. So we scan the ... |
gitpatches = scangitpatch(lr, x)[1] | gitpatches = scangitpatch(lr, x) | def iterhunks(ui, fp, sourcefile=None): """Read a patch and yield the following events: - ("file", afile, bfile, firsthunk): select a new target file. - ("hunk", hunk): a new hunk is ready to be applied, follows a "file" event. - ("git", gitchanges): current diff is in git format, gitchanges maps filenames to gitpatch ... |
if x[0] == 'string' or x[0] == 'symbol': | if x and (x[0] == 'string' or x[0] == 'symbol'): | def getstring(x, err): if x[0] == 'string' or x[0] == 'symbol': return x[1] raise error.ParseError(err) |
pat = getstring(x, _("file wants a pattern")) | pat = getstring(x, _("contains wants a pattern")) | def contains(repo, subset, x): pat = getstring(x, _("file wants a pattern")) m = _match.match(repo.root, repo.getcwd(), [pat]) s = [] if m.files() == [pat]: for r in subset: if pat in repo[r]: s.append(r) continue else: for r in subset: for f in repo[r].manifest(): if m(f): s.append(r) continue return s |
blocks = debug(prunecontainers, blocks, sys.argv[2:]) | blocks, pruned = debug(prunecontainers, blocks, sys.argv[2:]) | def debug(func, *args): blocks = func(*args) print "*** after %s:" % func.__name__ pprint(blocks) print return blocks |
for i in xrange(self.p.l): ret = self.p.index[i] | for i, ret in enumerate(self.p.index): | def __iter__(self): yield nullid for i in xrange(self.p.l): ret = self.p.index[i] if not ret: self.p.loadindex(i) ret = self.p.index[i] if isinstance(ret, str): ret = _unpack(indexformatng, ret) yield ret[7] |
elif spec in repo: | elif spec and spec in repo: | def revfix(repo, val, defval): if not val and val != 0 and defval is not None: return defval return repo.changelog.rev(repo.lookup(val)) |
self.conn = MySQLdb.connect(host=host, user=user, passwd=passwd, | self.conn = mysqldb.connect(host=host, user=user, passwd=passwd, | def __init__(self, ui): self.ui = ui host = self.ui.config('bugzilla', 'host', 'localhost') user = self.ui.config('bugzilla', 'user', 'bugs') passwd = self.ui.config('bugzilla', 'password') db = self.ui.config('bugzilla', 'db', 'bugs') timeout = int(self.ui.config('bugzilla', 'timeout', 5)) usermap = self.ui.config('bu... |
except MySQLdb.MySQLError: | except mysqldb.MySQLError: | def run(self, *args, **kwargs): '''run a query.''' self.ui.note(_('query: %s %s\n') % (args, kwargs)) try: self.cursor.execute(*args, **kwargs) except MySQLdb.MySQLError: self.ui.note(_('failed query: %s %s\n') % (args, kwargs)) raise |
return '"%s"' % jsonescape(obj) | u = unicode(obj, encoding.encoding, 'replace') return '"%s"' % jsonescape(u).encode('utf-8') | def json(obj): if obj is None or obj is False or obj is True: return {None: 'null', False: 'false', True: 'true'}[obj] elif isinstance(obj, int) or isinstance(obj, float): return str(obj) elif isinstance(obj, str): return '"%s"' % jsonescape(obj) elif isinstance(obj, unicode): return json(obj.encode('utf-8')) elif hasa... |
return json(obj.encode('utf-8')) | return '"%s"' % jsonescape(obj).encode('utf-8') | def json(obj): if obj is None or obj is False or obj is True: return {None: 'null', False: 'false', True: 'true'}[obj] elif isinstance(obj, int) or isinstance(obj, float): return str(obj) elif isinstance(obj, str): return '"%s"' % jsonescape(obj) elif isinstance(obj, unicode): return json(obj.encode('utf-8')) elif hasa... |
pass | return True | def push(self, force): # nothing for svn pass |
added those changes to the repository, you should use pull -r X | add those changes to the repository, you should use pull -r X | 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 a local repository (the current one unless -R is specified). By default, this does not ... |
You can specify a set of files to operate on, or use the -a/-all | You can specify a set of files to operate on, or use the -a/--all | def resolve(ui, repo, *pats, **opts): """retry file merges from a merge or update This command can cleanly retry unresolved file merges using file revisions preserved from the last update or merge. If a conflict is resolved manually, please note that the changes will be overwritten if the merge is retried with resolv... |
dest = l[1:] or '' | dest = l and getstring(l[0], _("outgoing wants a repository path")) or '' | def outgoing(repo, subset, x): import hg # avoid start-up nasties l = getargs(x, 0, 1, _("outgoing wants a repository path")) dest = l[1:] or '' dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest) other = hg.repository(hg.remoteui(repo, {}), dest) repo.ui.pushbuffer()... |
'cleverencode': tolf, 'cleverdecode': tocrlf | 'cleverencode:': tolf, 'cleverdecode:': tocrlf | def isbinary(s, params): """Filter to do nothing with the file.""" return s |
repopath = cmdutil.findrepo(os.getcwd()) | if args: repopath = args[0] if not hg.islocal(repopath): raise util.Abort(_('only a local queue repository ' 'may be initialized')) else: repopath = cmdutil.findrepo(os.getcwd()) if not repopath: raise util.Abort(_('There is no Mercurial repository here ' '(.hg not found)')) | def mqinit(orig, ui, *args, **kwargs): mq = kwargs.pop('mq', None) if not mq: return orig(ui, *args, **kwargs) repopath = cmdutil.findrepo(os.getcwd()) repo = hg.repository(ui, repopath) return qinit(ui, repo, True) |
try: n, name = l.split(':', 1) except ValueError: | n, name = l.split(':', 1) if n: applied.append(statusentry(bin(n), name)) else: | def restore(self, repo, rev, delete=None, qupdate=None): desc = repo[rev].description().strip() lines = desc.splitlines() i = 0 datastart = None series = [] applied = [] qpp = None for i, line in enumerate(lines): if line == 'Patch Data:': datastart = i + 1 elif line.startswith('Dirstate:'): l = line.rstrip() l = l[10:... |
else: applied.append(statusentry(bin(n), name)) | def restore(self, repo, rev, delete=None, qupdate=None): desc = repo[rev].description().strip() lines = desc.splitlines() i = 0 datastart = None series = [] applied = [] qpp = None for i, line in enumerate(lines): if line == 'Patch Data:': datastart = i + 1 elif line.startswith('Dirstate:'): l = line.rstrip() l = l[10:... | |
ui.status(_("Checking extensions...\n")) | ui.status(_("Checking installed modules (%s)...\n") % os.path.dirname(__file__)) | def writetemp(contents): (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") f = os.fdopen(fd, "wb") f.write(contents) f.close() return name |
import bdiff, mpatch, base85 | import bdiff, mpatch, base85, osutil | def writetemp(contents): (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") f = os.fdopen(fd, "wb") f.write(contents) f.close() return name |
return util.checksignature(self.fn)(ui, *args, **opts) | try: util.checksignature(self.fn)(ui, *args, **opts) except error.SignatureError: args = ' '.join([self.cmdname] + self.args) ui.debug("alias '%s' expands to '%s'\n" % (self.name, args)) raise | def __call__(self, ui, *args, **opts): if self.shadows: ui.debug("alias '%s' shadows command '%s'\n" % (self.name, self.cmdname)) |
branch = lrepo.dirstate.branch() butf8 = encoding.fromlocal(branch) | butf8 = lrepo.dirstate.branch() branch = encoding.tolocal(butf8) else: butf8 = encoding.fromlocal(branch) | def addbranchrevs(lrepo, repo, branches, revs): if not branches: return revs or None, revs and revs[0] or None revs = revs and list(revs) or [] if not repo.capable('branchmap'): revs.extend(branches) return revs, revs[0] branchmap = repo.branchmap() for branch in branches: if branch == '.': if not lrepo or not lrepo.lo... |
revert will partially overwrite content in the working | Revert will partially overwrite content in the working | def revert(ui, repo, *pats, **opts): """restore individual files or directories to an earlier state .. note:: This command is most likely not what you are looking for. revert will partially overwrite content in the working directory without changing the working directory parents. Use :hg:`update -r rev` to check out e... |
del self.full_series[self.full_series.index(patch, start)] | index = self.series.index(patch, start) fullpatch = self.full_series[index] del self.full_series[index] | def push(self, repo, patch=None, force=False, list=False, mergeq=None, all=False, move=False): diffopts = self.diffopts() wlock = repo.wlock() try: heads = [] for b, ls in repo.branchmap().iteritems(): heads += ls if not heads: heads = [nullid] if repo.dirstate.parents()[0] not in heads: self.ui.status(_("(working dire... |
self.full_series.insert(start, patch) | self.full_series.insert(start, fullpatch) | def push(self, repo, patch=None, force=False, list=False, mergeq=None, all=False, move=False): diffopts = self.diffopts() wlock = repo.wlock() try: heads = [] for b, ls in repo.branchmap().iteritems(): heads += ls if not heads: heads = [nullid] if repo.dirstate.parents()[0] not in heads: self.ui.status(_("(working dire... |
if self.mq.applied and not force and not revs: raise util.Abort(_('source has mq patches applied')) | if self.mq.applied and not force: haspatches = True if revs: applied = set(e.node for e in self.mq.applied) haspatches = bool([n for n in revs if n in applied]) if haspatches: raise util.Abort(_('source has mq patches applied')) | def push(self, remote, force=False, revs=None, newbranch=False): if self.mq.applied and not force and not revs: raise util.Abort(_('source has mq patches applied')) return super(mqrepo, self).push(remote, force, revs, newbranch) |
The names 'default' and 'default-push' have a special meaning. They are the locations used when pulling and pushing respectively unless a location is specified. When cloning a repository, the clone source is written as 'default' in .hg/hgrc. | The path names ``default`` and ``default-push`` have a special meaning. When performing a push or pull operation, they are used as fallbacks if no location is specified on the command-line. When ``default-push`` is set, it will be used for push and ``default`` will be used for pull; otherwise ``default`` is used as th... | def paths(ui, repo, search=None): """show aliases for remote repositories Show definition of symbolic path name NAME. If no name is given, show definition of all available names. Path names are defined in the [paths] section of /etc/mercurial/hgrc and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. T... |
elif c in '"\'': | elif (c in '"\'' or c == 'r' and program[pos:pos + 2] in ("r'", 'r"')): if c == 'r': pos += 1 c = program[pos] decode = lambda x: x else: decode = lambda x: x.decode('string-escape') | def tokenize(program): pos, l = 0, len(program) while pos < l: c = program[pos] if c.isspace(): # skip inter-token whitespace pass elif c == ':' and program[pos:pos + 2] == '::': # look ahead carefully yield ('::', None, pos) pos += 1 # skip ahead elif c == '.' and program[pos:pos + 2] == '..': # look ahead carefully y... |
yield ('string', program[s:pos].decode('string-escape'), s) | yield ('string', decode(program[s:pos]), s) | def tokenize(program): pos, l = 0, len(program) while pos < l: c = program[pos] if c.isspace(): # skip inter-token whitespace pass elif c == ':' and program[pos:pos + 2] == '::': # look ahead carefully yield ('::', None, pos) pos += 1 # skip ahead elif c == '.' and program[pos:pos + 2] == '..': # look ahead carefully y... |
if p and "://" not in p and not os.path.isabs(p): c.set("paths", n, os.path.normpath(os.path.join(root, p))) | if not p: continue if '%%' in p: self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") % (n, p, self.configsource('paths', n))) p = p.replace('%%', '%') p = util.expandpath(p) if '://' not in p and not os.path.isabs(p): p = os.path.normpath(os.path.join(root, p)) c.set("paths", n, p) | def fixconfig(self, root=None): # translate paths relative to root (or home) into absolute paths root = root or os.getcwd() for c in self._tcfg, self._ucfg, self._ocfg: for n, p in c.items('paths'): if p and "://" not in p and not os.path.isabs(p): c.set("paths", n, os.path.normpath(os.path.join(root, p))) |
def _path(self, loc): p = self.config('paths', loc) if p: if '%%' in p: self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") % (loc, p, self.configsource('paths', loc))) p = p.replace('%%', '%') p = util.expandpath(p) return p | def _path(self, loc): p = self.config('paths', loc) if p: if '%%' in p: self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") % (loc, p, self.configsource('paths', loc))) p = p.replace('%%', '%') p = util.expandpath(p) return p | |
path = self._path(loc) | path = self.config('paths', loc) | def expandpath(self, loc, default=None): """Return repository location relative to cwd or from [paths]""" if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')): return loc |
path = self._path(default) | path = self.config('paths', default) | def expandpath(self, loc, default=None): """Return repository location relative to cwd or from [paths]""" if "://" in loc or os.path.isdir(os.path.join(loc, '.hg')): return loc |
if missing and afile == bfile: | abasedir = afile[:afile.rfind('/') + 1] bbasedir = bfile[:bfile.rfind('/') + 1] if missing and abasedir == bbasedir and afile.startswith(bfile): | def pathstrip(path, count=1): pathlen = len(path) i = 0 if count == 0: return '', path.rstrip() while count > 0: i = path.find('/', i) if i == -1: raise PatchError(_("unable to strip away %d dirs from %s") % (count, path)) i += 1 # consume '//' in the path while i < pathlen - 1 and path[i] == '/': i += 1 count -= 1 ret... |
if not childpath: continue if childpath in copies: del copies[childpath] entries.append(childpath) | if childpath: entries.append(childpath) | def expandpaths(self, rev, paths, parents): entries = [] # Map of entrypath, revision for finding source of deleted # revisions. copyfrom = {} copies = {} |
referenced patch is a git patch. | referenced patch is a git patch and should be preserved as such. | def patchopts(self, diffopts, *patches): """Return a copy of input diff options with git set to true if referenced patch is a git patch. """ diffopts = diffopts.copy() for patchfn in patches: patchf = self.opener(patchfn, 'r') # if the patch was a git patch, refresh it as a git patch for line in patchf: if line.startsw... |
for patchfn in patches: patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): diffopts.git = True break patchf.close() | if not diffopts.git and self.gitmode == 'keep': for patchfn in patches: patchf = self.opener(patchfn, 'r') for line in patchf: if line.startswith('diff --git'): diffopts.git = True break patchf.close() | def patchopts(self, diffopts, *patches): """Return a copy of input diff options with git set to true if referenced patch is a git patch. """ diffopts = diffopts.copy() for patchfn in patches: patchf = self.opener(patchfn, 'r') # if the patch was a git patch, refresh it as a git patch for line in patchf: if line.startsw... |
if diffopts.git: | if diffopts.git or diffopts.upgrade: | def refresh(self, repo, pats=None, **opts): if len(self.applied) == 0: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() newuser = opts.get('user') newdate = opts.get('date') if newdate: newdate = '%d %d' % util.parsedate(newdate) wlock = repo.wlock() try: self.check_toppatch(repo) (t... |
extra = {'rebase_source': repo[rev].hex()} if extrafn: extrafn(repo[rev], extra) newrev = concludenode(repo, rev, p1, p2, extra=extra) | newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn) | def extrafn(ctx, extra): extra['branch'] = ctx.branch() |
extra=extrafn) | extrafn=extrafn) | def extrafn(ctx, extra): extra['branch'] = ctx.branch() |
def concludenode(repo, rev, p1, p2, commitmsg=None, extra=None): | def concludenode(repo, rev, p1, p2, commitmsg=None, extrafn=None): | def concludenode(repo, rev, p1, p2, commitmsg=None, extra=None): 'Commit the changes and store useful information in extra' try: repo.dirstate.setparents(repo[p1].node(), repo[p2].node()) if commitmsg is None: commitmsg = repo[rev].description() if extra is None: extra = {} # Commit might fail if unresolved files exist... |
if extra is None: extra = {} | ctx = repo[rev] extra = {'rebase_source': ctx.hex()} if extrafn: extrafn(ctx, extra) | def concludenode(repo, rev, p1, p2, commitmsg=None, extra=None): 'Commit the changes and store useful information in extra' try: repo.dirstate.setparents(repo[p1].node(), repo[p2].node()) if commitmsg is None: commitmsg = repo[rev].description() if extra is None: extra = {} # Commit might fail if unresolved files exist... |
newrev = repo.commit(text=commitmsg, user=repo[rev].user(), date=repo[rev].date(), extra=extra) | newrev = repo.commit(text=commitmsg, user=ctx.user(), date=ctx.date(), extra=extra) | def concludenode(repo, rev, p1, p2, commitmsg=None, extra=None): 'Commit the changes and store useful information in extra' try: repo.dirstate.setparents(repo[p1].node(), repo[p2].node()) if commitmsg is None: commitmsg = repo[rev].description() if extra is None: extra = {} # Commit might fail if unresolved files exist... |
rfd, wfd = os.pipe() if not runargs: runargs = sys.argv[:] runargs.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) for i in xrange(1,len(runargs)): if runargs[i].startswith('--cwd='): del runargs[i] break elif runargs[i].startswith('--cwd'): del runargs[i:i+2] break pid = util.spawndetached(runargs) os.close(wfd) os.re... | lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') os.close(lockfd) try: if not runargs: runargs = sys.argv[:] runargs.append('--daemon-pipefds=%s' % lockpath) for i in xrange(1,len(runargs)): if runargs[i].startswith('--cwd='): del runargs[i] break elif runargs[i].startswith('--cwd'): del runargs[i:i+2] break... | def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None, runargs=None, appendpid=False): '''Run a command as a service.''' if opts['daemon'] and not opts['daemon_pipefds']: rfd, wfd = os.pipe() if not runargs: runargs = sys.argv[:] runargs.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) # Don't pass --cwd... |
rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')] os.close(rfd) | lockpath = opts['daemon_pipefds'] | def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None, runargs=None, appendpid=False): '''Run a command as a service.''' if opts['daemon'] and not opts['daemon_pipefds']: rfd, wfd = os.pipe() if not runargs: runargs = sys.argv[:] runargs.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) # Don't pass --cwd... |
os.write(wfd, 'y') os.close(wfd) | os.unlink(lockpath) | def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None, runargs=None, appendpid=False): '''Run a command as a service.''' if opts['daemon'] and not opts['daemon_pipefds']: rfd, wfd = os.pipe() if not runargs: runargs = sys.argv[:] runargs.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) # Don't pass --cwd... |
lui.readconfig(os.path.join(path, ".hg", "hgrc")) | lui.readconfig(os.path.join(path, ".hg", "hgrc"), path) | def _getlocal(ui, rpath): """Return (path, local ui object) for the given target path. Takes paths in [cwd]/.hg/hgrc into account." """ try: wd = os.getcwd() except OSError, e: raise util.Abort(_("error getting current working directory: %s") % e.strerror) path = cmdutil.findrepo(wd) or "" if not path: lui = ui else: ... |
diff = patch.diff(repo, ctx.parents()[0].node(), ctx.node()) | def showdiffstat(repo, ctx, templ, **args): diff = patch.diff(repo, ctx.parents()[0].node(), ctx.node()) files, adds, removes = 0, 0, 0 for i in patch.diffstatdata(util.iterlines(diff)): files += 1 adds += i[1] removes += i[2] return '%s: +%s/-%s' % (files, adds, removes) | |
for i in patch.diffstatdata(util.iterlines(diff)): | for i in patch.diffstatdata(util.iterlines(ctx.diff())): | def showdiffstat(repo, ctx, templ, **args): diff = patch.diff(repo, ctx.parents()[0].node(), ctx.node()) files, adds, removes = 0, 0, 0 for i in patch.diffstatdata(util.iterlines(diff)): files += 1 adds += i[1] removes += i[2] return '%s: +%s/-%s' % (files, adds, removes) |
self.conn = mysqldb.connect(host=host, user=user, passwd=passwd, | self.conn = MySQLdb.connect(host=host, user=user, passwd=passwd, | def __init__(self, ui): self.ui = ui host = self.ui.config('bugzilla', 'host', 'localhost') user = self.ui.config('bugzilla', 'user', 'bugs') passwd = self.ui.config('bugzilla', 'password') db = self.ui.config('bugzilla', 'db', 'bugs') timeout = int(self.ui.config('bugzilla', 'timeout', 5)) usermap = self.ui.config('bu... |
except mysqldb.MySQLError: | except MySQLdb.MySQLError: | def run(self, *args, **kwargs): '''run a query.''' self.ui.note(_('query: %s %s\n') % (args, kwargs)) try: self.cursor.execute(*args, **kwargs) except mysqldb.MySQLError: self.ui.note(_('failed query: %s %s\n') % (args, kwargs)) raise |
if bheads and [x for x in parents if x.node() not in bheads and x.branch() == branch]: | if bheads and not [x for x in parents if x.node() in bheads and x.branch() == branch]: | def commitfunc(ui, repo, message, match, opts): return repo.commit(message, opts.get('user'), opts.get('date'), match, editor=e, extra=extra) |
r'(---|\*\*\*)[ \t])', re.MULTILINE) | r'(---|\*\*\*)[ \t].*?' r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL) | def extract(ui, fileobj): '''extract patch from data read from fileobj. patch can be a normal patch or contained in an email message. return tuple (filename, message, user, date, node, p1, p2). Any item in the returned tuple can be None. If filename is None, fileobj did not contain a patch. Caller must unlink filenam... |
try: | if sys.version_info >= (2, 5): | def _fastsha1(s): # This function will import sha1 from hashlib or sha (whichever is # available) and overwrite itself with it on the first call. # Subsequent calls will go directly to the imported function. try: from hashlib import sha1 as _sha1 except ImportError: from sha import sha as _sha1 global _fastsha1, sha1 _... |
except ImportError: | else: | def _fastsha1(s): # This function will import sha1 from hashlib or sha (whichever is # available) and overwrite itself with it on the first call. # Subsequent calls will go directly to the imported function. try: from hashlib import sha1 as _sha1 except ImportError: from sha import sha as _sha1 global _fastsha1, sha1 _... |
def close(self): self.write() self.write_rej() | def write(self, dest=None): if not self.dirty: return if not dest: dest = self.fname self.writelines(dest, self.lines) | |
current_file.close() | current_file.write() current_file.write_rej() | def closefile(): if not current_file: return 0 current_file.close() return len(current_file.rej) |
revs.append(lrepo.dirstate.branch()) | branch = lrepo.dirstate.branch() butf8 = encoding.fromlocal(branch) if butf8 in branchmap: revs.extend(node.hex(r) for r in reversed(branchmap[butf8])) | def addbranchrevs(lrepo, repo, branches, revs): if not branches: return revs or None, revs and revs[0] or None revs = revs and list(revs) or [] if not repo.capable('branchmap'): revs.extend(branches) return revs, revs[0] branchmap = repo.branchmap() for branch in branches: if branch == '.': if not lrepo or not lrepo.lo... |
butf8 = encoding.fromlocal(branch) if butf8 in branchmap: revs.extend(node.hex(r) for r in reversed(branchmap[butf8])) else: revs.append(branch) | revs.append(branch) | def addbranchrevs(lrepo, repo, branches, revs): if not branches: return revs or None, revs and revs[0] or None revs = revs and list(revs) or [] if not repo.capable('branchmap'): revs.extend(branches) return revs, revs[0] branchmap = repo.branchmap() for branch in branches: if branch == '.': if not lrepo or not lrepo.lo... |
if of == f or of == c2.path(): | if cr and (of == f or of == c2.path()): | def checkcopies(f, m1, m2): '''check possible copies of f from m1 to m2''' of = None seen = set([f]) for oc in ctx(f, m1[f]).ancestors(): ocr = oc.rev() of = oc.path() if of in seen: # check limit late - grab last rename before if ocr < limit: break continue seen.add(of) |
if cmp(s, found) == 0: | if s == found: | def advance(i, c): while i < lenm and m[i] != c: i += 1 return i |
if type_ == '?' and self.dirstate._ignore(fn): | if type_ == '?' and self.dirstate._dirignore(fn): | def filestatus(self, fn, st): try: type_, mode, size, time = self.dirstate._map[fn][:4] except KeyError: type_ = '?' if type_ == 'n': st_mode, st_size, st_mtime = st if size == -1: return 'l' if size and (size != st_size or (mode ^ st_mode) & 0100): return 'm' if time != int(st_mtime): return 'l' return 'n' if type_ ==... |
def debugindex(ui, repo, file_): | def debugindex(ui, repo, file_, **opts): | def debugindex(ui, repo, file_): """dump the contents of an index file""" r = None if repo: filelog = repo.file(file_) if len(filelog): r = filelog if not r: r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") for i in r: ... |
ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") | if format == 0: ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") elif format == 1: ui.write(" rev flag offset length" " size base link p1 p2 nodeid\n") | def debugindex(ui, repo, file_): """dump the contents of an index file""" r = None if repo: filelog = repo.file(file_) if len(filelog): r = filelog if not r: r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") for i in r: ... |
try: pp = r.parents(node) except: pp = [nullid, nullid] ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( i, r.start(i), r.length(i), r.base(i), r.linkrev(i), short(node), short(pp[0]), short(pp[1]))) | if format == 0: try: pp = r.parents(node) except: pp = [nullid, nullid] ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( i, r.start(i), r.length(i), r.base(i), r.linkrev(i), short(node), short(pp[0]), short(pp[1]))) elif format == 1: pr = r.parentrevs(i) ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ... | def debugindex(ui, repo, file_): """dump the contents of an index file""" r = None if repo: filelog = repo.file(file_) if len(filelog): r = filelog if not r: r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) ui.write(" rev offset length base linkrev" " nodeid p1 p2\n") for i in r: ... |
"debugindex": (debugindex, [], _('FILE')), | "debugindex": (debugindex, [('f', 'format', 0, _('revlog format'), _('FORMAT'))], _('FILE')), | def version_(ui): """output version and copyright information""" ui.write(_("Mercurial Distributed SCM (version %s)\n") % util.version()) ui.status(_( "(see http://mercurial.selenic.com for more information)\n" "\nCopyright (C) 2005-2010 Matt Mackall and others\n" "This is free software; see the source for copying cond... |
if not hasattr(__builtin__, 'buffer'): | try: buffer except NameError: | def fakebuffer(sliceable, offset=0): return sliceable[offset:] |
return parent + '/' + source return os.path.join(parent, repo._subsource) | r = urlparse.urlparse(parent + '/' + source) r = urlparse.urlunparse((r[0], r[1], posixpath.normpath(r.path), r[3], r[4], r[5])) return r return posixpath.normpath(os.path.join(parent, repo._subsource)) | def _abssource(repo, push=False): if hasattr(repo, '_subparent'): source = repo._subsource if source.startswith('/') or '://' in source: return source parent = _abssource(repo._subparent, push) if '://' in parent: if parent[-1] == '/': parent = parent[:-1] return parent + '/' + source return os.path.join(parent, repo._... |
self.doneheader = False | def __init__(self, ui, repo, patch, diffopts, buffered): self.ui = ui self.repo = repo self.buffered = buffered self.patch = patch self.diffopts = diffopts self.header = {} self.doneheader = False self.hunk = {} self.lastheader = None self.footer = None | |
if not self.doneheader: | if self.lastheader != h: self.lastheader = h | def showparents(**args): ctx = args['ctx'] parents = [[('rev', p.rev()), ('node', p.hex())] for p in self._meaningful_parentrevs(ctx)] return showlist('parent', parents, **args) |
self.doneheader = True | def showparents(**args): ctx = args['ctx'] parents = [[('rev', p.rev()), ('node', p.hex())] for p in self._meaningful_parentrevs(ctx)] return showlist('parent', parents, **args) | |
self.sock = _ssl_wrap_socket(self.sock, self.cert_file, self.key_file) | self.sock = _ssl_wrap_socket(self.sock, self.key_file, self.cert_file) | def connect(self): if self.realhostport: # use CONNECT proxy self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) if _generic_proxytunnel(self): self.sock = _ssl_wrap_socket(self.sock, self.cert_file, self.key_file) else: BetterHTTPS.connect(self) |
return ff(orig) | return ff(path) | def findflag(ctx): mnode = ctx.changeset()[0] node, flag = self._repo.manifest.find(mnode, orig) ff = self._repo.dirstate.flagfunc(lambda x: flag or None) try: return ff(orig) except OSError: pass |
elif op in 'rangepre rangepost dagrangepre dagrangepost': wa, ta = optimize(x[1], small) return wa + 1, (op, ta) | def optimize(x, small): if x == None: return 0, x smallbonus = 1 if small: smallbonus = .5 op = x[0] if op == '-': return optimize(('and', x[1], ('not', x[2])), small) elif op == 'dagrange': return optimize(('and', ('func', ('symbol', 'descendants'), x[1]), ('func', ('symbol', 'ancestors'), x[2])), small) elif op == ... | |
patch = patch and str(patch) | def lookup(self, patch, strict=False): patch = patch and str(patch) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.