ScottDuckworth / python-anyvcs

A Python abstraction layer for multiple version control systems
BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

HgRepo.bookmarks() throws AssertionError for a bookmark on rev -1 #46

Closed OEP closed 10 years ago

OEP commented 10 years ago

It's kind of dumb, but it is possible to bookmark revision -1:

$> hg init
$> hg bookmarks
no bookmarks set
$> hg bookmark dumb-bookmark -r tip
$> hg bookmarks
 * dumb-bookmark             -1:000000000000

For this kind of output, python-anyvcs throws an AssertionError. I guess anyvcs.hg.bookmark_rx does not handle the - character?

In [1]: import anyvcs
In [2]: x = anyvcs.open('.')
In [3]: x.bookmarks()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/tmp.oaQDof0l7H/<ipython-input-3-c9ba10395f58> in <module>()
----> 1 x.bookmarks()

/home/pkilgo/.local/lib/python2.7/site-packages/anyvcs-1.3.1-py2.7.egg/anyvcs/hg.pyc in bookmarks(self)
    312         for line in output.splitlines():
    313             m = bookmarks_rx.match(line)
--> 314             assert m, 'unexpected output: ' + line
    315             results.append(m.group('name'))
    316         return results

AssertionError: unexpected output:  * dumb-bookmark             -1:000000000000
ScottDuckworth commented 10 years ago

Fixed in de3b548b547ce9ff83eb2430909b5e0bd683a994