Changeset 1167 in tailor


Ignore:
Timestamp:
06/20/06 21:07:39 (7 years ago)
Author:
Brendan Cully <brendan@…>
Hash name:
20060620190739-0ae3a-2df4d30f50994531fb1eb09327784c1684c244a6
Message:

[hg] wrapper for commands.*

_hgCommand makes it easier to call commands.* functions, and
ensures they will always have their options dictionary set
correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/hg.py

    r1166 r1167  
    6969        """Fetch new changesets from the source""" 
    7070        repo = self._getRepo() 
    71         opts = self._defaultOpts('pull') 
    72  
    73         commands.pull(repo.ui, repo, "default", **opts) 
     71 
     72        self._hgCommand('pull', 'default') 
    7473 
    7574        from mercurial.node import bin 
     
    260259        # TODO: keep a handle on the changeset holding this tag? Then 
    261260        # we can extract author, log, date from it. 
    262         opts = self._defaultOpts('tag') 
    263261 
    264262        # This seems gross. I don't get why I'm getting a unicode tag when 
     
    282280        except KeyError: 
    283281            pass 
    284         commands.tag(repo.ui, repo, tag, **opts) 
     282        self._hgCommand('tag', tag) 
    285283 
    286284    def _defaultOpts(self, cmd): 
     
    288286        # is easier, and while dispatch is easiest, you lose ui. 
    289287        return dict([(f[1], f[2]) for f in commands.find(cmd)[1][1]]) 
     288 
     289    def _hgCommand(self, cmd, *args, **opts): 
     290        import os 
     291 
     292        allopts = self._defaultOpts(cmd) 
     293        allopts.update(opts) 
     294        cmd = getattr(commands, cmd) 
     295        cmd(self._ui, self._hg, *args, **allopts) 
    290296 
    291297    def _removePathnames(self, names): 
     
    370376 
    371377    def _initializeWorkingDir(self): 
    372         commands.add(self._ui, self._hg, self.basedir) 
     378        self._hgCommand('add', self.basedir) 
    373379 
    374380    def _walk(self, subdir): 
Note: See TracChangeset for help on using the changeset viewer.