File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,23 @@ def remote_name_to_url(self, remote_name):
154154 return self ._config ['remote.' + remote_name + '.url' ]
155155
156156 def update_references (self ):
157- # TODO : if bookmarks exist, add them as git branches
157+ try :
158+ # We only care about bookmarks of the form 'name',
159+ # not 'remote/name'.
160+ def is_local_ref (item ): return item [0 ].count ('/' ) == 0
161+ bms = bookmarks .parse (self .repo )
162+ bms = dict (filter (is_local_ref , bms .items ()))
163+
164+ # Create a local Git branch name for each
165+ # Mercurial bookmark.
166+ for key in bms :
167+ hg_sha = hex (bms [key ])
168+ git_sha = self .map_git_get (hg_sha )
169+ self .git .set_ref ('refs/heads/' + key , git_sha )
170+ except AttributeError :
171+ # No bookmarks extension
172+ pass
173+
158174 c = self .map_git_get (hex (self .repo .changelog .tip ()))
159175 self .git .set_ref ('refs/heads/master' , c )
160176
You can’t perform that action at this time.
0 commit comments