Mercurial > hg-stable
changeset 21883:87aa279f7073
largefiles: show also how many data entities are outgoing at "hg outgoing"
Before this patch, "hg outgoing --large" shows which largefiles are
changed or added in outgoing revisions only in the point of the view
of filenames.
For example, according to the list of outgoing largefiles shown in "hg
outgoing" output, users should expect that the former below costs much
more to upload outgoing largefiles than the latter.
- outgoing revisions add a hundred largefiles, but all of them refer
the same data entity
in this case, only one data entity is outgoing, even though "hg
summary" says that a hundred largefiles are outgoing.
- a hundred outgoing revisions change only one largefile with
distinct data
in this case, a hundred data entities are outgoing, even though
"hg summary" says that only one largefile is outgoing.
But the latter costs much more than the former, in fact.
This patch shows also how many data entities are outgoing at "hg
outgoing" by counting number of unique hash values for outgoing
largefiles.
When "--debug" is specified, this patch also shows what entities (in
hash) are outgoing for each largefiles listed up, for debug purpose.
In "ui.debugflag" route, "addfunc()" can append given "lfhash" to the
list "toupload[fn]" always without duplication check, because
de-duplication is already done in "_getoutgoings()".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 07 Jul 2014 18:45:46 +0900 |
parents | 12019e6aa8a2 |
children | a858d3de0d32 |
files | hgext/largefiles/overrides.py tests/test-largefiles-misc.t tests/test-largefiles.t |
diffstat | 3 files changed, 69 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Mon Jul 07 18:45:46 2014 +0900 +++ b/hgext/largefiles/overrides.py Mon Jul 07 18:45:46 2014 +0900 @@ -1009,15 +1009,34 @@ def outgoinghook(ui, repo, other, opts, missing): if opts.pop('large', None): - toupload = set() - lfutil.getlfilestoupload(repo, missing, - lambda fn, lfhash: toupload.add(fn)) + lfhashes = set() + if ui.debugflag: + toupload = {} + def addfunc(fn, lfhash): + if fn not in toupload: + toupload[fn] = [] + toupload[fn].append(lfhash) + lfhashes.add(lfhash) + def showhashes(fn): + for lfhash in sorted(toupload[fn]): + ui.debug(' %s\n' % (lfhash)) + else: + toupload = set() + def addfunc(fn, lfhash): + toupload.add(fn) + lfhashes.add(lfhash) + def showhashes(fn): + pass + _getoutgoings(repo, missing, addfunc) + if not toupload: ui.status(_('largefiles: no files to upload\n')) else: - ui.status(_('largefiles to upload:\n')) + ui.status(_('largefiles to upload (%d entities):\n') + % (len(lfhashes))) for file in sorted(toupload): ui.status(lfutil.splitstandin(file) + '\n') + showhashes(file) ui.status('\n') def summaryremotehook(ui, repo, opts, changes):
--- a/tests/test-largefiles-misc.t Mon Jul 07 18:45:46 2014 +0900 +++ b/tests/test-largefiles-misc.t Mon Jul 07 18:45:46 2014 +0900 @@ -478,7 +478,7 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: #1 - largefiles to upload: + largefiles to upload (1 entities): b $ hg -R clone2 outgoing --large --graph --template "{rev}" @@ -486,7 +486,7 @@ searching for changes @ 1 - largefiles to upload: + largefiles to upload (1 entities): b @@ -509,11 +509,28 @@ searching for changes 1:1acbe71ce432 2:6095d0695d70 - largefiles to upload: + largefiles to upload (1 entities): b b1 b2 + $ hg -R clone2 cat -r 1 clone2/.hglf/b + 89e6c98d92887913cadf06b2adb97f26cde4849b + $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug + comparing with $TESTTMP/issue3651/src (glob) + query 1; heads + searching for changes + all remote heads known locally + 1:1acbe71ce432 + 2:6095d0695d70 + largefiles to upload (1 entities): + b + 89e6c98d92887913cadf06b2adb97f26cde4849b + b1 + 89e6c98d92887913cadf06b2adb97f26cde4849b + b2 + 89e6c98d92887913cadf06b2adb97f26cde4849b + $ echo bbb > clone2/b $ hg -R clone2 commit -m '#3: add new largefile entity as existing file' @@ -542,11 +559,35 @@ 3:7983dce246cc 4:233f12ada4ae 5:036794ea641c - largefiles to upload: + largefiles to upload (3 entities): b b1 b2 + $ hg -R clone2 cat -r 3 clone2/.hglf/b + c801c9cfe94400963fcb683246217d5db77f9a9a + $ hg -R clone2 cat -r 4 clone2/.hglf/b + 13f9ed0898e315bf59dc2973fec52037b6f441a2 + $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug + comparing with $TESTTMP/issue3651/src (glob) + query 1; heads + searching for changes + all remote heads known locally + 1:1acbe71ce432 + 2:6095d0695d70 + 3:7983dce246cc + 4:233f12ada4ae + 5:036794ea641c + largefiles to upload (3 entities): + b + 13f9ed0898e315bf59dc2973fec52037b6f441a2 + 89e6c98d92887913cadf06b2adb97f26cde4849b + c801c9cfe94400963fcb683246217d5db77f9a9a + b1 + 89e6c98d92887913cadf06b2adb97f26cde4849b + b2 + 89e6c98d92887913cadf06b2adb97f26cde4849b + $ cd ..