Skip to content

Storage Format Next

jeffWelling edited this page May 20, 2011 · 5 revisions

This page details the TicGit-ng storage format, for TicGit-ng version ... .

TicGit stores everything in your repository on disk, in a branch which is named either 'ticgit' or 'ticgit-ng'.

When you checkout the branch and look at the files in your repository, you will see that none of your project files are in this branch - it is not an ancestor of master.

Using the ticgit branch from TicGit-ng's own repository in it's present state, this is what a directory listing looks like:

drwxr-xr-x 34 jeff jeff 4.0K May 18 23:01 .
drwxr-xr-x  8 jeff jeff 4.0K Feb  7 04:21 ..
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1254123752_comments-on-ticgits-longer-than-5-lines-can-t-be-viewed-entirely_266
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1254123860_when-merging-ticgit-branches-other-ppls-comments-don-t-appear_858
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1254124141_-ti-tag-x-crashes-and-burns_689
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1254272698_-ti-assign-does-not-appear-to-work_375
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1254273024_-ti-tag-h-output-does-not-match-what-the-code-actually-does_488
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1277264623_debian-merging-ticgit-branches-fail-_143
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1280918939_ticgit-commit-ticgit-id-syntax-is-ambiguous_607
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1284079420_create-ti-list-all-to-list-all-tickets_699
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1284198271_-ticgit-s-cache-corrupts-the-ticgit-branch-if-repair-is-done-manually_159
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1284198431_fix-column-sizes-for-date-and-assgn-currently-only-shows-month-day-and-jeff-we-_871
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1286074795_fix-ticgit-output-use-one-method-of-puts-ing_734
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1286111548_openstruct-is-only-partially-implemented-should-finish_158
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1286188177_ability-to-export-ticgit-state-and-tickets_606
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1286188321_-ti-tag-fails-hard-without-a-supplied-argument_928
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1286200781_write-specs-for-merging-ticgit-branches_422
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1299114953_should-sync-with-bugtrackers-like-github-issues_242
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300684355_should-have-colorized-output_571
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300684416_run-ti-list-by-default-not-ti-help-and-dont-explode_752
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300689188_order-should-be-alphabetical-in-ti-help-_416
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300690732_fubar_46
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300702653_sort-ti-help-commands-before-displaying_9
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300703045_info-notice-about-creating-ticgit-branch-shows-when-it-shouldn-t_916
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300703235_fresh-clones-only-have-master-no-ticgit-branch_116
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1300788402_ti-show-should-show-changes-to-ticket_275
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1305613089_create-ti-set-to-tic-id-_355
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1305613212_should-be-able-to-change-ticket-title_793
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1305615195_make-ticgit-faster_425
drwxr-xr-x  2 jeff jeff 4.0K May 18 23:01 1305772178_ti-show-should-show-year-on-comments_141
-rw-r--r--  1 jeff jeff    5 May 18 23:01 .hold

This is basically a listing of every ticket in TicGit-ng, wether it is open closed or otherwise. I think the .hold file is used to tell if the ticgit branch is already checked out, but I'm not certain. The format of the name is as follows, and then the hash of this string becomes the ticket ID:

"number of seconds since epoch"_"cleaned ticket title"_"random number up < 999"

The directory tree underneath, for example the 1305772178_ti-show-should-show-year-on-comments_141 directory, looks like this:

1305772178_ti-show-should-show-year-on-comments_141
├── ASSIGNED_jeff.welling@gmail.com
├── COMMENT_1305772181_jeff.welling@gmail.com
├── COMMENT_1305775716_jeff.welling@gmail.com
├── STATE_open
├── TAG_bug
├── TICKET_ID
├── TICKET_TITLE
└── TITLE

The function responsible for saving tickets is located here, and the one for reading them is here.

  • ASSIGNED_...
    The Assigned attribute of a ticket is determined by reading the ASSIGNED_... filename, everything on the right side of the underscore becomes the value of the Assigned attribute. Though the contents of the file contain just the email address that the ticket is assigned to, at present the contents of the file are ignored (though this behaviour may change in future versions).

  • COMMENT_...
    Example: "COMMENT_1305772181_jeff.welling@gmail.com"
    The code responsible for loading comments is located here.

The contents of this file (sans the footer which includes the 'updated at' time, documented below) become the comment body. The integer between the two underscores in this filename is the number of seconds since epoch, and is the time the comment was created at. The string between the underscore farthest to the right and the end of the file name becomes the user field. Each new comment creates a new file following the format outlined here, we can see that in the example above there are two comments on that ticket.

When you supply a comment, this line is appended to your comment, and the result is written to the above file.

\n#Updated_at=Fri May 20 13:54:46 -0400 2011

This is the footer that is attached to any comment which has been edited, it contains the Time.now.to_s representing the time that the comment was updated at. The '#Updated_at' string is not case sensitive, though it must be preceded by "\n" to be recognized. The time is obtained by retrieving everything from the tag "\n#Updated_at=" string to the end of the file.

  • STATE_...
    The state of the ticket is determined by the string to the right of the underscore in this filename. The contents of the file should also contain only this string, but at present the state is determined from the filename itself.

  • TAG_...
    The tags of a ticket are determined by these TAG_... files. Each file represents one tag. The tag itself is determined by reading the string to the right of the underscore in this filename. The file contents should equal the string to the right of the underscore in the filename, but at present the contents of the file are ignored.

  • TICKET_ID
    The ticket ID is determined when the ticket is first created, and is the result of hashing the original ticket name which is used to create the ticket directory (in the example above, "1305772178_ti-show-should-show-year-on-comments_141"). The ticket name is written to the TICKET_ID file when the ticket is created, and the hash of this file then becomes the ticket ID. This ID never changes, and is guaranteed to be unique.

  • TICKET_TITLE
    The TICKET_TITLE file was originally introduced to accomodate supporting non-alphanumeric title's, but is now deprecated and ignored. Original versions of TicGit did not use this file nor does the present version, and in future versions it will no longer be created.

  • TITLE
    The body of the TITLE file becomes the ticket title. Once, many versions ago, the ticket title was determined from the directory name (in the example above, "1305772178_ti-show-should-show-year-on-comments_141"), but this behaviour was deprecated because it restricted ticket names to alphanumeric characters only.