Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to push all bookmarks to another repo, all at once? (Mercurial)

Tags:

mercurial

I am importing one Mercurial repo into another, maintaining history. There are several bookmarked heads on the default branch, and I want those bookmarked heads to still be bookmarked in the new, merged repo. As far as I can tell, the two ways to do this is to either,

  1. pull each bookmark individually
  2. pull the entire thing and recreate the bookmarks by hand.
like image 751
moswald Avatar asked Oct 09 '22 12:10

moswald


2 Answers

Extending the previous answer, here's how to push all branches using awk and the output of hg bookmarks in bash:

hg bookmarks | awk '{if (NF == 3) print $2; else print $1;}' | xargs -n 1 hg push -f -B
like image 166
Livius Avatar answered Oct 13 '22 20:10

Livius


Unix:

hg push $(hg bookmarks -T "-B {bookmark} ")

Windows:

for /f "delims=" %A in ('hg bookmarks -T "-B {bookmark} "') do @hg push %A

PowerShell:

hg bookmarks -T "{bookmark}\n" | %{ Write-Host === Bookmark $_ === ; hg push -B $_ }
like image 23
Dmitry Sokolov Avatar answered Oct 13 '22 21:10

Dmitry Sokolov