diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -386,9 +386,7 @@ def templatelabel(context, mapping, args # i18n: "label" is a keyword raise error.ParseError(_("label expects two arguments")) - thing = templater.stringify(args[1][0](context, mapping, args[1][1])) - thing = templater.runtemplate(context, mapping, - templater.compiletemplate(thing, context)) + thing = templater._evalifliteral(args[1], context, mapping) # apparently, repo could be a string that is the favicon? repo = mapping.get('repo', '') diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -159,6 +159,7 @@ from mercurial import scmutil from mercurial import util from mercurial import obsolete from mercurial import merge as mergemod +from mercurial.lock import release from mercurial.i18n import _ cmdtable = {} @@ -476,6 +477,15 @@ def histedit(ui, repo, *freeargs, **opts for intentional "edit" command, but also for resolving unexpected conflicts). """ + lock = wlock = None + try: + wlock = repo.wlock() + lock = repo.lock() + _histedit(ui, repo, *freeargs, **opts) + finally: + release(lock, wlock) + +def _histedit(ui, repo, *freeargs, **opts): # TODO only abort if we try and histedit mq patches, not just # blanket if mq patches are applied somewhere mq = getattr(repo, 'mq', None) diff --git a/i18n/pt_BR.po b/i18n/pt_BR.po --- a/i18n/pt_BR.po +++ b/i18n/pt_BR.po @@ -3010,12 +3010,13 @@ msgstr "" " [repository]\n" " native = LF" -msgid "" -".. note::\n" +msgid ".. note::" +msgstr ".. note::" + +msgid "" " The rules will first apply when files are touched in the working\n" " copy, e.g. by updating to null and back to tip to touch all files." msgstr "" -".. note::\n" " As regras passarão a ser aplicadas a partir do momento em que os\n" " arquivos forem mexidos na cópia de trabalho, por exemplo após um\n" " update para null e de volta para a revisão atual para mexer em\n" @@ -4709,11 +4710,9 @@ msgstr "" " svn = True" msgid "" -".. note::\n" " The more specific you are in your filename patterns the less you\n" " lose speed in huge repositories." msgstr "" -".. note::\n" " Quanto mais específico você for em seus padrões de arquivo,\n" " menos velocidade será perdida em repositórios muito grandes." @@ -6749,12 +6748,11 @@ msgstr "" " Sem argumentos, imprime as guardas ativas no momento.\n" " Com um argumento, define guardas para o patch pedido." -msgid "" -" .. note::\n" -" Specifying negative guards now requires '--'." -msgstr "" -" .. note::\n" -" A especificação de guardas negativas agora exige '--'." +msgid " .. note::" +msgstr " .. note::" + +msgid " Specifying negative guards now requires '--'." +msgstr " A especificação de guardas negativas agora exige '--'." msgid " To set guards on another patch::" msgstr " Para definir guardas em um outro patch::" @@ -7342,7 +7340,7 @@ msgid "" "Notifications will not be sent until the ``notify.test`` value is set\n" "to ``False``; see below." msgstr "" -"Notificações mas não serão enviadas até que você defina a entrada\n" +"Notificações não serão enviadas até que você defina a entrada\n" "``notify.test`` como ``False``; veja abaixo." msgid "" @@ -7433,7 +7431,7 @@ msgid "" "notify.outgoing\n" " Template to use when run as an outgoing hook, overriding ``notify.template``." msgstr "" -"notify.incoming\n" +"notify.outgoing\n" " O modelo usado ao executar o gancho outgoing; sobrepõe\n" " ``notify.template``." @@ -8946,7 +8944,6 @@ msgstr "" " compartilha seu histórico com outro repositório." msgid "" -" .. note::\n" " using rollback or extensions that destroy/modify history (mq,\n" " rebase, etc.) can cause considerable confusion with shared\n" " clones. In particular, if two shared clones are both updated to\n" @@ -8957,7 +8954,6 @@ msgid "" " the broken clone to reset it to a changeset that still exists.\n" " " msgstr "" -" .. note::\n" " o uso de rollback ou extensões que destroem ou modificam\n" " o histórico (mq, rebase, etc) pode causar confusão considerável\n" " com clones compartilhados. Em particular, se dois clones\n" @@ -10790,11 +10786,9 @@ msgstr "" " manualmente." msgid "" -" .. note::\n" " backout cannot be used to fix either an unwanted or\n" " incorrect merge." msgstr "" -" .. note::\n" " backout não pode ser usado para corrigir uma mesclagem\n" " incorreta ou indesejada." @@ -11230,12 +11224,10 @@ msgid "set or show the current branch na msgstr "define ou mostra o nome de ramo atual" msgid "" -" .. note::\n" " Branch names are permanent and global. Use :hg:`bookmark` to create a\n" " light-weight bookmark instead. See :hg:`help glossary` for more\n" " information about named branches and bookmarks." msgstr "" -" .. note::\n" " Nomes de ramos são permanentes e globais. Use :hg:`bookmark`\n" " para criar um marcador leve temporário. Veja :hg:`help glossary`\n" " para mais informações sobre ramos nomeados e marcadores." @@ -12461,12 +12453,10 @@ msgstr "" " \"unified diff\"." msgid "" -" .. note::\n" " diff may generate unexpected results for merges, as it will\n" " default to comparing against the working directory's first\n" " parent changeset if no revisions are specified." msgstr "" -" .. note::\n" " diff pode gerar resultados inesperados para mesclagens, já\n" " que por padrão irá comparar com o primeiro pai do diretório de\n" " trabalho se uma revisão não for especificada." @@ -12569,12 +12559,10 @@ msgstr "" " e comentário de consolidação." msgid "" -" .. note::\n" " export may generate unexpected diff output for merge\n" " changesets, as it will compare the merge changeset against its\n" " first parent only." msgstr "" -" .. note::\n" " export pode gerar saída de diff inesperada para revisões\n" " de mesclagem, já que irá comparar a revisão de mesclagem\n" " apenas com seu primeiro pai." @@ -12761,12 +12749,8 @@ msgstr "" " resolvidos, o processo de enxerto pode ser retomado usando a\n" " opção -c/--continue." -msgid "" -" .. note::\n" -" The -c/--continue option does not reapply earlier options." -msgstr "" -" .. note::\n" -" A opção -c/--continue não reaplica opções anteriores." +msgid " The -c/--continue option does not reapply earlier options." +msgstr " A opção -c/--continue não reaplica opções anteriores." msgid "" " - copy a single change to the stable branch and edit its description::" @@ -13453,26 +13437,22 @@ msgstr "" " mensagem de consolidação completa." msgid "" -" .. note::\n" " log -p/--patch may generate unexpected diff output for merge\n" " changesets, as it will only compare the merge changeset against\n" " its first parent. Also, only files different from BOTH parents\n" " will appear in files:." msgstr "" -" .. note::\n" " log -p/--patch pode gerar saídas de diff inesperadas para\n" " mesclagens, pois irá comparar a revisão de mesclagem apenas\n" " com seu primeiro pai. Além disso, apenas arquivos diferentes\n" " de AMBOS os pais aparecerão na lista de arquivos." msgid "" -" .. note::\n" " for performance reasons, log FILE may omit duplicate changes\n" " made on branches and will not show deletions. To see all\n" " changes including duplicates and deletions, use the --removed\n" " switch." msgstr "" -" .. note::\n" " por razões de desempenho, log ARQUIVO pode omitir mudanças\n" " duplicadas feitas em outros ramos, e não mostra remoções.\n" " Para ver todas as mudanças incluindo duplicatas e remoções,\n" @@ -14033,12 +14013,10 @@ msgstr "" " forçar outras mudanças." msgid "" -" .. note::\n" " Extra care should be taken with the -f/--force option,\n" " which will push all new heads on all branches, an action which will\n" " almost always cause confusion for collaborators." msgstr "" -" .. note::\n" " Cuidado extra deve ser tomado ao usar a opção -f/--force,\n" " que enviará todas as novas cabeças em todos os ramos, o que\n" " quase sempre confunde os outros colaboradores." @@ -14363,12 +14341,10 @@ msgstr "" "restaura arquivos para o estado correspondente a uma cópia de trabalho" msgid "" -" .. note::\n" " To check out earlier revisions, you should use :hg:`update REV`.\n" " To cancel an uncommitted merge (and lose your changes),\n" " use :hg:`update --clean .`." msgstr "" -" .. note::\n" " Para obter revisões anteriores, você deve usar :hg:`update REV`.\n" " Para cancelar uma mesclagem não consolidada (e descartar suas\n" " modificações), use :hg:`update --clean .`." @@ -14735,13 +14711,11 @@ msgstr "" " com -u/--unknown (desconhecidos) ou -i/--ignored (ignorados)." msgid "" -" .. note::\n" " status may appear to disagree with diff if permissions have\n" " changed or a merge has occurred. The standard diff format does\n" " not report permission changes and diff only reports changes\n" " relative to one merge parent." msgstr "" -" .. note::\n" " o comando status pode aparentemente discordar do comando\n" " diff se ocorrer uma mudança de permissões ou uma mesclagem. O\n" " formato diff padrão não informa mudanças de permissão e o\n" @@ -23586,15 +23560,6 @@ msgstr "IPv6 indisponível nesse sistema" msgid "cannot start server at '%s:%d': %s" msgstr "não é possível iniciar o servidor em '%s:%d': %s" -msgid "exact revision search" -msgstr "busca exata por revisões" - -msgid "literal keyword search" -msgstr "busca por palavra chave literal" - -msgid "revset expression search" -msgstr "busca por expressão revset" - #, python-format msgid "(binary file %s, hash: %s)" msgstr "(arquivo binário %s, hash: %s)" @@ -24284,6 +24249,9 @@ msgstr "aplicação do patch falhou" msgid "cannot %s; remote repository does not support the %r capability" msgstr "impossível %s; repositório remoto não suporta a funcionalidade '%r'" +msgid "cannot lookup negative revision" +msgstr "não é possível buscar por uma revisão negativa" + msgid "cannot change null revision phase" msgstr "não é possível mudar a fase da revisão nula" @@ -26253,6 +26221,12 @@ msgstr "autenticação http: usuário %s, senha %s\n" msgid "command '%s' failed: %s" msgstr "falha ao executar o comando '%s' : %s" +msgid "filename ends with '\\', which is invalid on Windows" +msgstr "o nome de arquivo termina em '\\', o que não é permitido em Windows" + +msgid "directory name ends with '\\', which is invalid on Windows" +msgstr "o nome de diretório termina em '\\', o que não é permitido em Windows" + #, python-format msgid "filename contains '%s', which is reserved on Windows" msgstr "o nome de arquivo contém '%s', que é um nome reservado em Windows" diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -940,9 +940,7 @@ def show_changeset(ui, repo, opts, buffe tmpl = opts.get('template') style = None - if tmpl: - tmpl = templater.parsestring(tmpl, quoted=False) - else: + if not tmpl: style = opts.get('style') # ui settings diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -52,7 +52,7 @@ def tokenizer(data): if not decode: yield ('string', program[s:pos].replace('\\', r'\\'), s) break - yield ('string', program[s:pos].decode('string-escape'), s) + yield ('string', program[s:pos], s) break pos += 1 else: @@ -80,19 +80,19 @@ def compiletemplate(tmpl, context): parsed = [] pos, stop = 0, len(tmpl) p = parser.parser(tokenizer, elements) - while pos < stop: n = tmpl.find('{', pos) if n < 0: - parsed.append(("string", tmpl[pos:])) + parsed.append(("string", tmpl[pos:].decode("string-escape"))) break if n > 0 and tmpl[n - 1] == '\\': # escaped - parsed.append(("string", tmpl[pos:n - 1] + "{")) + parsed.append(("string", + (tmpl[pos:n - 1] + "{").decode("string-escape"))) pos = n + 1 continue if n > pos: - parsed.append(("string", tmpl[pos:n])) + parsed.append(("string", tmpl[pos:n].decode("string-escape"))) pd = [tmpl, n + 1, stop] parseres, pos = p.parse(pd) @@ -258,6 +258,13 @@ def get(context, mapping, args): key = args[1][0](context, mapping, args[1][1]) yield dictarg.get(key) +def _evalifliteral(arg, context, mapping): + t = stringify(arg[0](context, mapping, arg[1])) + if arg[0] == runstring: + yield runtemplate(context, mapping, compiletemplate(t, context)) + else: + yield t + def if_(context, mapping, args): if not (2 <= len(args) <= 3): # i18n: "if" is a keyword @@ -265,11 +272,9 @@ def if_(context, mapping, args): test = stringify(args[0][0](context, mapping, args[0][1])) if test: - t = stringify(args[1][0](context, mapping, args[1][1])) - yield runtemplate(context, mapping, compiletemplate(t, context)) + yield _evalifliteral(args[1], context, mapping) elif len(args) == 3: - t = stringify(args[2][0](context, mapping, args[2][1])) - yield runtemplate(context, mapping, compiletemplate(t, context)) + yield _evalifliteral(args[2], context, mapping) def ifeq(context, mapping, args): if not (3 <= len(args) <= 4): @@ -279,11 +284,9 @@ def ifeq(context, mapping, args): test = stringify(args[0][0](context, mapping, args[0][1])) match = stringify(args[1][0](context, mapping, args[1][1])) if test == match: - t = stringify(args[2][0](context, mapping, args[2][1])) - yield runtemplate(context, mapping, compiletemplate(t, context)) + yield _evalifliteral(args[2], context, mapping) elif len(args) == 4: - t = stringify(args[3][0](context, mapping, args[3][1])) - yield runtemplate(context, mapping, compiletemplate(t, context)) + yield _evalifliteral(args[3], context, mapping) def join(context, mapping, args): if not (1 <= len(args) <= 2): @@ -313,8 +316,7 @@ def label(context, mapping, args): raise error.ParseError(_("label expects two arguments")) # ignore args[0] (the label string) since this is supposed to be a a no-op - t = stringify(args[1][0](context, mapping, args[1][1])) - yield runtemplate(context, mapping, compiletemplate(t, context)) + yield _evalifliteral(args[1], context, mapping) def rstdoc(context, mapping, args): if len(args) != 2: diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl --- a/mercurial/templates/paper/shortlog.tmpl +++ b/mercurial/templates/paper/shortlog.tmpl @@ -80,8 +80,8 @@ return m ? m[1] : null; }, '.bigtable > tbody:nth-of-type(2)', - '\ - %text%\ + '\\ + %text%\\ ' ); diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1601,3 +1601,23 @@ Test date format: date: 70 01 01 02 +0000 date: 70 01 01 01 +0000 date: 70 01 01 00 +0000 + +Test string escaping: + + $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' + > + <>\n<[> + <>\n<]> + <>\n< + +Test recursive evaluation: + + $ hg init r + $ cd r + $ echo a > a + $ hg ci -Am '{rev}' + adding a + $ hg log -r 0 --template '{if(rev, desc)}\n' + {rev} + $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n' + test 0 diff --git a/tests/test-histedit-drop.t b/tests/test-histedit-drop.t --- a/tests/test-histedit-drop.t +++ b/tests/test-histedit-drop.t @@ -97,6 +97,7 @@ log after edit Check histedit_source $ hg log --debug --rev f518305ce889 + invalid branchheads cache (visible): tip differs changeset: 4:f518305ce889c07cb5bd05522176d75590ef3324 tag: tip phase: draft