[PATCH STABLE] largefiles: fix largefiles+subrepo update (issue3752)
Mads Kiilerich
mads at kiilerich.com
Tue Jan 22 23:00:24 UTC 2013
On 01/22/2013 08:48 AM, Benoit Boissinot wrote:
> # HG changeset patch
> # User Benoit Boissinot <benoit.boissinot at ens-lyon.org>
> # Date 1358840881 -3600
> # Branch stable
> # Node ID f648a1ac2a3db36d1e6872ed87a7713892c1c4e3
> # Parent 9354a8c1bdedec8e60d9b00aeba7cd2a4bd681a0
> largefiles: fix largefiles+subrepo update (issue3752)
>
> Override updaterepo() instead of individual methods that may not be called for
> each subrepo. Add test.
> Based on patch from Matt Harbison.
>
> Changes the order of update-related messages (now largefiles comes before the
> global status).
This looks good as a stable patch.
A couple of details:
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -669,20 +669,20 @@
> finally:
> wlock.release()
>
> -def hgupdate(orig, repo, node):
> - # Only call updatelfiles the standins that have changed to save time
> - oldstandins = lfutil.getstandinsstate(repo)
> - result = orig(repo, node)
> - newstandins = lfutil.getstandinsstate(repo)
> - filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
> +def hgupdaterepo(orig, repo, node, overwrite):
> + if not overwrite:
> + # Only call updatelfiles on the standins that have changed to save time
> + oldstandins = lfutil.getstandinsstate(repo)
> +
> + result = orig(repo, node, overwrite)
> +
> + filelist = None
> + if not overwrite:
> + newstandins = lfutil.getstandinsstate(repo)
> + filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
> lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True)
instead of reusing this line
> return result
>
> -def hgclean(orig, repo, node, show_stats=True):
> - result = orig(repo, node, show_stats)
> - lfcommands.updatelfiles(repo.ui, repo)
please choose merge with this one and drop the redundant printmessage.
> - return result
> -
> def hgmerge(orig, repo, node, force=None, remind=True):
> # Mark the repo as being in the middle of a merge, so that
> # updatelfiles() will know that it needs to trust the standins in
> diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
> --- a/hgext/largefiles/uisetup.py
> +++ b/hgext/largefiles/uisetup.py
> @@ -109,11 +109,7 @@
> entry = extensions.wrapfunction(commands, 'revert',
> overrides.overriderevert)
>
> - # clone uses hg._update instead of hg.update even though they are the
> - # same function... so wrap both of them)
> - extensions.wrapfunction(hg, 'update', overrides.hgupdate)
> - extensions.wrapfunction(hg, '_update', overrides.hgupdate)
> - extensions.wrapfunction(hg, 'clean', overrides.hgclean)
> + extensions.wrapfunction(hg, 'updaterepo', overrides.hgupdaterepo)
> extensions.wrapfunction(hg, 'merge', overrides.hgmerge)
>
> extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
> diff --git a/tests/test-issue3084.t b/tests/test-issue3084.t
> --- a/tests/test-issue3084.t
> +++ b/tests/test-issue3084.t
> @@ -16,9 +16,9 @@
> $ hg commit -m "Add foo as a largefile"
>
> $ hg update -r 0
> - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> getting changed largefiles
> 0 largefiles updated, 1 removed
> + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>
> $ echo "normal" > foo
> $ hg add foo
> diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
> --- a/tests/test-largefiles-cache.t
> +++ b/tests/test-largefiles-cache.t
> @@ -45,27 +45,27 @@
> "missing"(!) file.
>
> $ hg update
> + getting changed largefiles
> + error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally
> + 0 largefiles updated, 0 removed
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> - getting changed largefiles
> - error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally (glob)
some globs are lost throughout the test - they are probably needed for
handling windows paths.
/Mads
More information about the Mercurial-devel
mailing list