hgext3rd/topic/__init__.py
changeset 3225 28fb347a5bf8
parent 3195 8f74cf219be3
child 3232 c1d20598bc2b
equal deleted inserted replaced
3224:bac69ab0782c 3225:28fb347a5bf8
     7 Topic branches are lightweight branches which disappear when changes are
     7 Topic branches are lightweight branches which disappear when changes are
     8 finalized (move to the public phase).
     8 finalized (move to the public phase).
     9 
     9 
    10 Compared to bookmark, topic is reference carried by each changesets of the
    10 Compared to bookmark, topic is reference carried by each changesets of the
    11 series instead of just the single head revision.  Topic are quite similar to
    11 series instead of just the single head revision.  Topic are quite similar to
    12 the way named branch work, except they eventualy fade away when the changeset
    12 the way named branch work, except they eventually fade away when the changeset
    13 becomes part of the immutable history. Changeset can belong to both a topic and
    13 becomes part of the immutable history. Changeset can belong to both a topic and
    14 a named branch, but as long as it is mutable, its topic identity will prevail.
    14 a named branch, but as long as it is mutable, its topic identity will prevail.
    15 As a result, default destination for 'update', 'merge', etc...  will take topic
    15 As a result, default destination for 'update', 'merge', etc...  will take topic
    16 into account. When a topic is active these operations will only consider other
    16 into account. When a topic is active these operations will only consider other
    17 changesets on that topic (and, in some occurence, bare changeset on same
    17 changesets on that topic (and, in some occurrence, bare changeset on same
    18 branch).  When no topic is active, changeset with topic will be ignored and
    18 branch).  When no topic is active, changeset with topic will be ignored and
    19 only bare one on the same branch will be taken in account.
    19 only bare one on the same branch will be taken in account.
    20 
    20 
    21 There is currently two commands to be used with that extension: 'topics' and
    21 There is currently two commands to be used with that extension: 'topics' and
    22 'stack'.
    22 'stack'.
    75 
    75 
    76 Publishing behavior
    76 Publishing behavior
    77 ===================
    77 ===================
    78 
    78 
    79 Topic vanish when changeset move to the public phases. Moving to the public
    79 Topic vanish when changeset move to the public phases. Moving to the public
    80 phase usually happens on push, but it is possible ot update that behavior. The
    80 phase usually happens on push, but it is possible to update that behavior. The
    81 server needs to have specific config for this.
    81 server needs to have specific config for this.
    82 
    82 
    83     # everything pushed become public (the default)
    83     # everything pushed become public (the default)
    84     [phase]
    84     [phase]
    85     publish = yes
    85     publish = yes
   199     configitem('_internal', 'keep-topic',
   199     configitem('_internal', 'keep-topic',
   200                default=False,
   200                default=False,
   201     )
   201     )
   202 
   202 
   203     def extsetup(ui):
   203     def extsetup(ui):
   204         # register config that strickly belong to other code (thg, core, etc)
   204         # register config that strictly belong to other code (thg, core, etc)
   205         #
   205         #
   206         # To ensure all config items we used are registerd, we register them if
   206         # To ensure all config items we used are registered, we register them if
   207         # nobody else did so far.
   207         # nobody else did so far.
   208         from mercurial import configitems
   208         from mercurial import configitems
   209         extraitem = functools.partial(configitems._register, ui._knownconfig)
   209         extraitem = functools.partial(configitems._register, ui._knownconfig)
   210         if ('experimental' not in ui._knownconfig
   210         if ('experimental' not in ui._knownconfig
   211                 or not ui._knownconfig['experimental'].get('thg.displaynames')):
   211                 or not ui._knownconfig['experimental'].get('thg.displaynames')):
   442             ctwasempty = stack.stack(self, topic=ct).changesetcount == 0
   442             ctwasempty = stack.stack(self, topic=ct).changesetcount == 0
   443 
   443 
   444             reporef = weakref.ref(self)
   444             reporef = weakref.ref(self)
   445 
   445 
   446             def currenttopicempty(tr):
   446             def currenttopicempty(tr):
   447                 # check active topic emptyness
   447                 # check active topic emptiness
   448                 repo = reporef()
   448                 repo = reporef()
   449                 csetcount = stack.stack(repo, topic=ct).changesetcount
   449                 csetcount = stack.stack(repo, topic=ct).changesetcount
   450                 empty = csetcount == 0
   450                 empty = csetcount == 0
   451                 if empty and not ctwasempty:
   451                 if empty and not ctwasempty:
   452                     ui.status('active topic %r is now empty\n' % ct)
   452                     ui.status('active topic %r is now empty\n' % ct)
   739     )
   739     )
   740 )
   740 )
   741 """
   741 """
   742 
   742 
   743 def _findconvertbmarktopic(repo, bmark):
   743 def _findconvertbmarktopic(repo, bmark):
   744     """find revisions unambigiously defined by a bookmark
   744     """find revisions unambiguously defined by a bookmark
   745 
   745 
   746     find all changesets under the bookmark and under that bookmark only.
   746     find all changesets under the bookmark and under that bookmark only.
   747     """
   747     """
   748     return repo.revs(CONVERTBOOKREVSET, bmark, bmark, bmark, bmark, bmark)
   748     return repo.revs(CONVERTBOOKREVSET, bmark, bmark, bmark, bmark, bmark)
   749 
   749 
   750 def _applyconvertbmarktopic(ui, repo, revs, old, bmark, tr):
   750 def _applyconvertbmarktopic(ui, repo, revs, old, bmark, tr):
   751     """apply bookmark convertion to topic
   751     """apply bookmark conversion to topic
   752 
   752 
   753     Sets a topic as same as bname to all the changesets under the bookmark
   753     Sets a topic as same as bname to all the changesets under the bookmark
   754     and delete the bookmark, if topic is set to any changeset
   754     and delete the bookmark, if topic is set to any changeset
   755 
   755 
   756     old is the revision on which bookmark bmark is and tr is transaction object.
   756     old is the revision on which bookmark bmark is and tr is transaction object.