Mercurial > public > mercurial-scm > hg
changeset 11484:44b4873ea59b stable
Merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 01 Jul 2010 11:20:08 -0500 |
parents | 34e33d50c26b (diff) 00a758086cbf (current diff) |
children | b602a95c21ec |
files | |
diffstat | 19 files changed, 178 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Thu Jul 01 15:25:29 2010 +0200 +++ b/hgext/mq.py Thu Jul 01 11:20:08 2010 -0500 @@ -250,6 +250,7 @@ self.ui = ui self.applied_dirty = 0 self.series_dirty = 0 + self.added = [] self.series_path = "series" self.status_path = "status" self.guards_path = "guards" @@ -1622,7 +1623,7 @@ if (len(files) > 1 or len(rev) > 1) and patchname: raise util.Abort(_('option "-n" not valid when importing multiple ' 'patches')) - added = [] + self.added = [] if rev: # If mq patches are applied, we can only import revisions # that form a linear path to qbase. @@ -1672,10 +1673,11 @@ se = statusentry(n, patchname) self.applied.insert(0, se) - added.append(patchname) + self.added.append(patchname) patchname = None self.parse_series() self.applied_dirty = 1 + self.series_dirty = True for i, filename in enumerate(files): if existing: @@ -1709,13 +1711,10 @@ index = self.full_series_end() + i self.full_series[index:index] = [patchname] self.parse_series() + self.series_dirty = True self.ui.warn(_("adding %s to series file\n") % patchname) - added.append(patchname) + self.added.append(patchname) patchname = None - self.series_dirty = 1 - qrepo = self.qrepo() - if qrepo: - qrepo[None].add(added) def delete(ui, repo, *patches, **opts): """remove patches from queue @@ -1805,10 +1804,15 @@ using the --name flag. """ q = repo.mq - q.qimport(repo, filename, patchname=opts['name'], + try: + q.qimport(repo, filename, patchname=opts['name'], existing=opts['existing'], force=opts['force'], rev=opts['rev'], git=opts['git']) - q.save_dirty() + finally: + q.save_dirty() + qrepo = q.qrepo() + if qrepo: + qrepo[None].add(q.added) if opts.get('push') and not opts.get('rev'): return q.push(repo, None)
--- a/mercurial/cmdutil.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/cmdutil.py Thu Jul 01 11:20:08 2010 -0500 @@ -687,7 +687,6 @@ self.patch = patch self.diffopts = diffopts self.header = {} - self.doneheader = False self.hunk = {} self.lastheader = None self.footer = None @@ -906,9 +905,9 @@ if self.buffered: self.header[ctx.rev()] = h else: - if not self.doneheader: + if self.lastheader != h: + self.lastheader = h self.ui.write(h) - self.doneheader = True # write changeset metadata, then patch if requested key = types['changeset']
--- a/mercurial/hook.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/hook.py Thu Jul 01 11:20:08 2010 -0500 @@ -98,7 +98,10 @@ cwd = repo.root else: cwd = os.getcwd() - r = util.system(cmd, environ=env, cwd=cwd) + if 'HG_URL' in env and env['HG_URL'].startswith('remote:http'): + r = util.system(cmd, environ=env, cwd=cwd, out=ui) + else: + r = util.system(cmd, environ=env, cwd=cwd) if r: desc, r = util.explain_exit(r) if throw:
--- a/mercurial/merge.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/merge.py Thu Jul 01 11:20:08 2010 -0500 @@ -167,7 +167,7 @@ m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() copied = set(copy.values()) - if not overwrite and '.hgsubstate' in m1: + if '.hgsubstate' in m1: # check whether sub state is modified for s in p1.substate: if p1.sub(s).dirty(): @@ -182,7 +182,9 @@ rflags = fmerge(f, f, f) a = ma.get(f, nullid) if n == m2[f] or m2[f] == a: # same or local newer - if m1.flags(f) != rflags: + # is file locally modified or flags need changing? + # dirstate flags may need to be made current + if m1.flags(f) != rflags or n[20:]: act("update permissions", "e", f, rflags) elif n == a: # remote newer act("remote is newer", "g", f, rflags)
--- a/mercurial/minirst.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/minirst.py Thu Jul 01 11:20:08 2010 -0500 @@ -36,7 +36,13 @@ """ import re, sys -import util +import util, encoding + +def replace(text, substs): + utext = text.decode(encoding.encoding) + for f, t in substs: + utext = utext.replace(f, t) + return utext.encode(encoding.encoding) def findblocks(text): """Find continuous blocks of lines in text. @@ -251,21 +257,22 @@ def inlineliterals(blocks): + substs = [('``', '"')] for b in blocks: if b['type'] in ('paragraph', 'section'): - b['lines'] = [l.replace('``', '"') for l in b['lines']] + b['lines'] = [replace(l, substs) for l in b['lines']] return blocks def hgrole(blocks): + substs = [(':hg:`', '"hg '), ('`', '"')] for b in blocks: if b['type'] in ('paragraph', 'section'): # Turn :hg:`command` into "hg command". This also works # when there is a line break in the command and relies on # the fact that we have no stray back-quotes in the input # (run the blocks through inlineliterals first). - b['lines'] = [l.replace(':hg:`', '"hg ').replace('`', '"') - for l in b['lines']] + b['lines'] = [replace(l, substs) for l in b['lines']] return blocks
--- a/mercurial/revset.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/revset.py Thu Jul 01 11:20:08 2010 -0500 @@ -111,10 +111,6 @@ # operator methods -def negate(repo, subset, x): - return getset(repo, subset, - ('string', '-' + getstring(x, _("can't negate that")))) - def stringset(repo, subset, x): x = repo[x].rev() if x == -1 and len(subset) == len(repo): @@ -482,7 +478,6 @@ } methods = { - "negate": negate, "range": rangeset, "string": stringset, "symbol": symbolset, @@ -515,6 +510,9 @@ return optimize(('range', ('string', '0'), x[1]), small) elif op == 'rangepost': return optimize(('range', x[1], ('string', 'tip')), small) + elif op == 'negate': + return optimize(('string', + '-' + getstring(x[1], _("can't negate that"))), small) elif op in 'string symbol negate': return smallbonus, x # single revisions are small elif op == 'and' or op == 'dagrange':
--- a/mercurial/subrepo.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/subrepo.py Thu Jul 01 11:20:08 2010 -0500 @@ -67,19 +67,23 @@ repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) for s, l in s1.items(): - if wctx != actx and wctx.sub(s).dirty(): - l = (l[0], l[1] + "+") a = sa.get(s, nullstate) + ld = l # local state with possible dirty flag for compares + if wctx.sub(s).dirty(): + ld = (l[0], l[1] + "+") + if wctx == actx: # overwrite + a = ld + if s in s2: r = s2[s] - if l == r or r == a: # no change or local is newer + if ld == r or r == a: # no change or local is newer sm[s] = l continue - elif l == a: # other side changed + elif ld == a: # other side changed debug(s, "other changed, get", r) wctx.sub(s).get(r) sm[s] = r - elif l[0] != r[0]: # sources differ + elif ld[0] != r[0]: # sources differ if repo.ui.promptchoice( _(' subrepository sources for %s differ\n' 'use (l)ocal source (%s) or (r)emote source (%s)?') @@ -88,7 +92,7 @@ debug(s, "prompt changed, get", r) wctx.sub(s).get(r) sm[s] = r - elif l[1] == a[1]: # local side is unchanged + elif ld[1] == a[1]: # local side is unchanged debug(s, "other side changed, get", r) wctx.sub(s).get(r) sm[s] = r @@ -96,7 +100,7 @@ debug(s, "both sides changed, merge with", r) wctx.sub(s).merge(r) sm[s] = l - elif l == a: # remote removed, local unchanged + elif ld == a: # remote removed, local unchanged debug(s, "remote removed, remove") wctx.sub(s).remove() else:
--- a/mercurial/util.py Thu Jul 01 15:25:29 2010 +0200 +++ b/mercurial/util.py Thu Jul 01 11:20:08 2010 -0500 @@ -366,13 +366,16 @@ global _hgexecutable _hgexecutable = path -def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None): +def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None, out=None): '''enhanced shell command execution. run with environment maybe modified, maybe in different dir. if command fails and onerr is None, return status. if ui object, print error message and return status, else raise onerr object as - exception.''' + exception. + + if out is specified, it is assumed to be a file-like object that has a + write() method. stdout and stderr will be redirected to out.''' def py2shell(val): 'convert python object into string that is useful to shell' if val is None or val is False: @@ -386,8 +389,17 @@ env = dict(os.environ) env.update((k, py2shell(v)) for k, v in environ.iteritems()) env['HG'] = hgexecutable() - rc = subprocess.call(cmd, shell=True, close_fds=closefds, - env=env, cwd=cwd) + if out is None: + rc = subprocess.call(cmd, shell=True, close_fds=closefds, + env=env, cwd=cwd) + else: + proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, + env=env, cwd=cwd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + for line in proc.stdout: + out.write(line) + proc.wait() + rc = proc.returncode if sys.platform == 'OpenVMS' and rc & 1: rc = 0 if rc and onerr:
--- a/setup.py Thu Jul 01 15:25:29 2010 +0200 +++ b/setup.py Thu Jul 01 11:20:08 2010 -0500 @@ -35,12 +35,15 @@ import os, subprocess, time import shutil import tempfile +from distutils import log from distutils.core import setup, Extension from distutils.dist import Distribution from distutils.command.build import build +from distutils.command.build_ext import build_ext from distutils.command.build_py import build_py from distutils.spawn import spawn, find_executable from distutils.ccompiler import new_compiler +from distutils.errors import CCompilerError scripts = ['hg'] if os.name == 'nt': @@ -209,6 +212,17 @@ Distribution.global_options.append(('pure', None, "use pure (slow) Python " "code instead of C extensions")) +class hgbuildext(build_ext): + + def build_extension(self, ext): + try: + build_ext.build_extension(self, ext) + except CCompilerError: + if not hasattr(ext, 'optional') or not ext.optional: + raise + log.warn("Failed to build optional extension '%s' (skipping)", + ext.name) + class hgbuildpy(build_py): def finalize_options(self): @@ -232,6 +246,7 @@ yield module cmdclass = {'build_mo': hgbuildmo, + 'build_ext': hgbuildext, 'build_py': hgbuildpy} packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert', @@ -256,10 +271,13 @@ if sys.platform == 'linux2' and os.uname()[2] > '2.6': # The inotify extension is only usable with Linux 2.6 kernels. # You also need a reasonably recent C library. + # In any case, if it fails to build the error will be skipped ('optional'). cc = new_compiler() if hasfunction(cc, 'inotify_add_watch'): - extmodules.append(Extension('hgext.inotify.linux._inotify', - ['hgext/inotify/linux/_inotify.c'])) + inotify = Extension('hgext.inotify.linux._inotify', + ['hgext/inotify/linux/_inotify.c']) + inotify.optional = True + extmodules.append(inotify) packages.extend(['hgext.inotify', 'hgext.inotify.linux']) packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
--- a/tests/test-command-template Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-command-template Thu Jul 01 11:20:08 2010 -0500 @@ -100,6 +100,9 @@ hg log --style=changelog > changelog cat changelog +echo '# issue 2130' +hg heads --style changelog + echo "# keys work" for key in author branches date desc file_adds file_dels file_mods \ file_copies file_copies_switch files \
--- a/tests/test-command-template.out Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-command-template.out Thu Jul 01 11:20:08 2010 -0500 @@ -437,6 +437,23 @@ line 1 line 2 [1e4e1b8f71e0] +# issue 2130 +2020-01-01 test <test> + + * fourth, second, third: + third + [95c24699272e] [tip] + +1970-01-18 person <person> + + * merge + [c7b487c6c50e] + +1970-01-17 person <person> + + * new branch + [32a18f097fcc] <foo> + # keys work author: test author: User Name <user@hostname>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qimport-fail-cleanup Thu Jul 01 11:20:08 2010 -0500 @@ -0,0 +1,33 @@ +#!/bin/sh +#failed qimport of patches from files should cleanup by recording successfully +#imported patches in series file. + +echo "[extensions]" >> $HGRCPATH +echo "mq=" >> $HGRCPATH + +hg init repo +cd repo + +echo a > a +hg ci -Am'add a' + +cat >b.patch<<EOF +diff --git a/a b/a +--- a/a ++++ b/a +@@ -1,1 +1,2 @@ + a ++b +EOF + +echo +echo '#empty series' +hg qseries + +echo +echo '#qimport valid patch followed by invalid patch' +hg qimport b.patch fakepatch + +echo +echo '#valid patches before fail added to series' +hg qseries
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qimport-fail-cleanup.out Thu Jul 01 11:20:08 2010 -0500 @@ -0,0 +1,10 @@ +adding a + +#empty series + +#qimport valid patch followed by invalid patch +adding b.patch to series file +abort: unable to read fakepatch + +#valid patches before fail added to series +b.patch
--- a/tests/test-push-http Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-push-http Thu Jul 01 11:20:08 2010 -0500 @@ -39,11 +39,9 @@ echo % expect success echo 'allow_push = *' >> .hg/hgrc echo '[hooks]' >> .hg/hgrc -echo 'changegroup = python ../printenv.py changegroup 0 ../urls' >> .hg/hgrc +echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc req -cat ../urls - hg rollback echo % expect authorization error: all users denied echo '[web]' > .hg/hgrc
--- a/tests/test-push-http.out Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-push-http.out Thu Jul 01 11:20:08 2010 -0500 @@ -23,8 +23,8 @@ remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files +remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http % serve errors -changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http rolling back to revision 0 (undo serve) % expect authorization error: all users denied abort: authorization failed
--- a/tests/test-revset Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-revset Thu Jul 01 11:20:08 2010 -0500 @@ -133,3 +133,4 @@ log '(1 and 2)::' log '(1 and 2):' log '(1 and 2):3' +log 'sort(head(), -rev)'
--- a/tests/test-revset.out Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-revset.out Thu Jul 01 11:20:08 2010 -0500 @@ -210,3 +210,13 @@ % log '(1 and 2)::' % log '(1 and 2):' % log '(1 and 2):3' +% log 'sort(head(), -rev)' +9 +7 +6 +5 +4 +3 +2 +1 +0
--- a/tests/test-subrepo Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-subrepo Thu Jul 01 11:20:08 2010 -0500 @@ -19,6 +19,13 @@ hg sum hg ci -m1 +# issue 2022 - update -C + +echo b > s/a +hg sum +hg co -C 1 +hg sum + echo % add sub sub echo ss = ss > s/.hgsub hg init s/ss
--- a/tests/test-subrepo.out Thu Jul 01 15:25:29 2010 +0200 +++ b/tests/test-subrepo.out Thu Jul 01 11:20:08 2010 -0500 @@ -8,6 +8,17 @@ commit: 1 added, 1 subrepos update: (current) committing subrepository s +parent: 1:7cf8cfea66e4 tip + 1 +branch: default +commit: 1 subrepos +update: (current) +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +parent: 1:7cf8cfea66e4 tip + 1 +branch: default +commit: (clean) +update: (current) % add sub sub parent: 1:7cf8cfea66e4 tip 1