api: wrap the exists mkdir call to avoid needless errors
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 18 Jul 2011 13:34:36 -0400 |
parents |
fa1f7726b08b
|
children |
638009474a3b
5bef954cfecd
|
branches/tags |
(none) |
files |
review/api.py |
Changes
--- 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,