[issue274] localrepo.add() fails to unlock

Robert Collins mercurial-bugs at selenic.com
Tue May 30 15:52:19 CDT 2006


New submission from Robert Collins <robertc at robertcollins.net>:

A replacement add method that unlocks when wlock is None

    def add(self, list, wlock=None):
        if not wlock:
            wlock = self.wlock()
            needs_unlock = True
        else:
            needs_unlock = False
        try:
            for f in list:
                p = self.wjoin(f)
                if not os.path.exists(p):
                    self.ui.warn(_("%s does not exist!\n") % f)
                elif not os.path.isfile(p):
                    self.ui.warn(_("%s not added: only files supported currently\n")
                                  % f)
                elif self.dirstate.state(f) in 'an':
                    self.ui.warn(_("%s already tracked!\n") % f)
                else:
                    self.dirstate.update([f], "a")
         finally:
             if needs_unlock:
             del wlock

----------
messages: 1429
nosy: lifeless
priority: bug
status: unread
title: localrepo.add() fails to unlock

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue274>
____________________________________________________



More information about the Mercurial mailing list