D2685: xdiff: add comments for fields in xdfile_t

2018-03-09 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG58028f6d1fb8: xdiff: add comments for fields in xdfile_t 
(authored by quark, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2685?vs=6798=6805

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -46,15 +46,49 @@
 } xrecord_t;
 
 typedef struct s_xdfile {
+   /* manual memory management */
chastore_t rcha;
+
+   /* number of records (lines) */
long nrec;
+
+   /* hash table size
+* the maximum hash value in the table is (1 << hbits) */
unsigned int hbits;
+
+   /* hash table, hash value => xrecord_t
+* note: xrecord_t is a linked list. */
xrecord_t **rhash;
+
+   /* range excluding common prefix and suffix
+* [recs[i] for i in range(0, dstart)] are common prefix.
+* [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting
+* lines */
long dstart, dend;
+
+   /* pointer to records (lines) */
xrecord_t **recs;
+
+   /* record changed, use original "recs" index
+* rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked
+* "changed". */
char *rchg;
+
+   /* cleaned-up record index => original "recs" index
+* clean-up means:
+*  rule 1. remove common prefix and suffix
+*  rule 2. remove records that are only on one side, since they can
+*  not match the other side
+* rindex[0] is likely dstart, if not removed up by rule 2.
+* rindex[nreff - 1] is likely dend, if not removed by rule 2.
+*/
long *rindex;
+
+   /* rindex size */
long nreff;
+
+   /* cleaned-up record index => hash value
+* ha[i] = recs[rindex[i]]->ha */
unsigned long *ha;
 } xdfile_t;
 



To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2685: xdiff: add comments for fields in xdfile_t

2018-03-09 Thread indygreg (Gregory Szorc)
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  So. Much. Better.

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2685: xdiff: add comments for fields in xdfile_t

2018-03-09 Thread quark (Jun Wu)
quark updated this revision to Diff 6798.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2685?vs=6643=6798

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -46,15 +46,49 @@
 } xrecord_t;
 
 typedef struct s_xdfile {
+   /* manual memory management */
chastore_t rcha;
+
+   /* number of records (lines) */
long nrec;
+
+   /* hash table size
+* the maximum hash value in the table is (1 << hbits) */
unsigned int hbits;
+
+   /* hash table, hash value => xrecord_t
+* note: xrecord_t is a linked list. */
xrecord_t **rhash;
+
+   /* range excluding common prefix and suffix
+* [recs[i] for i in range(0, dstart)] are common prefix.
+* [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting
+* lines */
long dstart, dend;
+
+   /* pointer to records (lines) */
xrecord_t **recs;
+
+   /* record changed, use original "recs" index
+* rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked
+* "changed". */
char *rchg;
+
+   /* cleaned-up record index => original "recs" index
+* clean-up means:
+*  rule 1. remove common prefix and suffix
+*  rule 2. remove records that are only on one side, since they can
+*  not match the other side
+* rindex[0] is likely dstart, if not removed up by rule 2.
+* rindex[nreff - 1] is likely dend, if not removed by rule 2.
+*/
long *rindex;
+
+   /* rindex size */
long nreff;
+
+   /* cleaned-up record index => hash value
+* ha[i] = recs[rindex[i]]->ha */
unsigned long *ha;
 } xdfile_t;
 



To: quark, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2685: xdiff: add comments for fields in xdfile_t

2018-03-04 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  No longer needed

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2685: xdiff: add comments for fields in xdfile_t

2018-03-04 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes the related code easier to understand.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -46,15 +46,49 @@
 } xrecord_t;
 
 typedef struct s_xdfile {
+   /* manual memory management */
chastore_t rcha;
+
+   /* number of records (lines) */
long nrec;
+
+   /* hash table size
+* the maximum hash value in the table is (1 << hbits) */
unsigned int hbits;
+
+   /* hash table, hash value => xrecord_t
+* note: xrecord_t is a linked list. */
xrecord_t **rhash;
+
+   /* range excluding common prefix and suffix
+* [recs[i] for i in range(0, dstart)] are common prefix.
+* [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting
+* lines */
long dstart, dend;
+
+   /* pointer to records (lines) */
xrecord_t **recs;
+
+   /* record changed, use original "recs" index
+* rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked
+* "changed". */
char *rchg;
+
+   /* cleaned-up record index => original "recs" index
+* clean-up means:
+*  rule 1. remove common prefix and suffix
+*  rule 2. remove records that are only on one side, since they can
+*  not match the other side
+* rindex[0] is likely dstart, if not removed up by rule 2.
+* rindex[nreff - 1] is likely dend, if not removed by rule 2.
+*/
long *rindex;
+
+   /* rindex size */
long nreff;
+
+   /* cleaned-up record index => hash value
+* ha[i] = recs[rindex[i]]->ha */
unsigned long *ha;
 } xdfile_t;
 



To: quark, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel