mercurial/changegroup.py
changeset 42897 d7304434390f
parent 42813 268662aac075
child 43059 4bbc9569e722
equal deleted inserted replaced
42896:7e19b640c53e 42897:d7304434390f
   268             return len(cl)
   268             return len(cl)
   269 
   269 
   270         def revmap(x):
   270         def revmap(x):
   271             return cl.rev(x)
   271             return cl.rev(x)
   272 
   272 
   273         changesets = files = revisions = 0
   273         changesets = 0
   274 
   274 
   275         try:
   275         try:
   276             # The transaction may already carry source information. In this
   276             # The transaction may already carry source information. In this
   277             # case we use the top level data. We overwrite the argument
   277             # case we use the top level data. We overwrite the argument
   278             # because we need to use the top level value (if they exist)
   278             # because we need to use the top level value (if they exist)
   335 
   335 
   336             # process the files
   336             # process the files
   337             repo.ui.status(_("adding file changes\n"))
   337             repo.ui.status(_("adding file changes\n"))
   338             newrevs, newfiles = _addchangegroupfiles(
   338             newrevs, newfiles = _addchangegroupfiles(
   339                 repo, self, revmap, trp, efiles, needfiles)
   339                 repo, self, revmap, trp, efiles, needfiles)
   340             revisions += newrevs
   340 
   341             files += newfiles
   341             # making sure the value exists
       
   342             tr.changes.setdefault('changegroup-count-changesets', 0)
       
   343             tr.changes.setdefault('changegroup-count-revisions', 0)
       
   344             tr.changes.setdefault('changegroup-count-files', 0)
       
   345             tr.changes.setdefault('changegroup-count-heads', 0)
       
   346 
       
   347             # some code use bundle operation for internal purpose. They usually
       
   348             # set `ui.quiet` to do this outside of user sight. Size the report
       
   349             # of such operation now happens at the end of the transaction, that
       
   350             # ui.quiet has not direct effect on the output.
       
   351             #
       
   352             # To preserve this intend use an inelegant hack, we fail to report
       
   353             # the change if `quiet` is set. We should probably move to
       
   354             # something better, but this is a good first step to allow the "end
       
   355             # of transaction report" to pass tests.
       
   356             if not repo.ui.quiet:
       
   357                 tr.changes['changegroup-count-changesets'] += changesets
       
   358                 tr.changes['changegroup-count-revisions'] += newrevs
       
   359                 tr.changes['changegroup-count-files'] += newfiles
   342 
   360 
   343             deltaheads = 0
   361             deltaheads = 0
   344             if oldheads:
   362             if oldheads:
   345                 heads = cl.heads()
   363                 heads = cl.heads()
   346                 deltaheads = len(heads) - len(oldheads)
   364                 deltaheads += len(heads) - len(oldheads)
   347                 for h in heads:
   365                 for h in heads:
   348                     if h not in oldheads and repo[h].closesbranch():
   366                     if h not in oldheads and repo[h].closesbranch():
   349                         deltaheads -= 1
   367                         deltaheads -= 1
   350             htext = ""
   368 
   351             if deltaheads:
   369             # see previous comment about checking ui.quiet
   352                 htext = _(" (%+d heads)") % deltaheads
   370             if not repo.ui.quiet:
   353 
   371                 tr.changes['changegroup-count-heads'] += deltaheads
   354             repo.ui.status(_("added %d changesets"
       
   355                              " with %d changes to %d files%s\n")
       
   356                              % (changesets, revisions, files, htext))
       
   357             repo.invalidatevolatilesets()
   372             repo.invalidatevolatilesets()
   358 
   373 
   359             if changesets > 0:
   374             if changesets > 0:
   360                 if 'node' not in tr.hookargs:
   375                 if 'node' not in tr.hookargs:
   361                     tr.hookargs['node'] = hex(cl.node(clstart))
   376                     tr.hookargs['node'] = hex(cl.node(clstart))