Show More
@@ -232,13 +232,13 b' class localrepository:' | |||||
232 | return False |
|
232 | return False | |
233 |
|
233 | |||
234 | def undo(self): |
|
234 | def undo(self): | |
|
235 | wlock = self.wlock() | |||
235 | lock = self.lock() |
|
236 | lock = self.lock() | |
236 | if os.path.exists(self.join("undo")): |
|
237 | if os.path.exists(self.join("undo")): | |
237 | self.ui.status(_("rolling back last transaction\n")) |
|
238 | self.ui.status(_("rolling back last transaction\n")) | |
238 | transaction.rollback(self.opener, self.join("undo")) |
|
239 | transaction.rollback(self.opener, self.join("undo")) | |
239 | self.dirstate = None |
|
|||
240 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) |
|
240 | util.rename(self.join("undo.dirstate"), self.join("dirstate")) | |
241 | self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root) |
|
241 | self.dirstate.read() | |
242 | else: |
|
242 | else: | |
243 | self.ui.warn(_("no undo information available\n")) |
|
243 | self.ui.warn(_("no undo information available\n")) | |
244 |
|
244 | |||
@@ -251,6 +251,17 b' class localrepository:' | |||||
251 | return lock.lock(self.join("lock"), wait) |
|
251 | return lock.lock(self.join("lock"), wait) | |
252 | raise inst |
|
252 | raise inst | |
253 |
|
253 | |||
|
254 | def wlock(self, wait=1): | |||
|
255 | try: | |||
|
256 | wlock = lock.lock(self.join("wlock"), 0, self.dirstate.write) | |||
|
257 | except lock.LockHeld, inst: | |||
|
258 | if not wait: | |||
|
259 | raise inst | |||
|
260 | self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0]) | |||
|
261 | wlock = lock.lock(self.join("wlock"), wait, self.dirstate.write) | |||
|
262 | self.dirstate.read() | |||
|
263 | return wlock | |||
|
264 | ||||
254 | def rawcommit(self, files, text, user, date, p1=None, p2=None): |
|
265 | def rawcommit(self, files, text, user, date, p1=None, p2=None): | |
255 | orig_parent = self.dirstate.parents()[0] or nullid |
|
266 | orig_parent = self.dirstate.parents()[0] or nullid | |
256 | p1 = p1 or self.dirstate.parents()[0] or nullid |
|
267 | p1 = p1 or self.dirstate.parents()[0] or nullid | |
@@ -267,6 +278,8 b' class localrepository:' | |||||
267 | else: |
|
278 | else: | |
268 | update_dirstate = 0 |
|
279 | update_dirstate = 0 | |
269 |
|
280 | |||
|
281 | wlock = self.wlock() | |||
|
282 | lock = self.lock() | |||
270 | tr = self.transaction() |
|
283 | tr = self.transaction() | |
271 | mm = m1.copy() |
|
284 | mm = m1.copy() | |
272 | mfm = mf1.copy() |
|
285 | mfm = mf1.copy() | |
@@ -355,6 +368,7 b' class localrepository:' | |||||
355 | if not self.hook("precommit"): |
|
368 | if not self.hook("precommit"): | |
356 | return None |
|
369 | return None | |
357 |
|
370 | |||
|
371 | wlock = self.wlock() | |||
358 | lock = self.lock() |
|
372 | lock = self.lock() | |
359 | tr = self.transaction() |
|
373 | tr = self.transaction() | |
360 |
|
374 | |||
@@ -526,6 +540,7 b' class localrepository:' | |||||
526 | return (c, a, d, u) |
|
540 | return (c, a, d, u) | |
527 |
|
541 | |||
528 | def add(self, list): |
|
542 | def add(self, list): | |
|
543 | wlock = self.wlock() | |||
529 | for f in list: |
|
544 | for f in list: | |
530 | p = self.wjoin(f) |
|
545 | p = self.wjoin(f) | |
531 | if not os.path.exists(p): |
|
546 | if not os.path.exists(p): | |
@@ -538,6 +553,7 b' class localrepository:' | |||||
538 | self.dirstate.update([f], "a") |
|
553 | self.dirstate.update([f], "a") | |
539 |
|
554 | |||
540 | def forget(self, list): |
|
555 | def forget(self, list): | |
|
556 | wlock = self.wlock() | |||
541 | for f in list: |
|
557 | for f in list: | |
542 | if self.dirstate.state(f) not in 'ai': |
|
558 | if self.dirstate.state(f) not in 'ai': | |
543 | self.ui.warn(_("%s not added!\n") % f) |
|
559 | self.ui.warn(_("%s not added!\n") % f) | |
@@ -551,6 +567,7 b' class localrepository:' | |||||
551 | util.unlink(self.wjoin(f)) |
|
567 | util.unlink(self.wjoin(f)) | |
552 | except OSError, inst: |
|
568 | except OSError, inst: | |
553 | if inst.errno != errno.ENOENT: raise |
|
569 | if inst.errno != errno.ENOENT: raise | |
|
570 | wlock = self.wlock() | |||
554 | for f in list: |
|
571 | for f in list: | |
555 | p = self.wjoin(f) |
|
572 | p = self.wjoin(f) | |
556 | if os.path.exists(p): |
|
573 | if os.path.exists(p): | |
@@ -568,6 +585,7 b' class localrepository:' | |||||
568 | mn = self.changelog.read(p)[0] |
|
585 | mn = self.changelog.read(p)[0] | |
569 | mf = self.manifest.readflags(mn) |
|
586 | mf = self.manifest.readflags(mn) | |
570 | m = self.manifest.read(mn) |
|
587 | m = self.manifest.read(mn) | |
|
588 | wlock = self.wlock() | |||
571 | for f in list: |
|
589 | for f in list: | |
572 | if self.dirstate.state(f) not in "r": |
|
590 | if self.dirstate.state(f) not in "r": | |
573 | self.ui.warn("%s not removed!\n" % f) |
|
591 | self.ui.warn("%s not removed!\n" % f) | |
@@ -584,6 +602,7 b' class localrepository:' | |||||
584 | elif not os.path.isfile(p): |
|
602 | elif not os.path.isfile(p): | |
585 | self.ui.warn(_("copy failed: %s is not a file\n") % dest) |
|
603 | self.ui.warn(_("copy failed: %s is not a file\n") % dest) | |
586 | else: |
|
604 | else: | |
|
605 | wlock = self.wlock() | |||
587 | if self.dirstate.state(dest) == '?': |
|
606 | if self.dirstate.state(dest) == '?': | |
588 | self.dirstate.update([dest], "a") |
|
607 | self.dirstate.update([dest], "a") | |
589 | self.dirstate.copy(source, dest) |
|
608 | self.dirstate.copy(source, dest) | |
@@ -1374,6 +1393,9 b' class localrepository:' | |||||
1374 | mw[f] = "" |
|
1393 | mw[f] = "" | |
1375 | mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) |
|
1394 | mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False)) | |
1376 |
|
1395 | |||
|
1396 | if moddirstate: | |||
|
1397 | wlock = self.wlock() | |||
|
1398 | ||||
1377 | for f in d: |
|
1399 | for f in d: | |
1378 | if f in mw: del mw[f] |
|
1400 | if f in mw: del mw[f] | |
1379 |
|
1401 |
General Comments 0
You need to be logged in to leave comments.
Login now