[PATCH 1 of 3] lfs: always exclude '.hg*' text files
Matt Harbison
mharbison72 at gmail.com
Sun Jan 14 04:26:01 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1515892034 18000
# Sat Jan 13 20:07:14 2018 -0500
# Node ID 12187caa0688c05c7399f4a08df95f5b0630fa04
# Parent c780e0649e4152180e892418f9879b82e51542c3
lfs: always exclude '.hg*' text files
I can't think of any problematic scenarios (though things might get interesting
with .hgtags, since every head is consulted). The eol extension explicitly
disables handling these files, and that seems reasonable here too.
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -130,7 +130,9 @@
textlen -= offset
lfstrack = self.opener.options['lfstrack']
- if lfstrack(self.filename, textlen):
+
+ # Always exclude hg owned files
+ if not self.filename.startswith('.hg') and lfstrack(self.filename, textlen):
flags |= revlog.REVIDX_EXTSTORED
return orig(self, text, transaction, link, p1, p2, cachedelta=cachedelta,
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -17,7 +17,10 @@
# Commit small file
$ echo s > smallfile
- $ hg commit -Aqm "add small file"
+ $ echo '**.py = LF' > .hgeol
+ $ hg --config lfs.track='size(">1000B") | "path:.hgeol"' commit -Aqm "add small file"
+ $ hg debugdata .hgeol 0
+ **.py = LF
# Commit large file
$ echo $LONG > largefile
@@ -70,7 +73,7 @@
adding changesets
adding manifests
adding file changes
- added 2 changesets with 2 changes to 2 files
+ added 2 changesets with 3 changes to 3 files
calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
$ grep lfs $TESTTMP/server/.hg/requires
lfs
@@ -104,8 +107,8 @@
adding changesets
adding manifests
adding file changes
- added 2 changesets with 2 changes to 2 files
- new changesets b29ba743f89d:00c137947d30
+ added 2 changesets with 3 changes to 3 files
+ new changesets 0ead593177f7:b88141481348
(run 'hg update' to get a working copy)
$ grep lfs .hg/requires $TESTTMP/server/.hg/requires
.hg/requires:lfs
@@ -117,7 +120,7 @@
# Update to the last revision containing the large file
$ hg update
- 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
# Check the blobstore has been populated on update
$ find .hg/store/lfs/objects | sort
More information about the Mercurial-devel
mailing list