Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 6775:6adcc5c7c1f1
branching: merge with stable
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 14 Apr 2024 00:41:49 -0300 |
parents | 71c4b6c2bcdc 564e3d3d9799 |
children | ed00ed185249 |
comparison
equal
deleted
inserted
replaced
6748:c6ff8ae8a752 | 6775:6adcc5c7c1f1 |
---|---|
294 default=configitems.dynamicdefault, | 294 default=configitems.dynamicdefault, |
295 ) | 295 ) |
296 configitem(b'experimental', b'tns-default-pull-namespaces', | 296 configitem(b'experimental', b'tns-default-pull-namespaces', |
297 default=configitems.dynamicdefault, | 297 default=configitems.dynamicdefault, |
298 ) | 298 ) |
299 configitem(b'experimental', b'tns-reject-push', | |
300 default=False, | |
301 ) | |
299 configitem(b'experimental', b'topic-mode.server', | 302 configitem(b'experimental', b'topic-mode.server', |
300 default=configitems.dynamicdefault, | 303 default=configitems.dynamicdefault, |
301 ) | 304 ) |
302 configitem(b'experimental', b'topic.server-gate-topic-changesets', | 305 configitem(b'experimental', b'topic.server-gate-topic-changesets', |
303 default=False, | 306 default=False, |
866 def _validate_publish(tr2): | 869 def _validate_publish(tr2): |
867 repo = reporef() | 870 repo = reporef() |
868 flow.reject_publish(repo, tr2) | 871 flow.reject_publish(repo, tr2) |
869 | 872 |
870 tr.addvalidator(b'000-reject-publish', _validate_publish) | 873 tr.addvalidator(b'000-reject-publish', _validate_publish) |
874 | |
875 if self.ui.configbool(b'experimental', b'tns-reject-push'): | |
876 def _validate_csets_with_tns(tr2): | |
877 repo = reporef() | |
878 flow.reject_csets_with_tns(repo, tr2) | |
879 | |
880 tr.addvalidator(b'000-reject-csets-with-tns', _validate_csets_with_tns) | |
871 | 881 |
872 def _validate_affected_tns(tr2): | 882 def _validate_affected_tns(tr2): |
873 repo = reporef() | 883 repo = reporef() |
874 assert repo is not None # help pytype | 884 assert repo is not None # help pytype |
875 find_affected_tns(repo, tr2) | 885 find_affected_tns(repo, tr2) |
1851 if not condition: | 1861 if not condition: |
1852 condition = [b'none()'] | 1862 condition = [b'none()'] |
1853 revs = repo.revs(b'not public() and not obsolete() and (%lr)', condition) | 1863 revs = repo.revs(b'not public() and not obsolete() and (%lr)', condition) |
1854 if opts[b'clear']: | 1864 if opts[b'clear']: |
1855 with repo.wlock(), repo.lock(), repo.transaction(b'debug-default-topic-namespace'): | 1865 with repo.wlock(), repo.lock(), repo.transaction(b'debug-default-topic-namespace'): |
1866 successors = {} | |
1856 for rev in revs: | 1867 for rev in revs: |
1857 _clear_tns_extras(ui, repo, rev) | 1868 _clear_tns_extras(ui, repo, rev, successors) |
1869 scmutil.cleanupnodes(repo, successors, b'debug-default-topic-namespace') | |
1858 return | 1870 return |
1859 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) | 1871 displayer = logcmdutil.changesetdisplayer(ui, repo, opts) |
1860 logcmdutil.displayrevs(ui, repo, revs, displayer, None) | 1872 logcmdutil.displayrevs(ui, repo, revs, displayer, None) |
1861 | 1873 |
1862 def _clear_tns_extras(ui, repo, rev): | 1874 def _clear_tns_extras(ui, repo, rev, successors): |
1863 ctx = repo[rev] | 1875 ctx = repo[rev] |
1864 | 1876 |
1865 if len(ctx.parents()) > 1: | 1877 if len(ctx.parents()) > 1: |
1866 # ctx.files() isn't reliable for merges, so fall back to the | 1878 # ctx.files() isn't reliable for merges, so fall back to the |
1867 # slower repo.status() method | 1879 # slower repo.status() method |
1879 extra = ctx.extra().copy() | 1891 extra = ctx.extra().copy() |
1880 del extra[b'topic-namespace'] | 1892 del extra[b'topic-namespace'] |
1881 | 1893 |
1882 p1 = ctx.p1().node() | 1894 p1 = ctx.p1().node() |
1883 p2 = ctx.p2().node() | 1895 p2 = ctx.p2().node() |
1896 if p1 in successors: | |
1897 p1 = successors[p1][0] | |
1898 if p2 in successors: | |
1899 p2 = successors[p2][0] | |
1884 mc = context.memctx(repo, | 1900 mc = context.memctx(repo, |
1885 (p1, p2), | 1901 (p1, p2), |
1886 ctx.description(), | 1902 ctx.description(), |
1887 files, | 1903 files, |
1888 filectxfn, | 1904 filectxfn, |
1892 | 1908 |
1893 overrides = {(b'phases', b'new-commit'): ctx.phase()} | 1909 overrides = {(b'phases', b'new-commit'): ctx.phase()} |
1894 with repo.ui.configoverride(overrides, b'debug-default-topic-namespace'): | 1910 with repo.ui.configoverride(overrides, b'debug-default-topic-namespace'): |
1895 newnode = repo.commitctx(mc) | 1911 newnode = repo.commitctx(mc) |
1896 | 1912 |
1897 replacements = {(ctx.node(),): (newnode,)} | 1913 successors[ctx.node()] = (newnode,) |
1898 scmutil.cleanupnodes(repo, replacements, b'debug-default-topic-namespace') | |
1899 | 1914 |
1900 @command(b'debug-parse-fqbn', commands.formatteropts, _(b'FQBN'), optionalrepo=True) | 1915 @command(b'debug-parse-fqbn', commands.formatteropts, _(b'FQBN'), optionalrepo=True) |
1901 def debugparsefqbn(ui, repo, fqbn, **opts): | 1916 def debugparsefqbn(ui, repo, fqbn, **opts): |
1902 """parse branch//namespace/topic string into its components""" | 1917 """parse branch//namespace/topic string into its components""" |
1903 branch, tns, topic = common.parsefqbn(fqbn) | 1918 branch, tns, topic = common.parsefqbn(fqbn) |