annotate mercurial/cffi/bdiffbuild.py @ 42145:607a0de9bae3

debugdiscovery: include the number of heads in all sets We already displayed information about heads of the common set that are either local or remote heads. We now also do so for heads of the common set that are both local and remote heads too. This is useful because various step in the set discovery algorithm have head specific optimizations.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 16 Apr 2019 15:50:20 +0200
parents 0585337ea787
children 2372284d9457
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29833
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
1 from __future__ import absolute_import
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
2
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
3 import cffi
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
4 import os
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
5
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
6 ffi = cffi.FFI()
36948
0585337ea787 cleanup: fix some latent open(path).read() et al calls we previously missed
Augie Fackler <augie@google.com>
parents: 32506
diff changeset
7 with open(os.path.join(os.path.join(os.path.dirname(__file__), '..'),
0585337ea787 cleanup: fix some latent open(path).read() et al calls we previously missed
Augie Fackler <augie@google.com>
parents: 32506
diff changeset
8 'bdiff.c')) as f:
0585337ea787 cleanup: fix some latent open(path).read() et al calls we previously missed
Augie Fackler <augie@google.com>
parents: 32506
diff changeset
9 ffi.set_source("mercurial.cffi._bdiff",
0585337ea787 cleanup: fix some latent open(path).read() et al calls we previously missed
Augie Fackler <augie@google.com>
parents: 32506
diff changeset
10 f.read(), include_dirs=['mercurial'])
29833
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
11 ffi.cdef("""
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
12 struct bdiff_line {
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
13 int hash, n, e;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
14 ssize_t len;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
15 const char *l;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
16 };
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
17
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
18 struct bdiff_hunk;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
19 struct bdiff_hunk {
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
20 int a1, a2, b1, b2;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
21 struct bdiff_hunk *next;
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
22 };
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
23
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
24 int bdiff_splitlines(const char *a, ssize_t len, struct bdiff_line **lr);
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
25 int bdiff_diff(struct bdiff_line *a, int an, struct bdiff_line *b, int bn,
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
26 struct bdiff_hunk *base);
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
27 void bdiff_freehunks(struct bdiff_hunk *l);
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
28 void free(void*);
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
29 """)
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
30
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
31 if __name__ == '__main__':
a8933d992a71 bdiff: implement cffi version of blocks
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
32 ffi.compile()