4fb559b7a3c8 — Mathieu Clabaut 9 years ago
Fix issue #52 on the selinc/guestrepo repository.

Also update to handle hg 3.6 and the bookmarks.readcurrent ->
readactive change.
2 files changed, 18 insertions(+), 5 deletions(-)

M guestrepo/grconfig.py
M guestrepo/guestrepo.py
M guestrepo/grconfig.py +4 -1
@@ 86,7 86,10 @@ class Guestrepo(object):
         if guestctx.bookmarks():
             json_dict['bookmarks'] = '/'.join(guestctx.bookmarks())
 
-        current_bookmark = bookmarks.readcurrent(guestrepo)
+        try:
+            current_bookmark = bookmarks.readcurrent(guestrepo)
+        except AttributeError:
+            current_bookmark = bookmarks.readactive(guestrepo)
 
         if current_bookmark:
             json_dict['current_bookmark'] = current_bookmark

          
M guestrepo/guestrepo.py +14 -4
@@ 341,7 341,11 @@ def summary(ui, repo, **opts):
             if bmarks:
                 output.append( '/'.join(bmarks) )
 
-            currentbookmark = bookmarks.readcurrent(guestrepo)
+            try:
+                currentbookmark = bookmarks.readcurrent(guestrepo)
+            except AttributeError:
+                currentbookmark = bookmarks.readactive(guestrepo)
+
             if currentbookmark:
                 output.append('*' + currentbookmark)
 

          
@@ 881,8 885,11 @@ def getstate(ui, repo, guests, keep=Fals
     config = conf.load_conf_as_kv_pair(repo['.'])
     for guest in filterwarnguests(ui, guests):
         guestrepo = hg.repository(ui, guest.root, create=False)
-        guestctx = guestrepo['.']
-        gueststate = guestctx.hex()
+        try:
+            gueststate = guestrepo['.'].hex()
+        except:
+            gueststate = guestrepo.csid
+
         # we try to see if we can keep the previous saved state
         if keep:
             guestconfig = config.get(guest.configpath, None)

          
@@ 972,7 979,10 @@ class guestrepo(object):
         if guestctx.bookmarks():
             json_dict['bookmarks'] = '/'.join(guestctx.bookmarks())
 
-        current_bookmark = bookmarks.readcurrent(guestrepo)
+        try:
+            current_bookmark = bookmarks.readcurrent(guestrepo)
+        except AttributeError:
+            currentbookmark = bookmarks.readactive(guestrepo)
 
         if current_bookmark:
             json_dict['current_bookmark'] = current_bookmark