##// END OF EJS Templates
largefiles: enable islfilesrepo() prior to a commit (issue3541)...
Matt Harbison -
r17659:ae57920a stable
parent child Browse files
Show More
@@ -141,7 +141,7 b' class largefilesdirstate(dirstate.dirsta'
141 141 def normallookup(self, f):
142 142 return super(largefilesdirstate, self).normallookup(unixpath(f))
143 143
144 def openlfdirstate(ui, repo):
144 def openlfdirstate(ui, repo, create=True):
145 145 '''
146 146 Return a dirstate object that tracks largefiles: i.e. its root is
147 147 the repo root, but it is saved in .hg/largefiles/dirstate.
@@ -154,7 +154,7 b' def openlfdirstate(ui, repo):'
154 154 # If the largefiles dirstate does not exist, populate and create
155 155 # it. This ensures that we create it on the first meaningful
156 156 # largefiles operation in a new clone.
157 if not os.path.exists(os.path.join(admin, 'dirstate')):
157 if create and not os.path.exists(os.path.join(admin, 'dirstate')):
158 158 util.makedirs(admin)
159 159 matcher = getstandinmatcher(repo)
160 160 for standin in dirstatewalk(repo.dirstate, matcher):
@@ -435,8 +435,11 b' def unixpath(path):'
435 435 return util.pconvert(os.path.normpath(path))
436 436
437 437 def islfilesrepo(repo):
438 return ('largefiles' in repo.requirements and
439 util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
438 if ('largefiles' in repo.requirements and
439 util.any(shortname + '/' in f[0] for f in repo.store.datafiles())):
440 return True
441
442 return util.any(openlfdirstate(repo.ui, repo, False))
440 443
441 444 class storeprotonotcapable(Exception):
442 445 def __init__(self, storetypes):
@@ -1583,3 +1583,40 b' Lock in subrepo, otherwise the change is'
1583 1583 lf_subrepo_archive/subrepo/normal.txt
1584 1584
1585 1585 $ cd ..
1586
1587 Test that addremove picks up largefiles prior to the initial commit (issue3541)
1588
1589 $ hg init addrm2
1590 $ cd addrm2
1591 $ touch large.dat
1592 $ touch large2.dat
1593 $ touch normal
1594 $ hg add --large large.dat
1595 $ hg addremove -v
1596 adding large2.dat as a largefile
1597 adding normal
1598
1599 Test that forgetting all largefiles reverts to islfilesrepo() == False
1600 (addremove will add *.dat as normal files now)
1601 $ hg forget large.dat
1602 $ hg forget large2.dat
1603 $ hg addremove -v
1604 adding large.dat
1605 adding large2.dat
1606
1607 Test commit's addremove option prior to the first commit
1608 $ hg forget large.dat
1609 $ hg forget large2.dat
1610 $ hg add --large large.dat
1611 $ hg ci -Am "commit"
1612 adding large2.dat as a largefile
1613 Invoking status precommit hook
1614 A large.dat
1615 A large2.dat
1616 A normal
1617 $ find .hglf/ | sort
1618 .hglf/
1619 .hglf/large.dat
1620 .hglf/large2.dat
1621
1622 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now