hgext/convert/hg.py
changeset 5437 71e7c86adcb7
parent 5436 b4ae8535f834
equal deleted inserted replaced
5436:b4ae8535f834 5437:71e7c86adcb7
    19         converter_sink.__init__(self, ui, path)
    19         converter_sink.__init__(self, ui, path)
    20         self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
    20         self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
    21         self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
    21         self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
    22         self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
    22         self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
    23         self.lastbranch = None
    23         self.lastbranch = None
    24         try:
    24         if os.path.isdir(path) and len(os.listdir(path)) > 0:
    25             self.repo = hg.repository(self.ui, path)
    25             try:
    26         except:
    26                 self.repo = hg.repository(self.ui, path)
    27             raise NoRepo("could not open hg repo %s as sink" % path)
    27                 ui.status(_('destination %s is a Mercurial repository\n') %
       
    28                           path)
       
    29             except hg.RepoError, err:
       
    30                 ui.print_exc()
       
    31                 raise NoRepo(err.args[0])
       
    32         else:
       
    33             try:
       
    34                 ui.status(_('initializing destination %s repository\n') % path)
       
    35                 self.repo = hg.repository(self.ui, path, create=True)
       
    36                 self.created.append(path)
       
    37             except hg.RepoError, err:
       
    38                 ui.print_exc()
       
    39                 raise NoRepo("could not create hg repo %s as sink" % path)
    28         self.lock = None
    40         self.lock = None
    29         self.wlock = None
    41         self.wlock = None
    30         self.filemapmode = False
    42         self.filemapmode = False
    31 
    43 
    32     def before(self):
    44     def before(self):