change: add cli option to do "raw" dump

laumann
Jan 1, 2024, 7:56 PM
XDWQHPFDPJFZLSS5HL6FVH2XCTLC33ATWAG7VY4MDOXNFL5ZXNTAC

Dependencies

  • [2] ZS3UJEZU change: support version = 4 (noenc) format
  • [3] ZTDGWUGP add repository structure
  • [4] 2U7P5SFQ Change struct names "struct foo -> typedef struct Foo"
  • [5] RRYWNHFE change: pass verbose to print_atom()
  • [6] LKIBESCN change: adjust function signatures
  • [7] Q7TKZCJP Add initial support for reading the offsets from a (fixed) change
  • [8] QEFCNNVC change: display offsets for given change file
  • [9] 5D2IYPL7 change: introduce changestore, print deleted lines
  • [10] RIWSVVAS change: decompress the 'contents' with zstd_seekable
  • [11] 3FT3XTJM change: support -v/-h flags
  • [12] XTKRT6OQ format the codebase
  • [13] 55IIUFZG change: remove debugging line
  • [14] QSQNGA5K changestore: load changes on demand

Change contents

  • edit in change.c at line 730
    [2.3113]
    [2.3113]
    }
    void
    print_raw_change(struct changestore *changes, struct change *ch)
    {
    usize i;
    printf("offsets\n");
    printf(" version: %lu\n", ch->offsets.version);
    printf(" hashed_len: %lu\n", ch->offsets.hashed_len);
    printf(" unhashed_off: %lu\n", ch->offsets.unhashed_off);
    printf(" unhashed_len: %lu\n", ch->offsets.unhashed_len);
    printf(" contents_off: %lu\n", ch->offsets.contents_off);
    printf(" contents_len: %lu\n", ch->offsets.contents_len);
    printf(" total: %lu\n", ch->offsets.total);
    printf("\n");
    if (ch->offsets.contents_len > 0) {
    printf("contents: [");
    printf("0x%02x", ch->contents[0]);
    for (i = 1; i < ch->offsets.contents_len; i++) {
    printf(", 0x%02x", ch->contents[i]);
    }
    printf("]\n");
    }
  • replacement in change.c at line 1167
    [4.8141][3.449:512]()
    change(const char *hash, int verbose, struct repository *repo)
    [4.8141]
    [4.8200]
    change(const char *hash, int verbose, int raw, struct repository *repo)
  • replacement in change.c at line 1185
    [4.9130][4.1186:1270]()
    print_change(
    &changestore, &ch->change.hashed, ch->change.contents, verbose
    );
    [4.9130]
    [4.9226]
    if (raw)
    print_raw_change(&changestore, &ch->change);
    else
    print_change(
    &changestore, &ch->change.hashed, ch->change.contents,
    verbose
    );
  • replacement in change.c at line 1201
    [4.3521][4.3521:3563]()
    printf("ani change [-h] [-v] <hash>\n");
    [4.3521]
    [4.2996]
    printf("ani change [-h] [-r] [-v] <hash>\n");
  • edit in change.c at line 1210
    [4.238]
    [4.238]
    int raw;
  • replacement in change.c at line 1215
    [4.262][4.262:310]()
    while ((c = getopt(argc, argv, "hv")) != -1) {
    [4.262]
    [4.310]
    while ((c = getopt(argc, argv, "hrv")) != -1) {
  • edit in change.c at line 1219
    [4.353]
    [4.353]
    break;
    case 'r':
    raw = 1;
  • replacement in change.c at line 1249
    [4.742][3.692:729]()
    return change(hash, verbose, repo);
    [4.742]
    [4.3099]
    return change(hash, verbose, raw, repo);