Mercurial > hg
comparison hgext/bookmarks.py @ 13313:0c493e5ce8e9
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Jan 2011 17:22:37 -0600 |
parents | 5dac0d04b838 7f2b8aac7bdc |
children | a7376b92caaa |
comparison
equal
deleted
inserted
replaced
13304:e4b02eb825b1 | 13313:0c493e5ce8e9 |
---|---|
46 refs = repo._bookmarks | 46 refs = repo._bookmarks |
47 | 47 |
48 try: | 48 try: |
49 bms = repo.opener('bookmarks').read() | 49 bms = repo.opener('bookmarks').read() |
50 except IOError: | 50 except IOError: |
51 bms = None | 51 bms = '' |
52 if bms is not None: | 52 repo.opener('undo.bookmarks', 'w').write(bms) |
53 repo.opener('undo.bookmarks', 'w').write(bms) | |
54 | 53 |
55 if repo._bookmarkcurrent not in refs: | 54 if repo._bookmarkcurrent not in refs: |
56 setcurrent(repo, None) | 55 setcurrent(repo, None) |
57 wlock = repo.wlock() | 56 wlock = repo.wlock() |
58 try: | 57 try: |
261 if mark == '': | 260 if mark == '': |
262 mark = None | 261 mark = None |
263 file.close() | 262 file.close() |
264 return mark | 263 return mark |
265 | 264 |
266 def rollback(self, *args): | 265 def rollback(self, dryrun=False): |
267 if os.path.exists(self.join('undo.bookmarks')): | 266 if os.path.exists(self.join('undo.bookmarks')): |
268 util.rename(self.join('undo.bookmarks'), self.join('bookmarks')) | 267 if not dryrun: |
269 return super(bookmark_repo, self).rollback(*args) | 268 util.rename(self.join('undo.bookmarks'), self.join('bookmarks')) |
269 elif not os.path.exists(self.sjoin("undo")): | |
270 # avoid "no rollback information available" message | |
271 return 0 | |
272 return super(bookmark_repo, self).rollback(dryrun) | |
270 | 273 |
271 def lookup(self, key): | 274 def lookup(self, key): |
272 if key in self._bookmarks: | 275 if key in self._bookmarks: |
273 key = self._bookmarks[key] | 276 key = self._bookmarks[key] |
274 return super(bookmark_repo, self).lookup(key) | 277 return super(bookmark_repo, self).lookup(key) |