src/topic/__init__.py
changeset 1872 4fcee38d71d6
parent 1871 58ef5699fb35
child 1873 04c971850183
equal deleted inserted replaced
1871:58ef5699fb35 1872:4fcee38d71d6
    19 from mercurial import error
    19 from mercurial import error
    20 from mercurial import extensions
    20 from mercurial import extensions
    21 from mercurial import lock
    21 from mercurial import lock
    22 from mercurial import merge
    22 from mercurial import merge
    23 from mercurial import namespaces
    23 from mercurial import namespaces
       
    24 from mercurial import node
    24 from mercurial import obsolete
    25 from mercurial import obsolete
    25 from mercurial import patch
    26 from mercurial import patch
    26 from mercurial import phases
    27 from mercurial import phases
    27 from mercurial import util
    28 from mercurial import util
    28 
    29 
   118                    try:
   119                    try:
   119                        return c[path]
   120                        return c[path]
   120                    except error.ManifestLookupError:
   121                    except error.ManifestLookupError:
   121                        return None
   122                        return None
   122                fixedextra = dict(c.extra())
   123                fixedextra = dict(c.extra())
       
   124                ui.debug('old node id is %s\n' % node.hex(c.node()))
       
   125                ui.debug('origextra: %r\n' % fixedextra)
   123                newtopic = None if clear else topic
   126                newtopic = None if clear else topic
   124                if fixedextra.get(constants.extrakey, '') == topic:
   127                oldtopic = fixedextra.get(constants.extrakey, None)
       
   128                if oldtopic == newtopic:
   125                    continue
   129                    continue
   126                if clear and constants.extrakey in fixedextra:
   130                if clear:
   127                    del fixedextra[constants.extrakey]
   131                    del fixedextra[constants.extrakey]
   128                else:
   132                else:
   129                    fixedextra[constants.extrakey] = topic
   133                    fixedextra[constants.extrakey] = topic
   130                c.parents()
   134                c.parents()
       
   135                ui.debug('changing topic of %s from %s to %s\n' % (
       
   136                    c, oldtopic, newtopic))
       
   137                ui.debug('fixedextra: %r\n' % fixedextra)
   131                mc = context.memctx(
   138                mc = context.memctx(
   132                    repo, (c.p1().node(), c.p2().node()), c.description(),
   139                    repo, (c.p1().node(), c.p2().node()), c.description(),
   133                    c.files(), filectxfn,
   140                    c.files(), filectxfn,
   134                    user=c.user(), date=c.date(), extra=fixedextra)
   141                    user=c.user(), date=c.date(), extra=fixedextra)
   135                newnode = repo.commitctx(mc)
   142                newnode = repo.commitctx(mc)
       
   143                ui.debug('new node id is %s\n' % node.hex(newnode))
   136                needevolve = needevolve or (len(c.children()) > 0)
   144                needevolve = needevolve or (len(c.children()) > 0)
   137                obsolete.createmarkers(repo, [(c, (repo[newnode],))])
   145                obsolete.createmarkers(repo, [(c, (repo[newnode],))])
   138                rewrote += 1
   146                rewrote += 1
   139            txn.close()
   147            txn.close()
   140         except:
   148         except: