Hi All,

This might be a handy little recipe for you when porting your cassandane 
branches over.  I wanted to prefix all my cassandane commit messages with 
'cassandane:' so I did a slightly fancy version.  At the end of this email I 
show just the key bits to copy the commits without fiddling the subjects.

Note - you'll need the latest cassandane repo, which has a tag 
`moved-to-cyrus-imapd-repo` which should always match the 'master' branch now 
that we're not merging anything new, but it's definitely the safe tag to work 
from.  It should have the sha `ca7686687350a4a8f9e9ec1fbe943732238b6b4e`.

So I'm working on my branch 'blob-rfc'.  I have a branch with the same name in 
both the cyrus-imapd repo (implementing) and the cassandane repo (testing the 
implementation) - and I'd like to move all the Cassandane commits over.

Getting some neat patches:

brong@zula:~/src/cassandane$ git checkout blob-rfc
brong@zula:~/src/cassandane$ *git rebase moved-to-cyrus-imapd-repo*
brong@zula:~/src/cassandane$ *mkdir /tmp/z*
brong@zula:~/src/cassandane$ *git format-patch -o /tmp/z 
--subject-prefix="XYZZY" -N moved-to-cyrus-imapd-repo*
/tmp/z/0001-JMAPCore-test-blob-API.patch
/tmp/z/0002-Change-Blob-get-to-Blob-lookup.patch
/tmp/z/0003-Blob-set-update-all-content-and-content64-to-new-nam.patch
/tmp/z/0004-rename-xget-get.patch
/tmp/z/0005-Blob-lookup-now-uses-typeNames-and-matchedIds.patch
/tmp/z/0006-remove-asHex.patch

I did the subject-prefix and -N so I could grep for the same magic string and 
replace it with the prefix I wanted on all the patches:

brong@zula:~/src/cassandane$ *perl -p -i -e 's/\[XYZZY\]/cassandane:/' 
/tmp/z/*.patch*

And then I applied the commits over in my cyrus-imapd branch:

brong@zula:~/src/cyrus-imapd$ git checkout blob-rfc
brong@zula:~/src/cyrus-imapd$ git rebase origin/master
brong@zula:~/src/cyrus-imapd$ *git am --directory=cassandane /tmp/z/*.patch*
Applying: cassandane: JMAPCore: test blob API
Applying: cassandane: Change Blob/get to Blob/lookup
Applying: cassandane: Blob/set: update all content and content64 to new names
Applying: cassandane: rename xget -> get
Applying: cassandane: Blob/lookup now uses typeNames and matchedIds
Applying: cassandane: remove asHex
brong@zula:~/src/cyrus-imapd$ git push --force-with-lease origin blob-rfc

And just like that - my blob-rfc branch is now self-contained with both the 
code and the cassandane tests.  I closed the PR on Cassandane and commented on 
the PR in cyrus-imapd.

The bits *highlighted in bold* above are the key recipe.  If you don't care 
about prefixes you can simplify a bit more:

cassandane$ mkdir /tmp/z*
*cassandane$ *git rebase moved-to-cyrus-imapd-repo*
cassandane$ *git format-patch -o /tmp/z moved-to-cyrus-imapd-repo
*cyrus-imapd$ *git am --directory=cassandane /tmp/z/*.patch
*cyrus-imapd$* *rm -rf /tmp/z

And that will get you a series of commits transplanted into the cassandane 
subdirectory in the new repo.

Cheers,

Bron.

--
  Bron Gondwana, CEO, Fastmail Pty Ltd
  br...@fastmailteam.com


------------------------------------------
Cyrus: Devel
Permalink: 
https://cyrus.topicbox.com/groups/devel/T7ef110efd9c1dd85-Mef02c90ed2a8d697213e159b
Delivery options: https://cyrus.topicbox.com/groups/devel/subscription

Reply via email to