##// END OF EJS Templates
changegroup: do not delta lfs revisions...
Jun Wu -
r36764:d031609b stable
parent child Browse files
Show More
@@ -770,6 +770,8 b' class cg1packer(object):'
770 progress(msgbundling, None)
770 progress(msgbundling, None)
771
771
772 def deltaparent(self, revlog, rev, p1, p2, prev):
772 def deltaparent(self, revlog, rev, p1, p2, prev):
773 if not revlog.candelta(prev, rev):
774 raise error.ProgrammingError('cg1 should not be used in this case')
773 return prev
775 return prev
774
776
775 def revchunk(self, revlog, rev, prev, linknode):
777 def revchunk(self, revlog, rev, prev, linknode):
@@ -829,16 +831,19 b' class cg2packer(cg1packer):'
829 # expensive. The revlog caches should have prev cached, meaning
831 # expensive. The revlog caches should have prev cached, meaning
830 # less CPU for changegroup generation. There is likely room to add
832 # less CPU for changegroup generation. There is likely room to add
831 # a flag and/or config option to control this behavior.
833 # a flag and/or config option to control this behavior.
832 return prev
834 base = prev
833 elif dp == nullrev:
835 elif dp == nullrev:
834 # revlog is configured to use full snapshot for a reason,
836 # revlog is configured to use full snapshot for a reason,
835 # stick to full snapshot.
837 # stick to full snapshot.
836 return nullrev
838 base = nullrev
837 elif dp not in (p1, p2, prev):
839 elif dp not in (p1, p2, prev):
838 # Pick prev when we can't be sure remote has the base revision.
840 # Pick prev when we can't be sure remote has the base revision.
839 return prev
841 return prev
840 else:
842 else:
841 return dp
843 base = dp
844 if base != nullrev and not revlog.candelta(base, rev):
845 base = nullrev
846 return base
842
847
843 def builddeltaheader(self, node, p1n, p2n, basenode, linknode, flags):
848 def builddeltaheader(self, node, p1n, p2n, basenode, linknode, flags):
844 # Do nothing with flags, it is implicitly 0 in cg1 and cg2
849 # Do nothing with flags, it is implicitly 0 in cg1 and cg2
@@ -77,6 +77,8 b' REVIDX_FLAGS_ORDER = ['
77 REVIDX_EXTSTORED,
77 REVIDX_EXTSTORED,
78 ]
78 ]
79 REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
79 REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
80 # bitmark for flags that could cause rawdata content change
81 REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED
80
82
81 # max size of revlog with inline data
83 # max size of revlog with inline data
82 _maxinline = 131072
84 _maxinline = 131072
@@ -96,7 +98,8 b' def addflagprocessor(flag, processor):'
96 """Register a flag processor on a revision data flag.
98 """Register a flag processor on a revision data flag.
97
99
98 Invariant:
100 Invariant:
99 - Flags need to be defined in REVIDX_KNOWN_FLAGS and REVIDX_FLAGS_ORDER.
101 - Flags need to be defined in REVIDX_KNOWN_FLAGS and REVIDX_FLAGS_ORDER,
102 and REVIDX_RAWTEXT_CHANGING_FLAGS if they can alter rawtext.
100 - Only one flag processor can be registered on a specific flag.
103 - Only one flag processor can be registered on a specific flag.
101 - flagprocessors must be 3-tuples of functions (read, write, raw) with the
104 - flagprocessors must be 3-tuples of functions (read, write, raw) with the
102 following signatures:
105 following signatures:
@@ -713,6 +716,18 b' class revlog(object):'
713 except KeyError:
716 except KeyError:
714 return False
717 return False
715
718
719 def candelta(self, baserev, rev):
720 """whether two revisions (baserev, rev) can be delta-ed or not"""
721 # Disable delta if either rev requires a content-changing flag
722 # processor (ex. LFS). This is because such flag processor can alter
723 # the rawtext content that the delta will be based on, and two clients
724 # could have a same revlog node with different flags (i.e. different
725 # rawtext contents) and the delta could be incompatible.
726 if ((self.flags(baserev) & REVIDX_RAWTEXT_CHANGING_FLAGS)
727 or (self.flags(rev) & REVIDX_RAWTEXT_CHANGING_FLAGS)):
728 return False
729 return True
730
716 def clearcaches(self):
731 def clearcaches(self):
717 self._cache = None
732 self._cache = None
718 self._chainbasecache.clear()
733 self._chainbasecache.clear()
@@ -95,6 +95,6 b' Apply bundles'
95 2 integrity errors encountered!
95 2 integrity errors encountered!
96 (first damaged changeset appears to be 2)
96 (first damaged changeset appears to be 2)
97 ---- Applying src-lfs.bundle to dst-normal ----
97 ---- Applying src-lfs.bundle to dst-normal ----
98 CRASHED
98 OK
99 ---- Applying src-lfs.bundle to dst-lfs ----
99 ---- Applying src-lfs.bundle to dst-lfs ----
100 OK
100 OK
@@ -349,7 +349,7 b' enabled adds the lfs requirement'
349 uncompressed size of bundle content:
349 uncompressed size of bundle content:
350 * (changelog) (glob)
350 * (changelog) (glob)
351 * (manifests) (glob)
351 * (manifests) (glob)
352 * a (glob)
352 * a (glob)
353 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
353 $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
354 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
354 $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
355 5 branching
355 5 branching
General Comments 0
You need to be logged in to leave comments. Login now