tests/drawdag.py
changeset 47012 d55b71393907
parent 46113 59fa3890d40a
child 48875 6000f5b25c9b
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
    84 
    84 
    85 import collections
    85 import collections
    86 import itertools
    86 import itertools
    87 import re
    87 import re
    88 
    88 
    89 from mercurial.node import nullid
       
    90 from mercurial.i18n import _
    89 from mercurial.i18n import _
    91 from mercurial import (
    90 from mercurial import (
    92     context,
    91     context,
    93     error,
    92     error,
    94     obsolete,
    93     obsolete,
   297         }
   296         }
   298         super(simplecommitctx, self).__init__(repo, name, **opts)
   297         super(simplecommitctx, self).__init__(repo, name, **opts)
   299         self._added = added
   298         self._added = added
   300         self._parents = parentctxs
   299         self._parents = parentctxs
   301         while len(self._parents) < 2:
   300         while len(self._parents) < 2:
   302             self._parents.append(repo[nullid])
   301             self._parents.append(repo[repo.nullid])
   303 
   302 
   304     def filectx(self, key):
   303     def filectx(self, key):
   305         return simplefilectx(key, self._added[key])
   304         return simplefilectx(key, self._added[key])
   306 
   305 
   307     def commit(self):
   306     def commit(self):
   386     filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M)
   385     filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M)
   387     for name, path, content in filere.findall(b'\n'.join(comments)):
   386     for name, path, content in filere.findall(b'\n'.join(comments)):
   388         content = content.replace(br'\n', b'\n').replace(br'\1', b'\1')
   387         content = content.replace(br'\n', b'\n').replace(br'\1', b'\1')
   389         files[name][path] = content
   388         files[name][path] = content
   390 
   389 
   391     committed = {None: nullid}  # {name: node}
   390     committed = {None: repo.nullid}  # {name: node}
   392 
   391 
   393     # for leaf nodes, try to find existing nodes in repo
   392     # for leaf nodes, try to find existing nodes in repo
   394     for name, parents in edges.items():
   393     for name, parents in edges.items():
   395         if len(parents) == 0:
   394         if len(parents) == 0:
   396             try:
   395             try: