Mercurial > evolve
changeset 6614:e0596b012b69
branching: merge with stable
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 16 Dec 2023 13:23:38 -0300 |
parents | c92d2c61dec8 (current diff) 5199463aef07 (diff) |
children | 9e442e116621 |
files | hgext3rd/topic/__init__.py |
diffstat | 4 files changed, 56 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG Sat Nov 11 16:21:23 2023 -0300 +++ b/CHANGELOG Sat Dec 16 13:23:38 2023 -0300 @@ -8,6 +8,10 @@ recommended for all users, clients and servers * evolve: don't warn about topics while resolving public content-divergence + * evolve: add obsdiff as alternative for odiff + * evolve: retain certain commit extras when relocating a commit + + * pick: update commit message hashes like other rewrite commands * evolve, pullbundle: drop compatibility with Mercurial 4.8 @@ -16,8 +20,6 @@ * remove deprecated serverminitopic extension, topic extension is recommended for all users, clients and servers - * pick: update commit message hashes like other rewrite commands - * topic namespaces: add `experimental.tns-allow-rewrite` config option to check topic namespace before rewriting changesets (known limitations: does not prevent rebase and histedit from editing changesets outside of
--- a/hgext3rd/topic/__init__.py Sat Nov 11 16:21:23 2023 -0300 +++ b/hgext3rd/topic/__init__.py Sat Dec 16 13:23:38 2023 -0300 @@ -693,7 +693,8 @@ @property def currenttns(self): - return self.vfs.tryread(b'topic-namespace') or b'none' + tns = self.vfs.tryread(b'topic-namespace') or b'none' + return encoding.tolocal(tns) @util.propertycache def _topiccache(self): @@ -712,7 +713,8 @@ @property def currenttopic(self): - return self.vfs.tryread(b'topic') + topic = self.vfs.tryread(b'topic') + return encoding.tolocal(topic) # overwritten at the instance level by topicmap.py _autobranchmaptopic = True @@ -1096,7 +1098,7 @@ # Have some restrictions on the topic name just like bookmark name scmutil.checknewlabel(repo, topic, b'topic') - helptxt = _(b"topic names can only consist of alphanumeric, '-'" + helptxt = _(b"topic names can only consist of alphanumeric, '-'," b" '_' and '.' characters") try: utopic = encoding.unifromlocal(topic) @@ -1843,6 +1845,18 @@ if b'/' in tns: raise error.Abort(_(b"topic namespace cannot contain '/' character")) scmutil.checknewlabel(repo, tns, b'topic namespace') + + helptxt = _(b"topic namespace names can only consist of alphanumeric, " + b"'-', '_' and '.' characters") + try: + utns = encoding.unifromlocal(tns) + except error.Abort: + # Maybe we should allow these topic names as well, as long as they + # don't break any other rules + utns = '' + rmatch = re.match(r'[-_.\w]+', utns, re.UNICODE) + if not utns or not rmatch or rmatch.group(0) != utns: + raise compat.InputError(_(b"invalid topic namespace name: '%s'") % tns, hint=helptxt) ctns = repo.currenttns _changecurrenttns(repo, tns) if ctns == b'none' and tns != b'none':
--- a/tests/test-namespaces.t Sat Nov 11 16:21:23 2023 -0300 +++ b/tests/test-namespaces.t Sat Dec 16 13:23:38 2023 -0300 @@ -31,6 +31,28 @@ $ hg log -r 'wdir()' -T '{fqbn}\n' default//space-name/feature +Non-ascii topic namespace name + + $ hg debug-topic-namespace --clear + $ hg --encoding utf-8 debug-topic-namespace æ + marked working directory as topic namespace: \xc3\xa6 (esc) + $ hg --encoding utf-8 debug-topic-namespaces + æ (esc) + $ hg --encoding ascii debug-topic-namespaces + ? (esc) + $ hg --encoding latin1 debug-topic-namespaces + \xe6 (esc) + + $ hg --encoding utf-8 debug-topic-namespace © + abort: invalid topic namespace name: '\xc2\xa9' (esc) + (topic namespace names can only consist of alphanumeric, '-', '_' and '.' characters) + [10] + + $ hg --encoding latin1 debug-topic-namespace æ + abort: invalid topic namespace name: '\xc3\xa6' (esc) + (topic namespace names can only consist of alphanumeric, '-', '_' and '.' characters) + [10] + $ hg branches $ hg debug-topic-namespace --clear
--- a/tests/test-topic.t Sat Nov 11 16:21:23 2023 -0300 +++ b/tests/test-topic.t Sat Dec 16 13:23:38 2023 -0300 @@ -285,12 +285,12 @@ $ hg topic 'a12#45' abort: invalid topic name: 'a12#45' - (topic names can only consist of alphanumeric, '-' '_' and '.' characters) + (topic names can only consist of alphanumeric, '-', '_' and '.' characters) [10] $ hg topic 'foo bar' abort: invalid topic name: 'foo bar' - (topic names can only consist of alphanumeric, '-' '_' and '.' characters) + (topic names can only consist of alphanumeric, '-', '_' and '.' characters) [10] this is trying to list topic names @@ -298,7 +298,7 @@ $ hg topic '*12 B23' abort: invalid topic name: '*12 B23' - (topic names can only consist of alphanumeric, '-' '_' and '.' characters) + (topic names can only consist of alphanumeric, '-', '_' and '.' characters) [10] Test commit flag and help text @@ -322,20 +322,25 @@ Non-ascii topic name + $ hg topic --clear + clearing empty topic "topicflag" $ hg --encoding utf-8 topic æ - $ hg topics - * \xc3\xa6 (0 changesets) (esc) + marked working directory as topic: \xc3\xa6 (esc) + $ hg --encoding utf-8 topics + * æ (0 changesets) (esc) + $ hg --encoding ascii topics + * ? (0 changesets) (esc) $ hg --encoding latin1 topics - * \xc3\xa6 (0 changesets) (esc) + * \xe6 (0 changesets) (esc) $ hg --encoding utf-8 topic © abort: invalid topic name: '\xc2\xa9' (esc) - (topic names can only consist of alphanumeric, '-' '_' and '.' characters) + (topic names can only consist of alphanumeric, '-', '_' and '.' characters) [10] $ hg --encoding latin1 topic æ abort: invalid topic name: '\xc3\xa6' (esc) - (topic names can only consist of alphanumeric, '-' '_' and '.' characters) + (topic names can only consist of alphanumeric, '-', '_' and '.' characters) [10] Make a topic