##// END OF EJS Templates
largefiles: access to specific fields only if largefiles enabled (issue4547)...
FUJIWARA Katsunori -
r24158:d414c28d stable
parent child Browse files
Show More
@@ -577,7 +577,7 b' def getstatuswriter(ui, repo, forcibly=N'
577 Otherwise, this returns the function to always write out (or
577 Otherwise, this returns the function to always write out (or
578 ignore if ``not forcibly``) status.
578 ignore if ``not forcibly``) status.
579 '''
579 '''
580 if forcibly is None:
580 if forcibly is None and util.safehasattr(repo, '_largefilesenabled'):
581 return repo._lfstatuswriters[-1]
581 return repo._lfstatuswriters[-1]
582 else:
582 else:
583 if forcibly:
583 if forcibly:
@@ -832,6 +832,9 b' def hgclone(orig, ui, opts, *args, **kwa'
832 return result
832 return result
833
833
834 def overriderebase(orig, ui, repo, **opts):
834 def overriderebase(orig, ui, repo, **opts):
835 if not util.safehasattr(repo, '_largefilesenabled'):
836 return orig(ui, repo, **opts)
837
835 resuming = opts.get('continue')
838 resuming = opts.get('continue')
836 repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
839 repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))
837 repo._lfstatuswriters.append(lambda *msg, **opts: None)
840 repo._lfstatuswriters.append(lambda *msg, **opts: None)
@@ -24,6 +24,9 b' def reposetup(ui, repo):'
24 return
24 return
25
25
26 class lfilesrepo(repo.__class__):
26 class lfilesrepo(repo.__class__):
27 # the mark to examine whether "repo" object enables largefiles or not
28 _largefilesenabled = True
29
27 lfstatus = False
30 lfstatus = False
28 def status_nolfiles(self, *args, **kwargs):
31 def status_nolfiles(self, *args, **kwargs):
29 return super(lfilesrepo, self).status(*args, **kwargs)
32 return super(lfilesrepo, self).status(*args, **kwargs)
@@ -907,6 +907,77 b' locally (issue4109)'
907 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
907 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
908 #endif
908 #endif
909
909
910 Test overridden functions work correctly even for repos disabling
911 largefiles (issue4547)
912
913 $ hg showconfig extensions | grep largefiles
914 extensions.largefiles=!
915
916 (test updating implied by clone)
917
918 $ hg init enabled-but-no-largefiles
919 $ echo normal1 > enabled-but-no-largefiles/normal1
920 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal1
921 $ hg -R enabled-but-no-largefiles commit -m '#0@enabled-but-no-largefiles'
922 Invoking status precommit hook
923 A normal1
924 $ cat >> enabled-but-no-largefiles/.hg/hgrc <<EOF
925 > [extensions]
926 > # enable locally
927 > largefiles=
928 > EOF
929 $ hg clone -q enabled-but-no-largefiles no-largefiles
930
931 (test rebasing implied by pull: precommit while rebasing unexpectedly
932 shows "normal3" as "?", because lfdirstate isn't yet written out at
933 that time)
934
935 $ echo normal2 > enabled-but-no-largefiles/normal2
936 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal2
937 $ hg -R enabled-but-no-largefiles commit -m '#1@enabled-but-no-largefiles'
938 Invoking status precommit hook
939 A normal2
940
941 $ echo normal3 > no-largefiles/normal3
942 $ hg -R no-largefiles add no-largefiles/normal3
943 $ hg -R no-largefiles commit -m '#1@no-largefiles'
944 Invoking status precommit hook
945 A normal3
946
947 $ hg -R no-largefiles -q pull --rebase
948 Invoking status precommit hook
949 ? normal3
950
951 (test reverting)
952
953 $ hg init subrepo-root
954 $ cat >> subrepo-root/.hg/hgrc <<EOF
955 > [extensions]
956 > # enable locally
957 > largefiles=
958 > EOF
959 $ echo large > subrepo-root/large
960 $ hg -R subrepo-root add --large subrepo-root/large
961 $ hg clone -q no-largefiles subrepo-root/no-largefiles
962 $ cat > subrepo-root/.hgsub <<EOF
963 > no-largefiles = no-largefiles
964 > EOF
965 $ hg -R subrepo-root add subrepo-root/.hgsub
966 $ hg -R subrepo-root commit -m '#0'
967 Invoking status precommit hook
968 A .hgsub
969 A large
970 ? .hgsubstate
971 $ echo dirty >> subrepo-root/large
972 $ echo dirty >> subrepo-root/no-largefiles/normal1
973 $ hg -R subrepo-root status -S
974 M large
975 M no-largefiles/normal1
976 $ hg -R subrepo-root revert --all
977 reverting subrepo-root/.hglf/large (glob)
978 reverting subrepo no-largefiles
979 reverting subrepo-root/no-largefiles/normal1 (glob)
980
910 $ cd ..
981 $ cd ..
911
982
912
983
General Comments 0
You need to be logged in to leave comments. Login now