Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/bookmarks.py (28 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | May 15 2019, 1:19 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| return [] | return [] | ||||
| def _readactive(repo, marks): | def _readactive(repo, marks): | ||||
| """ | """ | ||||
| Get the active bookmark. We can have an active bookmark that updates | Get the active bookmark. We can have an active bookmark that updates | ||||
| itself as we commit. This function returns the name of that bookmark. | itself as we commit. This function returns the name of that bookmark. | ||||
| It is stored in .hg/bookmarks.current | It is stored in .hg/bookmarks.current | ||||
| """ | """ | ||||
| try: | |||||
| file = repo.vfs('bookmarks.current') | |||||
| except IOError as inst: | |||||
| if inst.errno != errno.ENOENT: | |||||
| raise | |||||
| return None | |||||
| try: | |||||
| # No readline() in osutil.posixfile, reading everything is | # No readline() in osutil.posixfile, reading everything is | ||||
| # cheap. | # cheap. | ||||
| # Note that it's possible for readlines() here to raise | content = repo.vfs.tryread('bookmarks.current') | ||||
| # IOError, since we might be reading the active mark over | mark = encoding.tolocal((content.splitlines() or [''])[0]) | ||||
| # static-http which only tries to load the file when we try | |||||
| # to read from it. | |||||
| mark = encoding.tolocal((file.readlines() or [''])[0]) | |||||
| if mark == '' or mark not in marks: | if mark == '' or mark not in marks: | ||||
| mark = None | mark = None | ||||
| except IOError as inst: | |||||
| if inst.errno != errno.ENOENT: | |||||
| raise | |||||
| return None | |||||
| finally: | |||||
| file.close() | |||||
| return mark | return mark | ||||
| def activate(repo, mark): | def activate(repo, mark): | ||||
| """ | """ | ||||
| Set the given bookmark to be 'active', meaning that this bookmark will | Set the given bookmark to be 'active', meaning that this bookmark will | ||||
| follow new commits that are made. | follow new commits that are made. | ||||
| The name is recorded in .hg/bookmarks.current | The name is recorded in .hg/bookmarks.current | ||||
| """ | """ | ||||