topics: add a config to reject draft changeset without topic on a server
This patch adds a new config option experimental.topic-mode.server which if
sets to True, the server won't accept any draft changeset without topic on it.
In case both `experimental.topic-mode.server` and
`experimental.topic.publish-bare-branch` are set to True, the enforce-topic one
is respected.
Tests are added for it. The CHANGELOG file is also updated mentioning about the
config option.
$cat>>$HGRCPATH<<EOF>[defaults]>amend=-d"0 0">fold=-d"0 0">metaedit=-d"0 0">[web]>push_ssl=false>allow_push=*>[phases]>publish=False>[alias]>qlog=log--template='{rev} - {node|short}{desc} ({phase})\n'>[diff]>git=1>unified=0>[extensions]>EOF$echo"evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/">>$HGRCPATH$mkcommit(){>echo"$1">"$1">hgadd"$1">hgci-m"$1">}$mkstack(){>#Createsastackofcommitbasedon$1withmessagesfrom$2,$3..>hgupdate$1-C>shift>mkcommits$*>}$glog(){>hglog-G--template'{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n'"$@">}$shaof(){>hglog-T{node}-r"first(desc($1))">}$mkcommits(){>foriin$@;domkcommit$i;done>}##########################importingParrentest##########################$cat<<EOF>>$HGRCPATH>[ui]>logtemplate="{rev}\t{bookmarks}: {desc|firstline} - {author|user}\n">EOFHGMETAEDIT===============================SetuptheBaseRepo-------------------Westartwithaplainbaserepo::$hginit$TESTTMP/metaedit;cd$TESTTMP/metaedit$mkcommit"ROOT"$hgphase--public"desc(ROOT)"$mkcommit"A"$mkcommit"B"$hgup"desc(A)"0filesupdated,0filesmerged,1filesremoved,0filesunresolved$mkcommit"C"creatednewhead$mkcommit"D"$echo"D'">D$hgamend-m"D2"$hgup"desc(C)"0filesupdated,0filesmerged,1filesremoved,0filesunresolved$mkcommit"E"creatednewhead$mkcommit"F"Test----$hglog-G@7:F-test|o6:E-test||o5:D2-test|/o3:C-test||o2:B-test|/o1:A-test|o0:ROOT-test$hgupdate--clean.0filesupdated,0filesmerged,0filesremoved,0filesunresolved$hgmetaedit-r0abort:cannoteditcommitinformationforpublicrevisions[255]$hgmetaedit--foldabort:revisionsmustbespecifiedwith--fold[255]$hgmetaedit-r0--foldabort:cannotfoldpublicchangesets:ea207398892e(see'hg help phases'fordetails)[255]$hgmetaedit'desc(C) + desc(F)'--foldabort:cannotfoldnon-linearrevisions(multiplerootsgiven)[255]$hgmetaedit"desc(C)::desc(D2) + desc(E)"--foldabort:cannotfoldnon-linearrevisions(multipleheadsgiven)[255]checkthatmetaeditrespectsallowunstable$hgmetaedit'.^'--config'experimental.evolution=createmarkers, allnewcommands'abort:cannoteditcommitinformationinthemiddleofastack(587528abfffewillbecomeunstableandnewunstablechangesarenotallowed)[255]$hgmetaedit'desc(A)::desc(B)'--fold--config'experimental.evolution=createmarkers, allnewcommands'abort:foldwillorphan4descendants(see'hg help evolution.instability')[255]$hgmetaedit--userfoobar0filesupdated,0filesmerged,0filesremoved,0filesunresolved$hglog--template'{rev}: {author}\n'-r'desc(F):'--hidden7:test8:foobar$hglog--template'{rev}: {author}\n'-r.8:foobarTODO:supportthis$hgmetaedit'.^::.'abort:editingmultiplerevisionswithout--foldisnotcurrentlysupported[255]$HGEDITOR=cathgmetaedit'.^::.'--fold--note'folding changesets using metaedit, > and newlines'abort:notecannotcontainanewline[255]$HGEDITOR=cathgmetaedit'.^::.'--fold--note"folding changesets using metaedit"HG:Thisisafoldof2changesets.HG:Commitmessageofchangeset6.EHG:Commitmessageofchangeset8.FHG:Entercommitmessage.Linesbeginningwith'HG:'areremoved.HG:Leavemessageemptytoabortcommit.HG:--HG:user:testHG:branch'default'HG:addedEHG:addedF2changesetsfolded0filesupdated,0filesmerged,0filesremoved,0filesunresolved$glog-r.@9:a08d35fd7d9d@default(draft)E|~$hgobslog-r.@a08d35fd7d9d(9)E|\x|212b2a2b87cd(8)F||rewritten(description,user,parent,content)asa08d35fd7d9dbytest(ThuJan0100:00:001970+0000)||note:foldingchangesetsusingmetaedit|||xc2bd843aa246(6)E|rewritten(description,content)asa08d35fd7d9dbytest(ThuJan0100:00:001970+0000)|note:foldingchangesetsusingmetaedit|x587528abfffe(7)Frewritten(user)as212b2a2b87cdbytest(ThuJan0100:00:001970+0000)nonewcommitiscreatedherebecausethedateisthesame$HGEDITOR=cathgmetaeditEFHG:Entercommitmessage.Linesbeginningwith'HG:'areremoved.HG:Leavemessageemptytoabortcommit.HG:--HG:user:testHG:branch'default'HG:addedEHG:addedFnothingchanged$glog-r'.^::.'@9:a08d35fd7d9d@default(draft)E|o3:3260958f1169@default(draft)C|~TODO:don't create a new commit in this case, we should take the date of theold commit (we add a default date with a value to show that metaedit is takingthe current date to generate the hash, this way we still have a stable hashbut highlight the bug) $ hg metaedit --config defaults.metaedit= --config devel.default-date="42 0" 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r '.^::.' --template '{rev}:{desc|firstline}\n' 3: C 10: E $ hg up .^ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg metaedit --user foobar2 tip $ hg log --template '{rev}:{author}\n' -r "user(foobar):" --hidden 8: foobar 9: test 10: test 11: foobar2 $ hg diff -r "10" -r "11" --hidden'fold' one commit $ HGUSER=foobar3 hg metaedit "desc(D2)" --fold -U 1 changesets folded $ hg log -r "tip" --template '{rev}:{author}\n' 12: foobar3