# HG changeset patch # User Steve Losh # Date 1311010476 14400 # Node ID 78819a1b530ec97408cbf919f537067f6b115f11 # Parent fa1f7726b08b297f0066f17cac3f350553fe8b05 api: wrap the exists mkdir call to avoid needless errors diff -r fa1f7726b08b -r 78819a1b530e review/api.py --- a/review/api.py Mon Jul 18 13:22:12 2011 -0400 +++ b/review/api.py Mon Jul 18 13:34:36 2011 -0400 @@ -425,8 +425,14 @@ def _create_exists_entry(self): path = os.path.join(self.repo.root, self.node) - os.mkdir(path) - with open(os.path.join(path, '.exists'), 'w') as e: + + if os.path.exists(path): + return + + if not os.path.exists(path): + os.mkdir(path) + + with open(os.path.join(path, '.exists'), 'w'): pass cmdutil.commit(self.ui, self.repo, _commitfunc,