Patchwork D9105: hg-core: renaming of `Chunk` offset methods (D8958#inline-15002 followup)

login
register
mail settings
Submitter phabricator
Date Sept. 28, 2020, 1:49 p.m.
Message ID <differential-rev-PHID-DREV-qwdkiyxv2hrb7gpqeodi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47320/
State Superseded
Headers show

Comments

phabricator - Sept. 28, 2020, 1:49 p.m.
acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9105

AFFECTED FILES
  rust/hg-core/src/revlog/patch.rs

CHANGE DETAILS




To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/revlog/patch.rs b/rust/hg-core/src/revlog/patch.rs
--- a/rust/hg-core/src/revlog/patch.rs
+++ b/rust/hg-core/src/revlog/patch.rs
@@ -22,7 +22,7 @@ 
     ///
     /// The offset, taking into account the growth/shrinkage of data
     /// induced by previously applied chunks.
-    fn start_offseted_by(&self, offset: i32) -> u32 {
+    fn start_offset_by(&self, offset: i32) -> u32 {
         (self.start as i32 + offset) as u32
     }
 
@@ -30,8 +30,8 @@ 
     ///
     /// The offset, taking into account the growth/shrinkage of data
     /// induced by previously applied chunks.
-    fn end_offseted_by(&self, offset: i32) -> u32 {
-        self.start_offseted_by(offset) + self.data.len() as u32
+    fn end_offset_by(&self, offset: i32) -> u32 {
+        self.start_offset_by(offset) + self.data.len() as u32
     }
 
     /// Length of the replaced chunk.
@@ -120,7 +120,7 @@ 
             // Add chunks of `self` that start before this chunk of `other`
             // without overlap.
             while pos < self.chunks.len()
-                && self.chunks[pos].end_offseted_by(offset) <= *start
+                && self.chunks[pos].end_offset_by(offset) <= *start
             {
                 let first = self.chunks[pos].clone();
                 offset += first.len_diff();
@@ -133,12 +133,12 @@ 
             // The left-most part of data is added as an insertion chunk.
             // The right-most part data is kept in the chunk.
             if pos < self.chunks.len()
-                && self.chunks[pos].start_offseted_by(offset) < *start
+                && self.chunks[pos].start_offset_by(offset) < *start
             {
                 let first = &mut self.chunks[pos];
 
                 let (data_left, data_right) = first.data.split_at(
-                    (*start - first.start_offseted_by(offset)) as usize,
+                    (*start - first.start_offset_by(offset)) as usize,
                 );
                 let left = Chunk {
                     start: first.start,
@@ -168,7 +168,7 @@ 
             // Discard the chunks of `self` that are totally overridden
             // by the current chunk of `other`
             while pos < self.chunks.len()
-                && self.chunks[pos].end_offseted_by(next_offset) <= *end
+                && self.chunks[pos].end_offset_by(next_offset) <= *end
             {
                 let first = &self.chunks[pos];
                 next_offset += first.len_diff();
@@ -178,12 +178,12 @@ 
             // Truncate the left-most part of chunk of `self` that overlaps
             // the current chunk of `other`.
             if pos < self.chunks.len()
-                && self.chunks[pos].start_offseted_by(next_offset) < *end
+                && self.chunks[pos].start_offset_by(next_offset) < *end
             {
                 let first = &mut self.chunks[pos];
 
                 let how_much_to_discard =
-                    *end - first.start_offseted_by(next_offset);
+                    *end - first.start_offset_by(next_offset);
 
                 first.data = &first.data[(how_much_to_discard as usize)..];