rakelib/hglib.rb
changeset 72 3e832d54a4af
parent 71 68c8cccbdec5
child 73 d2fd92cae180
--- a/rakelib/hglib.rb	Thu Nov 03 22:27:02 2016 +0000
+++ b/rakelib/hglib.rb	Fri Nov 04 00:22:47 2016 +0000
@@ -203,6 +203,23 @@
       end
     end
 
+    # Return name of an active bookmark or nil if no bookmark
+    # is active
+    def bookmark() 
+      filename = File.join(@path, '.hg', 'bookmarks.current')
+      if File.exist? filename then
+        file = File.open(filename, "r")
+        begin
+          bookmark = file.read.chomp
+        ensure
+          file.close()
+        end
+        return bookmark
+      else
+        return nil
+      end
+    end
+
     # Return a hash "bookmark => revision" of all 
     # bookmarks. 
     def bookmarks(branch = nil)
@@ -216,7 +233,7 @@
       return bookmarks
     end
 
-    def pull(remote = 'default', user: nil, pass: nil, rev: nil)
+    def pull(remote = 'default', user: nil, pass: nil, rev: nil, bookmarks: [])
       authconf = []
       if pass != nil then
         if user == nil then