threads / discuss / 28945

Monotone to git mirroring ... how to do updates

Subject: Monotone to git mirroring ... how to do updates

## tl;dr

One message between Nov 16, 2011 and Nov 16, 2011.

replies: 0people: 1as markdown or json

Matěj Cepl· Nov 16, 2011, 10:49 UTC · lore
Hi,

I am trying to make script to be run from crontab which would periodically mirror pidgin monotone repo to my git one (using https://github.com/felipec/pidgin-git-import).

The main script in this repo is import:
#!/bin/sh
export GIT_DIR=pidgin.git
git init

git_marks="marks-git.txt" mtn_marks="marks-mtn.txt"

touch $git_marks $mtn_marks
mtn --db pidgin.mtn pull
mtn git_export --db pidgin.mtn --authors-file=authors_map.txt \
     --branches-file=branches_map.txt \
     --refs=revs --import-marks=$mtn_marks --export-marks=$mtn_marks \
     --use-one-changelog | \
   git fast-import --import-marks=$git_marks --export-marks=$git_marks

I can see what this script does on the first run (when creating new git repo), but what it does when I try to update with it already existing repo from updated pidgin.mtn database? Where I can see the new changes? Probably remote branches should be updated, right? (yes, I don't understand well what actually git fast-import does, that's the problem).

Also, if I get eventually new changes to the remote branches on the git repo, how can I update (preferably by one command) 140+ branches at once? Or do I have to do something in the tune of?

for remote_branch in $(git branches -r) ; do
    local_branch=$(echo $remote_branch |sed -e 's/origin\///')
    git checkout $local_branch
    git merge $remote_branch
done
Thank you in advance for any ideas,
Matěj

← back to recent threads