##// 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 _reportstroubledchangesets = True
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 """register a callback to issue a summary after the transaction is closed
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 def txmatch(sources):
1910 def txmatch(sources):
@@ -1927,6 +1930,9 b' def registersummarycallback(repo, otr, t'
1927 func(repo, tr)
1930 func(repo, tr)
1928
1931
1929 newcat = b'%02i-txnreport' % len(categories)
1932 newcat = b'%02i-txnreport' % len(categories)
1933 if as_validator:
1934 otr.addvalidator(newcat, wrapped)
1935 else:
1930 otr.addpostclose(newcat, wrapped)
1936 otr.addpostclose(newcat, wrapped)
1931 categories.append(newcat)
1937 categories.append(newcat)
1932 return wrapped
1938 return wrapped
@@ -1942,6 +1948,8 b' def registersummarycallback(repo, otr, t'
1942 if cgheads:
1948 if cgheads:
1943 htext = _(b" (%+d heads)") % cgheads
1949 htext = _(b" (%+d heads)") % cgheads
1944 msg = _(b"added %d changesets with %d changes to %d files%s\n")
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 assert repo is not None # help pytype
1953 assert repo is not None # help pytype
1946 repo.ui.status(msg % (cgchangesets, cgrevisions, cgfiles, htext))
1954 repo.ui.status(msg % (cgchangesets, cgrevisions, cgfiles, htext))
1947
1955
@@ -1954,7 +1962,10 b' def registersummarycallback(repo, otr, t'
1954 if newmarkers:
1962 if newmarkers:
1955 repo.ui.status(_(b'%i new obsolescence markers\n') % newmarkers)
1963 repo.ui.status(_(b'%i new obsolescence markers\n') % newmarkers)
1956 if obsoleted:
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 if obsolete.isenabled(
1970 if obsolete.isenabled(
1960 repo, obsolete.createmarkersopt
1971 repo, obsolete.createmarkersopt
@@ -2057,9 +2068,10 b' def registersummarycallback(repo, otr, t'
2057 ]
2068 ]
2058 if not published:
2069 if not published:
2059 return
2070 return
2060 repo.ui.status(
2071 msg = _(b'%d local changesets published\n')
2061 _(b'%d local changesets published\n') % len(published)
2072 if as_validator:
2062 )
2073 msg = _(b'%d local changesets will be published\n')
2074 repo.ui.status(msg % len(published))
2063
2075
2064
2076
2065 def getinstabilitymessage(delta, instability):
2077 def getinstabilitymessage(delta, instability):
General Comments 0
You need to be logged in to leave comments. Login now