Mercurial > hg-stable
changeset 3076:1a792e4a1f3a
merge with brendan
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 09 Sep 2006 12:51:05 +0200 |
parents | e20e7e2623b0 (current diff) be98c5ce4022 (diff) |
children | ad6aecaf4eed |
files | hgext/mq.py |
diffstat | 16 files changed, 180 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/extdiff.py Wed Aug 30 15:13:45 2006 -0700 +++ b/hgext/extdiff.py Sat Sep 09 12:51:05 2006 +0200 @@ -105,8 +105,7 @@ else: dir2 = snapshot_wdir(modified + added) cmdline = ('%s %s %s %s' % - (util.shellquote(diffcmd), - ' '.join(map(util.shellquote, diffopts)), + (util.shellquote(diffcmd), ' '.join(diffopts), util.shellquote(dir1), util.shellquote(dir2))) ui.debug('running %r in %s\n' % (cmdline, tmproot)) util.system(cmdline, cwd=tmproot)
--- a/hgext/hgk.py Wed Aug 30 15:13:45 2006 -0700 +++ b/hgext/hgk.py Sat Sep 09 12:51:05 2006 +0200 @@ -7,68 +7,7 @@ from mercurial.demandload import * demandload(globals(), 'time sys signal os') -demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util') - -def filterfiles(files, filters): - l = [x for x in filters if x in files] - - for t in files: - if not t.endswith("/"): - t += "/" - l += [x for x in filters if x.startswith(t)] - return l - -def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, - changes=None, text=False): - def date(c): - return time.asctime(time.gmtime(c[2][0])) - - if not changes: - changes = repo.status(node1, node2, files, match=match)[:5] - modified, added, removed, deleted, unknown = changes - if files: - modified, added, removed = map(lambda x: filterfiles(files, x), - (modified, added, removed)) - - if not modified and not added and not removed: - return - - if node2: - change = repo.changelog.read(node2) - mmap2 = repo.manifest.read(change[0]) - date2 = date(change) - def read(f): - return repo.file(f).read(mmap2[f]) - else: - date2 = time.asctime() - if not node1: - node1 = repo.dirstate.parents()[0] - def read(f): - return repo.wfile(f).read() - - change = repo.changelog.read(node1) - mmap = repo.manifest.read(change[0]) - date1 = date(change) - - opts = mdiff.diffopts() - opts.text = text - for f in modified: - to = None - if f in mmap: - to = repo.file(f).read(mmap[f]) - tn = read(f) - fp.write("diff --git a/%s b/%s\n" % (f, f)) - fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts)) - for f in added: - to = None - tn = read(f) - fp.write("diff --git /dev/null b/%s\n" % (f)) - fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts)) - for f in removed: - to = repo.file(f).read(mmap[f]) - tn = None - fp.write("diff --git a/%s /dev/null\n" % (f)) - fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts)) +demandload(globals(), 'mercurial:hg,fancyopts,commands,ui,util,patch') def difftree(ui, repo, node1=None, node2=None, *files, **opts): """diff trees from two commits""" @@ -86,7 +25,7 @@ change = repo.changelog.read(node1) mmap = repo.manifest.read(change[0]) - empty = "0" * 40; + empty = hg.short(hg.nullid) for f in modified: # TODO get file permissions @@ -123,7 +62,9 @@ if opts['patch']: if opts['pretty']: catcommit(repo, node2, "") - dodiff(sys.stdout, ui, repo, node1, node2, files=files) + patch.diff(repo, node1, node2, + files=files, + opts=patch.diffopts(ui, {'git': True})) else: __difftree(repo, node1, node2, files=files) if not opts['stdin']:
--- a/hgext/mq.py Wed Aug 30 15:13:45 2006 -0700 +++ b/hgext/mq.py Sat Sep 09 12:51:05 2006 +0200 @@ -1479,7 +1479,7 @@ if not files: raise util.Abort(_('qfold requires at least one patch name')) if not q.check_toppatch(repo): - raise util.Abort(_('No patches applied\n')) + raise util.Abort(_('No patches applied')) message = commands.logmessage(opts) if opts['edit']:
--- a/mercurial/cmdutil.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/cmdutil.py Sat Sep 09 12:51:05 2006 +0200 @@ -53,8 +53,8 @@ i += 1 return ''.join(newname) except KeyError, inst: - raise util.Abort(_("invalid format spec '%%%s' in output file name"), - inst.args[0]) + raise util.Abort(_("invalid format spec '%%%s' in output file name") % + inst.args[0]) def make_file(repo, pat, node=None, total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
--- a/mercurial/commands.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/commands.py Sat Sep 09 12:51:05 2006 +0200 @@ -8,7 +8,7 @@ from demandload import demandload from node import * from i18n import gettext as _ -demandload(globals(), "os re sys signal shutil imp urllib pdb") +demandload(globals(), "os re sys signal shutil imp urllib pdb shlex") demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo") demandload(globals(), "fnmatch difflib patch random signal tempfile time") demandload(globals(), "traceback errno socket version struct atexit sets bz2") @@ -274,7 +274,7 @@ try: num = repo.changelog.rev(repo.lookup(val)) except KeyError: - raise util.Abort(_('invalid revision identifier %s'), val) + raise util.Abort(_('invalid revision identifier %s') % val) return num def revpair(ui, repo, revs): @@ -341,7 +341,7 @@ try: if filename: if os.path.exists(filename): - raise util.Abort(_("file '%s' already exists"), filename) + raise util.Abort(_("file '%s' already exists") % filename) fh = open(filename, "wb") else: fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") @@ -1269,7 +1269,7 @@ try: ui.write(r.revision(r.lookup(rev))) except KeyError: - raise util.Abort(_('invalid revision identifier %s'), rev) + raise util.Abort(_('invalid revision identifier %s') % rev) def debugindex(ui, file_): """dump the contents of an index file""" @@ -1940,7 +1940,7 @@ revision to merge with must be provided. """ - if node: + if node or branch: node = _lookup(repo, node, branch) else: heads = repo.heads() @@ -2484,7 +2484,7 @@ try: httpd = hgweb.server.create_server(ui, repo) except socket.error, inst: - raise util.Abort(_('cannot start server: ') + inst.args[1]) + raise util.Abort(_('cannot start server: %s') % inst.args[1]) if ui.verbose: addr, port = httpd.socket.getsockname() @@ -2734,7 +2734,7 @@ repo.ui.warn(_("Using head %s for branch %s\n") % (short(node), branch)) else: - raise util.Abort(_("branch %s not found\n") % (branch)) + raise util.Abort(_("branch %s not found") % branch) else: node = node and repo.lookup(node) or repo.changelog.tip() return node @@ -3223,7 +3223,7 @@ cmd = aliases[0] defaults = ui.config("defaults", cmd) if defaults: - args = defaults.split() + args + args = shlex.split(defaults) + args c = list(i[1]) else: cmd = None @@ -3449,7 +3449,7 @@ u.warn(_("abort: could not lock %s: %s\n") % (inst.desc or inst.filename, inst.strerror)) except revlog.RevlogError, inst: - u.warn(_("abort: "), inst, "!\n") + u.warn(_("abort: %s!\n") % inst) except util.SignalInterrupt: u.warn(_("killed!\n")) except KeyboardInterrupt: @@ -3482,7 +3482,7 @@ else: u.warn(_("abort: %s\n") % inst.strerror) except util.Abort, inst: - u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n') + u.warn(_("abort: %s\n") % inst) except TypeError, inst: # was this an argument error? tb = traceback.extract_tb(sys.exc_info()[2])
--- a/mercurial/hg.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/hg.py Sat Sep 09 12:51:05 2006 +0200 @@ -115,7 +115,7 @@ source = localpath(source) if os.path.exists(dest): - raise util.Abort(_("destination '%s' already exists"), dest) + raise util.Abort(_("destination '%s' already exists") % dest) class DirCleanup(object): def __init__(self, dir_):
--- a/mercurial/httprepo.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/httprepo.py Sat Sep 09 12:51:05 2006 +0200 @@ -325,7 +325,7 @@ rfp.close() except socket.error, err: if err[0] in (errno.ECONNRESET, errno.EPIPE): - raise util.Abort(_('push failed: %s'), err[1]) + raise util.Abort(_('push failed: %s') % err[1]) raise util.Abort(err[1]) finally: fp.close()
--- a/mercurial/localrepo.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/localrepo.py Sat Sep 09 12:51:05 2006 +0200 @@ -133,7 +133,7 @@ except Exception, exc: if isinstance(exc, util.Abort): self.ui.warn(_('error: %s hook failed: %s\n') % - (hname, exc.args[0] % exc.args[1:])) + (hname, exc.args[0])) else: self.ui.warn(_('error: %s hook raised an exception: ' '%s\n') % (hname, exc))
--- a/mercurial/patch.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/patch.py Sat Sep 09 12:51:05 2006 +0200 @@ -502,7 +502,10 @@ header.append('deleted file mode %s\n' % mode) else: omode = gitmode(mmap.execf(f)) - nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f))) + if node2: + nmode = gitmode(mmap2.execf(f)) + else: + nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f))) addmodehdr(header, omode, nmode) r = None if dodiff:
--- a/mercurial/ui.py Wed Aug 30 15:13:45 2006 -0700 +++ b/mercurial/ui.py Sat Sep 09 12:51:05 2006 +0200 @@ -122,7 +122,9 @@ try: return self.cdata.get(section, name) except ConfigParser.InterpolationError, inst: - raise util.Abort(_("Error in configuration:\n%s") % inst) + raise util.Abort(_("Error in configuration section [%s] " + "parameter '%s':\n%s") + % (section, name, inst)) if self.parentui is None: return default else: @@ -144,7 +146,9 @@ try: return self.cdata.getboolean(section, name) except ConfigParser.InterpolationError, inst: - raise util.Abort(_("Error in configuration:\n%s") % inst) + raise util.Abort(_("Error in configuration section [%s] " + "parameter '%s':\n%s") + % (section, name, inst)) if self.parentui is None: return default else: @@ -162,7 +166,8 @@ try: items.update(dict(self.cdata.items(section))) except ConfigParser.InterpolationError, inst: - raise util.Abort(_("Error in configuration:\n%s") % inst) + raise util.Abort(_("Error in configuration section [%s]:\n%s") + % (section, inst)) x = items.items() x.sort() return x @@ -174,10 +179,14 @@ yield section, name, value seen[section, name] = 1 for section in self.cdata.sections(): - for name, value in self.cdata.items(section): - if (section, name) in seen: continue - yield section, name, value.replace('\n', '\\n') - seen[section, name] = 1 + try: + for name, value in self.cdata.items(section): + if (section, name) in seen: continue + yield section, name, value.replace('\n', '\\n') + seen[section, name] = 1 + except ConfigParser.InterpolationError, inst: + raise util.Abort(_("Error in configuration section [%s]:\n%s") + % (section, inst)) if self.parentui is not None: for parent in self.parentui.walkconfig(seen): yield parent
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-branch Sat Sep 09 12:51:05 2006 +0200 @@ -0,0 +1,34 @@ +#!/bin/sh +# +# test for branch handling +# +# XXX: need more tests + +hg init +echo a > a +echo b > b +hg ci -A -m 0 -d "1000000 0" +echo aa > a +echo bb > b +hg ci -m 1 -d "1000000 0" +hg tag -l foo +hg update 0 +hg parents -b + +# test update +hg update -b foo +hg parents + +# test merge +hg update 0 +echo c > c +hg ci -A -m 0.0 -d "1000000 0" +hg merge -b foo +hg parents -b + +# re-test with more branches +hg update -C 0 +echo d > d +hg ci -A -m 0.0 -d "1000000 0" +hg merge -b foo +hg parents -b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-branch.out Sat Sep 09 12:51:05 2006 +0200 @@ -0,0 +1,55 @@ +adding a +adding b +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +changeset: 0:b544c4ac4389 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 0 + +Using head f4ac749470f2 for branch foo +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +changeset: 1:f4ac749470f2 +tag: foo +tag: tip +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 1 + +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +adding c +Using head f4ac749470f2 for branch foo +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +changeset: 2:1505d56ee00e +tag: tip +parent: 0:b544c4ac4389 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 0.0 + +changeset: 1:f4ac749470f2 +tag: foo +branch: foo +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 1 + +2 files updated, 0 files merged, 1 files removed, 0 files unresolved +adding d +Using head f4ac749470f2 for branch foo +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +changeset: 3:53b72df12ae5 +tag: tip +parent: 0:b544c4ac4389 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 0.0 + +changeset: 1:f4ac749470f2 +tag: foo +branch: foo +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 1 +
--- a/tests/test-git-export Wed Aug 30 15:13:45 2006 -0700 +++ b/tests/test-git-export Sat Sep 09 12:51:05 2006 +0200 @@ -50,3 +50,7 @@ echo '% rename+mod+chmod' hg diff --git -r 6:tip | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" + +echo '% nonexistent in tip+chmod' +hg diff --git -r 5:6 | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
--- a/tests/test-git-export.out Wed Aug 30 15:13:45 2006 -0700 +++ b/tests/test-git-export.out Sat Sep 09 12:51:05 2006 +0200 @@ -40,3 +40,7 @@ 4 5 +a +% nonexistent in tip+chmod +diff --git a/src b/src +old mode 100644 +new mode 100755
--- a/tests/test-ui-config Wed Aug 30 15:13:45 2006 -0700 +++ b/tests/test-ui-config Sat Sep 09 12:51:05 2006 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python -from mercurial import ui +from mercurial import ui, util testui = ui.ui() testui.updateopts(config=[ @@ -11,10 +11,19 @@ 'lists.list2=foo bar baz', 'lists.list3=alice, bob', 'lists.list4=foo bar baz alice, bob', + 'interpolation.value1=hallo', + 'interpolation.value2=%(value1)s world', + 'interpolation.value3=%(novalue)s', + 'interpolation.value4=%(bad)1', + 'interpolation.value5=%bad2', ]) print repr(testui.configitems('values')) print repr(testui.configitems('lists')) +try: + print repr(testui.configitems('interpolation')) +except util.Abort, inst: + print inst print "---" print repr(testui.config('values', 'string')) print repr(testui.config('values', 'bool1')) @@ -45,3 +54,18 @@ print repr(testui.configlist('lists', 'unknown', ['foo bar'])) print repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])) print "---" +print repr(testui.config('interpolation', 'value1')) +print repr(testui.config('interpolation', 'value2')) +try: + print repr(testui.config('interpolation', 'value3')) +except util.Abort, inst: + print inst +try: + print repr(testui.config('interpolation', 'value4')) +except util.Abort, inst: + print inst +try: + print repr(testui.config('interpolation', 'value5')) +except util.Abort, inst: + print inst +print "---"
--- a/tests/test-ui-config.out Wed Aug 30 15:13:45 2006 -0700 +++ b/tests/test-ui-config.out Sat Sep 09 12:51:05 2006 +0200 @@ -1,5 +1,7 @@ [('bool1', 'true'), ('bool2', 'false'), ('string', 'string value')] [('list1', 'foo'), ('list2', 'foo bar baz'), ('list3', 'alice, bob'), ('list4', 'foo bar baz alice, bob')] +Error in configuration section [interpolation]: +'%' must be followed by '%' or '(', found: '%bad2' --- 'string value' 'true' @@ -27,3 +29,17 @@ ['foo bar'] ['foo', 'bar'] --- +'hallo' +'hallo world' +Error in configuration section [interpolation] parameter 'value3': +Bad value substitution: + section: [interpolation] + option : value3 + key : novalue + rawval : + +Error in configuration section [interpolation] parameter 'value4': +bad interpolation variable reference '%(bad)1' +Error in configuration section [interpolation] parameter 'value5': +'%' must be followed by '%' or '(', found: '%bad2' +---