Mercurial > hg
changeset 3134:abd9a05fca0b
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 19 Sep 2006 15:28:13 -0500 |
parents | 4bf2e895cf86 (current diff) 15fde1970003 (diff) |
children | b1db258e875c |
files | mercurial/context.py |
diffstat | 10 files changed, 62 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/extdiff.py Tue Sep 19 14:58:54 2006 -0500 +++ b/hgext/extdiff.py Tue Sep 19 15:28:13 2006 -0500 @@ -23,13 +23,19 @@ # # add new command that runs GNU diff(1) in 'context diff' mode # cmd.cdiff = gdiff # opts.cdiff = -Nprc5 + # # add new command called vdiff, runs kdiff3 # cmd.vdiff = kdiff3 + # # add new command called meld, runs meld (no need to name twice) # cmd.meld = + # # add new command called vimdiff, runs gvimdiff with DirDiff plugin # #(see http://www.vim.org/scripts/script.php?script_id=102) -# cmd.vimdiff = LC_ALL=C gvim -f '+bdel 1 2' '+ execute "DirDiff ".argv(0)." ".argv(1)' +# # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in +# # your .vimrc +# cmd.vimdiff = gvim +# opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)' # # Each custom diff commands can have two parts: a `cmd' and an `opts' # part. The cmd.xxx option defines the name of an executable program @@ -131,8 +137,12 @@ specified then that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.''' - return dodiff(ui, repo, opts['program'] or 'diff', - opts['option'] or ['-Npru'], pats, opts) + program = opts['program'] or 'diff' + if opts['program']: + option = opts['option'] + else: + option = opts['option'] or ['-Npru'] + return dodiff(ui, repo, program, option, pats, opts) cmdtable = { "extdiff":
--- a/hgext/mq.py Tue Sep 19 14:58:54 2006 -0500 +++ b/hgext/mq.py Tue Sep 19 15:28:13 2006 -0500 @@ -1276,39 +1276,40 @@ self.ui.write("No patches applied\n") return 1 - def qimport(self, repo, files, patch=None, existing=None, force=None): - if len(files) > 1 and patch: + def qimport(self, repo, files, patchname=None, existing=None, force=None): + if len(files) > 1 and patchname: raise util.Abort(_('option "-n" not valid when importing multiple ' 'files')) i = 0 added = [] for filename in files: if existing: - if not patch: - patch = filename - if not os.path.isfile(self.join(patch)): - raise util.Abort(_("patch %s does not exist") % patch) + if not patchname: + patchname = filename + if not os.path.isfile(self.join(patchname)): + raise util.Abort(_("patch %s does not exist") % patchname) else: try: text = file(filename).read() except IOError: - raise util.Abort(_("unable to read %s") % patch) - if not patch: - patch = os.path.split(filename)[1] - if not force and os.path.exists(self.join(patch)): - raise util.Abort(_('patch "%s" already exists') % patch) - patchf = self.opener(patch, "w") + raise util.Abort(_("unable to read %s") % patchname) + if not patchname: + patchname = os.path.basename(filename) + if not force and os.path.exists(self.join(patchname)): + raise util.Abort(_('patch "%s" already exists') + % patchname) + patchf = self.opener(patchname, "w") patchf.write(text) - if patch in self.series: + if patchname in self.series: raise util.Abort(_('patch %s is already in the series file') - % patch) + % patchname) index = self.full_series_end() + i - self.full_series[index:index] = [patch] + self.full_series[index:index] = [patchname] self.parse_series() - self.ui.warn("adding %s to series file\n" % patch) + self.ui.warn("adding %s to series file\n" % patchname) i += 1 - added.append(patch) - patch = None + added.append(patchname) + patchname = None self.series_dirty = 1 qrepo = self.qrepo() if qrepo: @@ -1344,7 +1345,7 @@ def qimport(ui, repo, *filename, **opts): """import a patch""" q = repo.mq - q.qimport(repo, filename, patch=opts['name'], + q.qimport(repo, filename, patchname=opts['name'], existing=opts['existing'], force=opts['force']) q.save_dirty() return 0
--- a/mercurial/commands.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/commands.py Tue Sep 19 15:28:13 2006 -0500 @@ -50,21 +50,6 @@ (logfile, inst.strerror)) return message -def defaultrev(repo, rev=None, default='tip'): - """returns rev if it is specified, otherwise the working dir - parent if there is only one, or tip if there is no working - dir""" - if rev: - return rev - - p1, p2 = repo.dirstate.parents() - if p2 != nullid: - raise util.Abort(_('uncommitted merge - please provide a ' - 'specific revision')) - if p1 != nullid: - return hex(p1) - return default - def walkchangerevs(ui, repo, pats, opts): '''Iterate over files and the revs they changed in. @@ -114,7 +99,7 @@ return [], False, matchfn if follow: - defrange = '%s:0' % defaultrev(repo) + defrange = '%s:0' % repo.changectx().rev() else: defrange = 'tip:0' revs = map(int, cmdutil.revrange(ui, repo, opts['rev'] or [defrange])) @@ -646,7 +631,7 @@ if not opts['user'] and not opts['changeset'] and not opts['date']: opts['number'] = 1 - ctx = repo.changectx(defaultrev(repo, opts['rev'])) + ctx = repo.changectx(opts['rev']) for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=ctx.node()): @@ -693,7 +678,7 @@ The default is the basename of the archive, with suffixes removed. ''' - node = repo.lookup(defaultrev(repo, opts['rev'])) + node = repo.changectx(opts['rev']).node() dest = cmdutil.make_filename(repo, dest, node) if os.path.realpath(dest) == repo.root: raise util.Abort(_('repository root cannot be destination')) @@ -810,7 +795,7 @@ %d dirname of file being printed, or '.' if in repo root %p root-relative path name of file being printed """ - ctx = repo.changectx(defaultrev(repo, opts['rev'])) + ctx = repo.changectx(opts['rev']) for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts, ctx.node()): fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs) @@ -2228,7 +2213,10 @@ 'use --all to revert the whole repo')) parent, p2 = repo.dirstate.parents() - node = repo.lookup(defaultrev(repo, opts['rev'])) + if not opts['rev'] and p2 != nullid: + raise util.Abort(_('uncommitted merge - please provide a ' + 'specific revision')) + node = repo.changectx(opts['rev']).node() mf = repo.manifest.read(repo.changelog.read(node)[0]) if node == parent: pmf = mf @@ -2528,10 +2516,10 @@ raise util.Abort(_("use only one form to specify the revision")) if opts['rev']: rev_ = opts['rev'] - r = defaultrev(repo, rev_, nullid) - if r == nullid: - raise util.Abort(_('no revision to tag')) - r = repo.lookup(r) + if not rev_ and repo.dirstate.parents()[1] != nullid: + raise util.Abort(_('uncommitted merge - please provide a ' + 'specific revision')) + r = repo.changectx(rev_).node() message = opts['message'] if not message:
--- a/mercurial/context.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/context.py Tue Sep 19 15:28:13 2006 -0500 @@ -12,10 +12,19 @@ class changectx(object): """A changecontext object makes access to data related to a particular changeset convenient.""" - def __init__(self, repo, changeid): + def __init__(self, repo, changeid=None): """changeid is a revision number, node, or tag""" self._repo = repo + if not changeid: + p1, p2 = self._repo.dirstate.parents() + self._rev = self._repo.changelog.rev(p1) + if self._rev == -1: + changeid = 'tip' + else: + self._node = p1 + return + self._node = self._repo.lookup(changeid) self._rev = self._repo.changelog.rev(self._node)
--- a/mercurial/hgweb/hgweb_mod.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/hgweb/hgweb_mod.py Tue Sep 19 15:28:13 2006 -0500 @@ -825,7 +825,6 @@ req.write(resp) def do_between(self, req): - nodes = [] if req.form.has_key('pairs'): pairs = [map(bin, p.split("-")) for p in req.form['pairs'][0].split(" ")]
--- a/mercurial/hgweb/server.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/hgweb/server.py Tue Sep 19 15:28:13 2006 -0500 @@ -30,9 +30,9 @@ self.handler = handler def flush(self): pass - def write(str): + def write(self, str): self.writelines(str.split('\n')) - def writelines(seq): + def writelines(self, seq): for msg in seq: self.handler.log_error("HG error: %s", msg)
--- a/mercurial/httprepo.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/httprepo.py Tue Sep 19 15:28:13 2006 -0500 @@ -131,7 +131,7 @@ self.ui = ui proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') - proxyauthinfo = None + # XXX proxyauthinfo = None handler = httphandler() if proxyurl: @@ -288,14 +288,13 @@ def changegroup(self, nodes, kind): n = " ".join(map(hex, nodes)) f = self.do_cmd("changegroup", roots=n) - bytes = 0 def zgenerator(f): zd = zlib.decompressobj() try: for chnk in f: yield zd.decompress(chnk) - except httplib.HTTPException, inst: + except httplib.HTTPException: raise IOError(None, _('connection ended unexpectedly')) yield zd.flush()
--- a/mercurial/localrepo.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/localrepo.py Tue Sep 19 15:28:13 2006 -0500 @@ -318,7 +318,7 @@ f = f[1:] return filelog.filelog(self.opener, f, self.revlogversion) - def changectx(self, changeid): + def changectx(self, changeid=None): return context.changectx(self, changeid) def filectx(self, path, changeid=None, fileid=None):
--- a/mercurial/revlog.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/revlog.py Tue Sep 19 15:28:13 2006 -0500 @@ -116,7 +116,6 @@ which takes much less time. """ if self.allmap: return - start = 0 end = self.datasize self.allmap = 1 cur = 0
--- a/mercurial/util.py Tue Sep 19 14:58:54 2006 -0500 +++ b/mercurial/util.py Tue Sep 19 15:28:13 2006 -0500 @@ -615,7 +615,8 @@ try: rcs.extend([os.path.join(rcdir, f) for f in os.listdir(rcdir) if f.endswith(".rc")]) - except OSError, inst: pass + except OSError: + pass return rcs def os_rcpath():