equal
deleted
inserted
replaced
352 def file(self, f): |
352 def file(self, f): |
353 if f[0] == '/': f = f[1:] |
353 if f[0] == '/': f = f[1:] |
354 return filelog(self.opener, f) |
354 return filelog(self.opener, f) |
355 |
355 |
356 def transaction(self): |
356 def transaction(self): |
|
357 # save dirstate for undo |
|
358 ds = self.opener("dirstate").read() |
|
359 self.opener("undo.dirstate", "w").write(ds) |
357 return transaction(self.opener, self.join("journal"), |
360 return transaction(self.opener, self.join("journal"), |
358 self.join("undo")) |
361 self.join("undo")) |
359 |
362 |
360 def recover(self): |
363 def recover(self): |
361 lock = self.lock() |
364 lock = self.lock() |
366 self.ui.warn("no interrupted transaction available\n") |
369 self.ui.warn("no interrupted transaction available\n") |
367 |
370 |
368 def undo(self): |
371 def undo(self): |
369 lock = self.lock() |
372 lock = self.lock() |
370 if os.path.exists(self.join("undo")): |
373 if os.path.exists(self.join("undo")): |
371 f = self.changelog.read(self.changelog.tip())[3] |
|
372 self.ui.status("attempting to rollback last transaction\n") |
374 self.ui.status("attempting to rollback last transaction\n") |
373 rollback(self.opener, self.join("undo")) |
375 rollback(self.opener, self.join("undo")) |
374 self.manifest = manifest(self.opener) |
376 self.dirstate = None |
375 self.changelog = changelog(self.opener) |
377 os.rename(self.join("undo.dirstate"), self.join("dirstate")) |
376 |
378 self.dirstate = dirstate(self.opener, self.ui, self.root) |
377 self.ui.status("discarding dirstate\n") |
|
378 node = self.changelog.tip() |
|
379 f.sort() |
|
380 |
|
381 self.dirstate.setparents(node) |
|
382 self.dirstate.update(f, 'i') |
|
383 |
|
384 else: |
379 else: |
385 self.ui.warn("no undo information available\n") |
380 self.ui.warn("no undo information available\n") |
386 |
381 |
387 def lock(self, wait = 1): |
382 def lock(self, wait = 1): |
388 try: |
383 try: |