##// END OF EJS Templates
scmutil: add option to register summary callbacks as transaction validators...
Pulkit Goyal -
r45032:13da36d7 default
parent child Browse files
Show More
@@ -1900,8 +1900,11 b' fileprefetchhooks = util.hooks()'
1900 1900 _reportstroubledchangesets = True
1901 1901
1902 1902
1903 def registersummarycallback(repo, otr, txnname=b''):
1903 def registersummarycallback(repo, otr, txnname=b'', as_validator=False):
1904 1904 """register a callback to issue a summary after the transaction is closed
1905
1906 If as_validator is true, then the callbacks are registered as transaction
1907 validators instead
1905 1908 """
1906 1909
1907 1910 def txmatch(sources):
@@ -1927,7 +1930,10 b' def registersummarycallback(repo, otr, t'
1927 1930 func(repo, tr)
1928 1931
1929 1932 newcat = b'%02i-txnreport' % len(categories)
1930 otr.addpostclose(newcat, wrapped)
1933 if as_validator:
1934 otr.addvalidator(newcat, wrapped)
1935 else:
1936 otr.addpostclose(newcat, wrapped)
1931 1937 categories.append(newcat)
1932 1938 return wrapped
1933 1939
@@ -1942,6 +1948,8 b' def registersummarycallback(repo, otr, t'
1942 1948 if cgheads:
1943 1949 htext = _(b" (%+d heads)") % cgheads
1944 1950 msg = _(b"added %d changesets with %d changes to %d files%s\n")
1951 if as_validator:
1952 msg = _(b"adding %d changesets with %d changes to %d files%s\n")
1945 1953 assert repo is not None # help pytype
1946 1954 repo.ui.status(msg % (cgchangesets, cgrevisions, cgfiles, htext))
1947 1955
@@ -1954,7 +1962,10 b' def registersummarycallback(repo, otr, t'
1954 1962 if newmarkers:
1955 1963 repo.ui.status(_(b'%i new obsolescence markers\n') % newmarkers)
1956 1964 if obsoleted:
1957 repo.ui.status(_(b'obsoleted %i changesets\n') % len(obsoleted))
1965 msg = _(b'obsoleted %i changesets\n')
1966 if as_validator:
1967 msg = _(b'obsoleting %i changesets\n')
1968 repo.ui.status(msg % len(obsoleted))
1958 1969
1959 1970 if obsolete.isenabled(
1960 1971 repo, obsolete.createmarkersopt
@@ -2057,9 +2068,10 b' def registersummarycallback(repo, otr, t'
2057 2068 ]
2058 2069 if not published:
2059 2070 return
2060 repo.ui.status(
2061 _(b'%d local changesets published\n') % len(published)
2062 )
2071 msg = _(b'%d local changesets published\n')
2072 if as_validator:
2073 msg = _(b'%d local changesets will be published\n')
2074 repo.ui.status(msg % len(published))
2063 2075
2064 2076
2065 2077 def getinstabilitymessage(delta, instability):
General Comments 0
You need to be logged in to leave comments. Login now