Edgewall Software

Changes between Version 7 and Version 8 of TracObjectModelProposal


Ignore:
Timestamp:
Dec 9, 2005, 3:55:23 PM (18 years ago)
Author:
Christian Boos
Comment:

Simplifications and updates

Legend:

Unmodified
Added
Removed
Modified
  • TracObjectModelProposal

    v7 v8  
    11= Trac Object Model Proposal =
    22
     3''This proposal is about unifying the capabilities of the various Trac objects,
     4by making them inherit from a common `TracObject` class.
     5The goal is to expand the feature set of Trac while simplifying its implementation.''
    36
    47== Introduction ==
     
    3134
    3235This updated revision is made in light of the experience gathered
    33 while working on the #1242 patch.
    34 
    35 A basic implementation is now available in the
    36 [source:branches/cboos-dev/xref-branch xref-branch],
    37 as part of the support for cross-references,
    38 and is candidate for inclusion in the trunk.
    39 
    40 Further work will continue on the more experimental branch
    41 [source:branches/cboos-dev/trac-obj-branch trac-obj-branch],
    42 where more power will be added to the generic Trac object.
     36while working on the TracCrossReferences feature:
     37for implementing generalized back links, I had to have a
     38common interface to all the Trac objects, this was a practical
     39reason to introduce the `TracObject`
     40(see source:sandbox/trac-xref/trac/object.py).
    4341
    4442
    4543== Trac Objects ==
    4644
    47 What can be considered a Trac object (''TracObj'') are:
    48  * a wiki page (''WikiPage'')
    49  * a ticket (''Ticket'')
    50  * a changeset (''Changeset'')
    51  * a milestone (''Milestone'')
    52  * a report (''Report'')
    53  * a source (''Source'')
     45What can be considered a Trac object (`TracObject`) are:
     46 * wiki pages (''WikiPage'')
     47 * tickets (''Ticket'')
     48 * changesets (''Changeset'')
     49 * milestones (''Milestone'')
     50 * reports (''Report'')
     51 * sources (''Source'')
    5452
    5553
    5654
    57 === Current State ===
     55=== Current State in `trunk` ===
    5856
    5957Today, the various Trac objects are quite distinct objects.
    6058There is no code sharing between what defines objects
    61 and also not so much in the related Modules that manipulates
     59and also not so much in the related modules that manipulates
    6260objects.
    6361
     
    6765decreased code complexity.
    6866
     67Last discussed examples were the ability to add comments
     68on various objects,
     69(this [http://thread.gmane.org/gmane.comp.version-control.subversion.trac.general/5609 thread], ticket #2035), the ability to query over other
     70objects than just the tickets (#2465), and several other examples
     71(query:keywords~=object).
     72
    6973
    7074=== Toward an Unification ===
    7175
    7276What would be a generic Trac object?
    73   * It would have a unique identity in the system -- {{{id}}}
     77  * It would have a unique identity in the system
     78    This would be the `type` and `id` properties.
    7479  * It would have some wiki syntax to describe it
    75     * {{{shortcut_regexp()}}}
    76     * {{{canonical_regexp()}}}
    7780  * It would be displayed in several ways:
    78     * a ''canonical'' form -- {{{canonical_name()}}}
    79     * a ''shortcut'' form -- {{{name()}}}
     81    * a ''canonical'' form -- `fqname()` e.g. `wiki:WikiStart`
     82    * a ''shortcut'' form -- `shortname()` e.g. `WikiStart`
     83    * a ''display'' name -- `displayname()` e.g. `Ticket #123`
     84  * It should be addressable
     85    * `href()` method
     86    * `anchor()` method
    8087  * There could be one or several Wiki text attached to the object.
    81     Each would be a '''facet''' of this object.
     88    Each would be a '''facet''' of this object (''FIXME: I'm looking
     89    for a better name than ''facet'')'' [[BR]]
    8290    Some facets are:
    8391    * '''content''', appropriate for a !WikiPage and a Changeset
    8492    * '''description''', appropriate for a Ticket, a Report and a Milestone
    8593    * '''comment:n''' for the n^th^ comment
    86     * '''attachment:file''' for the attachment name ''file''
    8794  * There would be some fields attached to it.
    8895    * Some would be always there for the particular type of object considered
     
    9198  * One would want to be able to comment on any object, just like for a Ticket
    9299  * One would want to see the history of the modification of the object
    93     * the edit history of the main facet (see also TighterSubversionIntegration)
    94     * the change history of the value of the fields
     100    * the edit history of the main facet
     101      (like the ''Page History'' for a Wiki page)
     102    * the change history of the value of the fields
     103      (like the ''Change History'' for a Ticket)
    95104
    96105Let's compare these generic features with those of current Trac objects
    97106and see what additional functionality and usages it would provide.
    98107
    99 ==== WikiPage ====
     108==== Wiki Page ====
    100109
    101  * The unique identity is the Wiki page name. -- {{{s/page_name/id}}}
    102  * The wiki syntax is the one described in WikiPageNames.
    103    -- currently present in source:trunk/trac/WikiFormatter.py
    104    {{{r"(?P<wikihref>!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?:#[A-Za-z0-9]+)?(?=\Z|\s|[.,;:!?\)}\]]))"}}}
    105    and in source:trunk/trac/Search.py {{{r = "((^|(?<=[^A-Za-z]))[!]?[A-Z][a-z/]+(?:[A-Z][a-z/]+)+)"}}}
    106  * The main facet would be ''content'', i.e. the content of the Wiki page itself.
    107  * The relevant fields:
    108    * author and creation time
    109    * a ''readonly'' boolean field
    110  * Wiki attachments are there
    111  * The change history would be contributed comments only, but that would make sense.
    112  * Wiki history and revision diffs are there
     110The Wiki Page object would gain the ability to have custom fields.
     111
    113112
    114113==== Changeset ====
    115114
    116  * The unique identity is the revision number -- {{{s/rev/id}}}
    117  * The wiki syntax is {{{r"(?P<changesethref>!?(\[\d+\]|\br\d+\b))"}}}
    118  * The main facet is 'content', which is the original commit log entered in Subversion.
    119    See #781.
    120  * Changeset properties:
    121    * author and creation time are those of the commit information.
    122    * Custom properties could be used for many things, as a way to
    123      annotate the revision. Some ideas are:
    124      * a boolean ''compilable'' flag (true by default, could be set to
    125        false to indicate that this revision can't be built)
    126      * a field indicating the % of successful test cases
    127      * a QA status
    128  * Attachments for a changeset also make sense:
    129    * in case of a build failure, the corresponding errors from the compiler
     115The changeset message can be considered to be a ''facet'' for that object.
     116Editing the message would be handled very similarly to editing the wiki
     117page content (see #781). It will be versioned, like the content for wiki
     118pages are.
    130119
    131      could be attached.
    132    * patches that applies to that revision
    133  * A change history for a Changeset, wouldn't that be cool?
    134    Actually, the contributed comments could be used for code reviews
    135    The history and diffs for the commit log are useful once the
    136    changelog becomes modifiable
     120If the underlying VersioningSystemBackend supports it, the change
     121could be reflected in the repository itself (not all versioning
     122systems support that: e.g. SVN does, Mercurial does not).
     123A `resync` operation would simply add a new revision for the
     124message, if something changed.
     125
     126Custom properties could be used for many things, as a way to annotate
     127the revision. Some ideas are:
     128 * a boolean ''compilable'' flag (true by default, could be set to
     129   false to indicate that this revision can't be built)
     130 * a field indicating the % of successful test cases
     131 * a QA status
     132
     133Attachments for a changeset also make sense:
     134 * in case of a build failure, the corresponding errors from the compiler
     135   could be attached.
     136 * patches that applies to that revision
     137
     138The contributed comments could be used for code reviews
     139
     140It would also be nice to be able to query changesets (see #2465).
     141
    137142 
    138143==== Ticket ====
    139144
    140  * The unique identity for a ticket is its number -- {{{id}}}
    141  * The wiki shortcut syntax is {{{r"(?P<tickethref>!?#\d+)"}}}
    142  * The main facet is ''description''
    143  * The ticket fields:
    144    * author and creation time
    145    * milestone and component
    146    * The short summary
    147    * The keywords
    148    * An optional due time
    149    * Assigned to...
    150    * Cc field
    151    * Custom properties as usual
    152  * Attachments for tickets are there
    153  * The change history is there
    154  * The wiki history and diff would be usefull if the description is to be modified
     145There's currently no way to have an history of the description facet.
     146Otherwise, the Ticket has pretty much all of the generic functionality.
     147
     148There's also the question of having greater flexibility for ticket fields:
     149 * different sets of fields for different types of tickets (see #2464)
     150 * less difference between custom ticket fields and ''normal'' ticket fields
     151   (some kind of unification would be great here)
     152 * possibility to have multiple values for a field (see #221, #918 and #1730)
     153
     154There's also the question of bringing together Milestone
     155and Ticket objects for implementing SubTickets.
    155156
    156157
    157158==== Source ====
    158159
    159  * The identifier for a file or directory is its path
    160  * There's no facet attached to a source
    161  * Fields
    162    * author, creation date
    163    * The size
    164    * The mime-type
    165    * dynamical svn properties
    166  * attachments for files... Why not? One could already do it with
    167    Subversion anyway ({{{svn pset prop -F attachment source}}})
    168 
    169 
    170 == Implementing Trac Objects ==
    171 
    172 For processing Trac objects and for the logic associated to them,
    173 there would be a corresponding {{{Module}}} subclass
    174 (see TracPluggableModules).
    175 That is, some modules would use some kind of Trac objects:
    176  * The !WikiModule is using the !WikiPage object.
    177  * The !TicketModule and the !NewticketModule are using the Ticket object
    178  * The Browser and Log modules will be using the Source object
    179  * etc.
    180 
    181 For the object-relational mapping, I would suggest having
    182 a table for each class, with common column names where appropriate
    183 (at the very least, the {{{id}}} column).
     160Currently, there's no facet attached to a source.
     161One could imagine having a summary or description facet.
     162This could give a repository browsing experience close
     163to what Sun did for
     164[http://cvs.opensolaris.org/source/xref/on/usr/src/ OpenSolaris].
    184165
    185166