You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Mike Tutkowski <mi...@solidfire.com> on 2013/06/13 00:25:11 UTC

Git question about applying patch files

I have a branch, solidfire_plugin, off of master in my local repo.

I wanted to submit a patch to Review Board.

Essentially, I followed these steps (where upstream is the official CS
repo):

git checkout master

git fetch upstream

git reset --hard upstream/master

git checkout solidfire_plugin

git merge master

git format-patch master --stdout > solidfire_plugin.patch (this collected
six commits worth of work)

git checkout master

git am solidfire_plugin.patch
This final command lead to this error message (below). I was surprised
because I had just performed a merge from master to solidfire_plugin before
generating the patch file (so I was thinking the patch file should cleanly
apply on master).

Any thoughts on this?

Thanks!

mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
Applying: SolidFire plug-in and enhancements to the storage plug-in
framework
/Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
trailing whitespace.

/Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
trailing whitespace.

/Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
trailing whitespace.

/Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
trailing whitespace.

/Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
trailing whitespace.

error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
error: patch failed: api/src/com/cloud/storage/Volume.java:120
error: api/src/com/cloud/storage/Volume.java: patch does not apply
error: patch failed: api/src/org/apache/cloudstack/api/ApiConstants.java:49
error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does not
apply
error: patch failed:
api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
error:
api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
patch does not apply
error: patch failed:
api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
error:
api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
patch does not apply
error: patch failed:
api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
error:
api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java: patch
does not apply
error: patch failed:
api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
patch does not apply
error: patch failed: client/WEB-INF/classes/resources/messages.properties:14
error: client/WEB-INF/classes/resources/messages.properties: patch does not
apply
error: patch failed: client/pom.xml:22
error: client/pom.xml: patch does not apply
error: patch failed: client/tomcatconf/applicationContext.xml.in:798
error: client/tomcatconf/applicationContext.xml.in: patch does not apply
error: patch failed:
core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
not apply
error: patch failed:
core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
error:
core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
patch does not apply
error: patch failed:
core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
error:
core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
patch does not apply
error: patch failed:
engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
error:
engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
patch does not apply
error: patch failed:
engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch does
not apply
error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
apply
error: patch failed:
engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
error:
engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
patch does not apply
error: patch failed:
engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
error:
engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
patch does not apply
error: patch failed:
engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
error:
engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
patch does not apply
error: patch failed:
engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
error:
engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
patch does not apply
error: patch failed:
plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
error:
plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
patch does not apply
error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
error: patch failed:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
error:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
patch does not apply
error:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
already exists in index
error: patch failed:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
error:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
patch does not apply
error:
plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
already exists in index
error: patch failed:
server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
patch does not apply
error: patch failed:
server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
does not apply
error: patch failed:
server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
does not apply
error: patch failed: server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does not
apply
error: patch failed:
server/src/com/cloud/configuration/ConfigurationManager.java:97
error: server/src/com/cloud/configuration/ConfigurationManager.java: patch
does not apply
error: patch failed:
server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
patch does not apply
error: patch failed:
server/src/com/cloud/server/ConfigurationServerImpl.java:925
error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch does
not apply
error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
error: server/src/com/cloud/storage/VolumeManager.java: patch does not apply
error: patch failed: server/src/com/cloud/storage/VolumeManagerImpl.java:58
error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does not
apply
error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
error: server/src/com/cloud/test/DatabaseConfig.java: patch does not apply
error: patch failed:
server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
does not apply
error: patch failed: setup/db/db/schema-410to420.sql:263
error: setup/db/db/schema-410to420.sql: patch does not apply
error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
error: patch failed: ui/dictionary.jsp:25
error: ui/dictionary.jsp: patch does not apply
error: patch failed: ui/scripts/configuration.js:906
error: ui/scripts/configuration.js: patch does not apply
error: patch failed: ui/scripts/docs.js:270
error: ui/scripts/docs.js: patch does not apply
error: patch failed: ui/scripts/storage.js:132
error: ui/scripts/storage.js: patch does not apply
Patch failed at 0001 SolidFire plug-in and enhancements to the storage
plug-in framework
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Re: Git question about applying patch files

Posted by Sheng Yang <sh...@yasker.org>.
Well, base on your situation, seems only thing you can do is use git-merge
to merge your branch back to master.

But since you're not a committer, so you cannot push (merged) master
directly. Some time people would create another remote repo and ask for
pull. But that's for very big changes mostly.

I think the clearest way right now, is:
1. on your branch: git diff master > patch_file
2. git checkout master
3. git checkout -b work_branch
4. patch -Np1 < patch_file
5. Do git-commit. Ensure all your modification is in the tree.

In step 4, you may want to separate your big patch to smaller ones to make
it easy for review/understanding.

And next time you can do git-rebase to keep the work branch clean and easy
to maintain.

--Sheng


On Thu, Jun 13, 2013 at 11:15 PM, Mike Tutkowski <
mike.tutkowski@solidfire.com> wrote:

> So...let's see...getting back to doing this now. :) I had to finish up
> implementing comments from a code review.
>
> Here is how I've been developing. Please let me know which option provided
> to me in this e-mail chain best fits my situation. I can, of course, do
> development in Git differently next release if it makes sense to change
> (perhaps using rebase instead of merge).
>
> Initially (as in right before I started developing code for 4.2), I got a
> fresh copy of the CS repo and then I created a branch off of master called
> solidfire_plugin.
>
> I did my development work in this branch.
>
> Every now and then (like weekly), I performed another fetch from the CS
> repo and merged its master (what I call upstream/master) into
> solidfire_plugin. I've probably performed about four of five such merges
> during my development.
>
> Thanks for the advice! :)
>
>
> On Thu, Jun 13, 2013 at 10:45 AM, Mike Tutkowski <
> mike.tutkowski@solidfire.com> wrote:
>
> > Thanks, everyone!
> >
> > Once I finish up implementing review suggestions, I can try again with
> > building a squashed patch file.
> >
> >
> > On Thu, Jun 13, 2013 at 8:41 AM, John Burwell <jb...@basho.com>
> wrote:
> >
> >> Prasanna,
> >>
> >> +1 to using rebase on feature branches.
> >>
> >> At least as I understand things and have experienced rebase, it
> >> preserves  all commits on the feature branch.  For Review Board and
> >> master merges, those commits need to be collapsed, or in git parlance,
> >> squashed.  The script I referenced below squashes the commits and
> >> works regardless of whether you have been using rebase or merge on
> >> your feature branch.
> >>
> >> Thanks,
> >> -John
> >>
> >> On Jun 13, 2013, at 2:01 AM, Prasanna Santhanam <ts...@apache.org> wrote:
> >>
> >> > The 'cleanest cleanest' way is to use rebase as Sheng recommends but I
> >> > know people who've used git successfully with just doing merge. It's
> >> > (rebase) one of those features of git you discover only after
> >> > using-abusing it for long enough. But if you're adventurous ..  :)
> >> >
> >> > Do NOT do a rebase if you've done merges until now on your branch.
> >> >
> >> > Here's a nice post explaining how to work with rebase for those
> >> > hesitant to use it:
> >> > http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/
> >> >
> >> > --
> >> > Prasanna.,
> >> >
> >> > On Thu, Jun 13, 2013 at 01:50:15AM -0400, John Burwell wrote:
> >> >> Mike,
> >> >>
> >> >> The cleanest way have found to create these patches is  actually
> >> >> create a temporary work branch from master, merge the feature branch
> >> >> into it with the squashed option, and then generate the patch.  This
> >> >> gist (https://gist.github.com/jburwell/5771480) is the shell script
> >> >> I used to generate the S3-backed Secondary Storage patch submissions
> >> >> to Review Board.  It should be fairly easy to adapt by adjusting the
> >> >> FEATURE_BRANCH and WORK_HOME values.
> >> >>
> >> >> Thanks,
> >> >> -John
> >> >>
> >> >> On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <
> >> mike.tutkowski@solidfire.com> wrote:
> >> >>
> >> >>> I have a branch, solidfire_plugin, off of master in my local repo.
> >> >>>
> >> >>> I wanted to submit a patch to Review Board.
> >> >>>
> >> >>> Essentially, I followed these steps (where upstream is the official
> CS
> >> >>> repo):
> >> >>>
> >> >>> git checkout master
> >> >>>
> >> >>> git fetch upstream
> >> >>>
> >> >>> git reset --hard upstream/master
> >> >>>
> >> >>> git checkout solidfire_plugin
> >> >>>
> >> >>> git merge master
> >> >>>
> >> >>> git format-patch master --stdout > solidfire_plugin.patch (this
> >> collected
> >> >>> six commits worth of work)
> >> >>>
> >> >>> git checkout master
> >> >>>
> >> >>> git am solidfire_plugin.patch
> >> >>> This final command lead to this error message (below). I was
> surprised
> >> >>> because I had just performed a merge from master to solidfire_plugin
> >> before
> >> >>> generating the patch file (so I was thinking the patch file should
> >> cleanly
> >> >>> apply on master).
> >> >>>
> >> >>> Any thoughts on this?
> >> >>>
> >> >>> Thanks!
> >> >>>
> >> >>> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> >> >>> Applying: SolidFire plug-in and enhancements to the storage plug-in
> >> >>> framework
> >> >>>
> >>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> >> >>> trailing whitespace.
> >> >>>
> >> >>>
> >>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> >> >>> trailing whitespace.
> >> >>>
> >> >>>
> >>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> >> >>> trailing whitespace.
> >> >>>
> >> >>>
> >>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> >> >>> trailing whitespace.
> >> >>>
> >> >>>
> >>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> >> >>> trailing whitespace.
> >> >>>
> >> >>> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> >> >>> error: api/src/com/cloud/offering/DiskOffering.java: patch does not
> >> apply
> >> >>> error: patch failed: api/src/com/cloud/storage/Volume.java:120
> >> >>> error: api/src/com/cloud/storage/Volume.java: patch does not apply
> >> >>> error: patch failed:
> >> api/src/org/apache/cloudstack/api/ApiConstants.java:49
> >> >>> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch
> >> does not
> >> >>> apply
> >> >>> error: patch failed:
> >> >>>
> >>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> >> >>> error:
> >> >>>
> >>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> >> >>> error:
> >> >>>
> >>
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> >> >>> error:
> >> >>>
> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:
> >> patch
> >> >>> does not apply
> >> >>> error: patch failed:
> >> >>> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> >> >>> error:
> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> client/WEB-INF/classes/resources/messages.properties:14
> >> >>> error: client/WEB-INF/classes/resources/messages.properties: patch
> >> does not
> >> >>> apply
> >> >>> error: patch failed: client/pom.xml:22
> >> >>> error: client/pom.xml: patch does not apply
> >> >>> error: patch failed: client/tomcatconf/
> applicationContext.xml.in:798
> >> >>> error: client/tomcatconf/applicationContext.xml.in: patch does not
> >> apply
> >> >>> error: patch failed:
> >> >>> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> >> >>> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch
> >> does
> >> >>> not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> >> >>> error:
> >> >>>
> >>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> >> >>> error:
> >> >>>
> >>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> >> >>> error:
> >> >>>
> >>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> >> >>> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java:
> patch
> >> does
> >> >>> not apply
> >> >>> error: patch failed:
> >> engine/schema/src/com/cloud/storage/VolumeVO.java:68
> >> >>> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does
> >> not
> >> >>> apply
> >> >>> error: patch failed:
> >> >>>
> >>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> >> >>> error:
> >> >>>
> >>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> >> >>> error:
> >> >>>
> >>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> >> >>> error:
> >> >>>
> >>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> >> >>> error:
> >> >>>
> >>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>>
> >>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> >> >>> error:
> >> >>>
> >>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> >> >>> patch does not apply
> >> >>> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> >> >>> error: plugins/storage/volume/solidfire/pom.xml: patch does not
> apply
> >> >>> error: patch failed:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> >> >>> error:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> >> >>> patch does not apply
> >> >>> error:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> >> >>> already exists in index
> >> >>> error: patch failed:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> >> >>> error:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> >> >>> patch does not apply
> >> >>> error:
> >> >>>
> >>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> >> >>> already exists in index
> >> >>> error: patch failed:
> >> >>> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> >> >>> error:
> >> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> >> >>> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:
> >> patch
> >> >>> does not apply
> >> >>> error: patch failed:
> >> >>> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> >> >>> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:
> >> patch
> >> >>> does not apply
> >> >>> error: patch failed:
> >> server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> >> >>> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch
> >> does not
> >> >>> apply
> >> >>> error: patch failed:
> >> >>> server/src/com/cloud/configuration/ConfigurationManager.java:97
> >> >>> error: server/src/com/cloud/configuration/ConfigurationManager.java:
> >> patch
> >> >>> does not apply
> >> >>> error: patch failed:
> >> >>>
> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> >> >>> error:
> >> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> >> >>> patch does not apply
> >> >>> error: patch failed:
> >> >>> server/src/com/cloud/server/ConfigurationServerImpl.java:925
> >> >>> error: server/src/com/cloud/server/ConfigurationServerImpl.java:
> >> patch does
> >> >>> not apply
> >> >>> error: patch failed:
> >> server/src/com/cloud/storage/VolumeManager.java:45
> >> >>> error: server/src/com/cloud/storage/VolumeManager.java: patch does
> >> not apply
> >> >>> error: patch failed:
> >> server/src/com/cloud/storage/VolumeManagerImpl.java:58
> >> >>> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch
> >> does not
> >> >>> apply
> >> >>> error: patch failed:
> server/src/com/cloud/test/DatabaseConfig.java:965
> >> >>> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not
> >> apply
> >> >>> error: patch failed:
> >> >>> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> >> >>> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:
> >> patch
> >> >>> does not apply
> >> >>> error: patch failed: setup/db/db/schema-410to420.sql:263
> >> >>> error: setup/db/db/schema-410to420.sql: patch does not apply
> >> >>> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> >> >>> error: tools/marvin/marvin/cloudstackConnection.py: patch does not
> >> apply
> >> >>> error: patch failed: ui/dictionary.jsp:25
> >> >>> error: ui/dictionary.jsp: patch does not apply
> >> >>> error: patch failed: ui/scripts/configuration.js:906
> >> >>> error: ui/scripts/configuration.js: patch does not apply
> >> >>> error: patch failed: ui/scripts/docs.js:270
> >> >>> error: ui/scripts/docs.js: patch does not apply
> >> >>> error: patch failed: ui/scripts/storage.js:132
> >> >>> error: ui/scripts/storage.js: patch does not apply
> >> >>> Patch failed at 0001 SolidFire plug-in and enhancements to the
> storage
> >> >>> plug-in framework
> >> >>> When you have resolved this problem run "git am --resolved".
> >> >>> If you would prefer to skip this patch, instead run "git am --skip".
> >> >>> To restore the original branch and stop patching run "git am
> --abort".
> >> >>>
> >> >>>
> >> >>> --
> >> >>> *Mike Tutkowski*
> >> >>> *Senior CloudStack Developer, SolidFire Inc.*
> >> >>> e: mike.tutkowski@solidfire.com
> >> >>> o: 303.746.7302
> >> >>> Advancing the way the world uses the
> >> >>> cloud<http://solidfire.com/solution/overview/?video=play>
> >> >>> *?*
> >> >
> >> >
> >> > ------------------------
> >> > Powered by BigRock.com
> >> >
> >>
> >
> >
> >
> > --
> > *Mike Tutkowski*
> > *Senior CloudStack Developer, SolidFire Inc.*
> > e: mike.tutkowski@solidfire.com
> > o: 303.746.7302
> > Advancing the way the world uses the cloud<
> http://solidfire.com/solution/overview/?video=play>
> > *™*
> >
>
>
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkowski@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>

Re: Git question about applying patch files

Posted by Mike Tutkowski <mi...@solidfire.com>.
So...let's see...getting back to doing this now. :) I had to finish up
implementing comments from a code review.

Here is how I've been developing. Please let me know which option provided
to me in this e-mail chain best fits my situation. I can, of course, do
development in Git differently next release if it makes sense to change
(perhaps using rebase instead of merge).

Initially (as in right before I started developing code for 4.2), I got a
fresh copy of the CS repo and then I created a branch off of master called
solidfire_plugin.

I did my development work in this branch.

Every now and then (like weekly), I performed another fetch from the CS
repo and merged its master (what I call upstream/master) into
solidfire_plugin. I've probably performed about four of five such merges
during my development.

Thanks for the advice! :)


On Thu, Jun 13, 2013 at 10:45 AM, Mike Tutkowski <
mike.tutkowski@solidfire.com> wrote:

> Thanks, everyone!
>
> Once I finish up implementing review suggestions, I can try again with
> building a squashed patch file.
>
>
> On Thu, Jun 13, 2013 at 8:41 AM, John Burwell <jb...@basho.com> wrote:
>
>> Prasanna,
>>
>> +1 to using rebase on feature branches.
>>
>> At least as I understand things and have experienced rebase, it
>> preserves  all commits on the feature branch.  For Review Board and
>> master merges, those commits need to be collapsed, or in git parlance,
>> squashed.  The script I referenced below squashes the commits and
>> works regardless of whether you have been using rebase or merge on
>> your feature branch.
>>
>> Thanks,
>> -John
>>
>> On Jun 13, 2013, at 2:01 AM, Prasanna Santhanam <ts...@apache.org> wrote:
>>
>> > The 'cleanest cleanest' way is to use rebase as Sheng recommends but I
>> > know people who've used git successfully with just doing merge. It's
>> > (rebase) one of those features of git you discover only after
>> > using-abusing it for long enough. But if you're adventurous ..  :)
>> >
>> > Do NOT do a rebase if you've done merges until now on your branch.
>> >
>> > Here's a nice post explaining how to work with rebase for those
>> > hesitant to use it:
>> > http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/
>> >
>> > --
>> > Prasanna.,
>> >
>> > On Thu, Jun 13, 2013 at 01:50:15AM -0400, John Burwell wrote:
>> >> Mike,
>> >>
>> >> The cleanest way have found to create these patches is  actually
>> >> create a temporary work branch from master, merge the feature branch
>> >> into it with the squashed option, and then generate the patch.  This
>> >> gist (https://gist.github.com/jburwell/5771480) is the shell script
>> >> I used to generate the S3-backed Secondary Storage patch submissions
>> >> to Review Board.  It should be fairly easy to adapt by adjusting the
>> >> FEATURE_BRANCH and WORK_HOME values.
>> >>
>> >> Thanks,
>> >> -John
>> >>
>> >> On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <
>> mike.tutkowski@solidfire.com> wrote:
>> >>
>> >>> I have a branch, solidfire_plugin, off of master in my local repo.
>> >>>
>> >>> I wanted to submit a patch to Review Board.
>> >>>
>> >>> Essentially, I followed these steps (where upstream is the official CS
>> >>> repo):
>> >>>
>> >>> git checkout master
>> >>>
>> >>> git fetch upstream
>> >>>
>> >>> git reset --hard upstream/master
>> >>>
>> >>> git checkout solidfire_plugin
>> >>>
>> >>> git merge master
>> >>>
>> >>> git format-patch master --stdout > solidfire_plugin.patch (this
>> collected
>> >>> six commits worth of work)
>> >>>
>> >>> git checkout master
>> >>>
>> >>> git am solidfire_plugin.patch
>> >>> This final command lead to this error message (below). I was surprised
>> >>> because I had just performed a merge from master to solidfire_plugin
>> before
>> >>> generating the patch file (so I was thinking the patch file should
>> cleanly
>> >>> apply on master).
>> >>>
>> >>> Any thoughts on this?
>> >>>
>> >>> Thanks!
>> >>>
>> >>> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
>> >>> Applying: SolidFire plug-in and enhancements to the storage plug-in
>> >>> framework
>> >>>
>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
>> >>> trailing whitespace.
>> >>>
>> >>>
>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
>> >>> trailing whitespace.
>> >>>
>> >>>
>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
>> >>> trailing whitespace.
>> >>>
>> >>>
>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
>> >>> trailing whitespace.
>> >>>
>> >>>
>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
>> >>> trailing whitespace.
>> >>>
>> >>> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
>> >>> error: api/src/com/cloud/offering/DiskOffering.java: patch does not
>> apply
>> >>> error: patch failed: api/src/com/cloud/storage/Volume.java:120
>> >>> error: api/src/com/cloud/storage/Volume.java: patch does not apply
>> >>> error: patch failed:
>> api/src/org/apache/cloudstack/api/ApiConstants.java:49
>> >>> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch
>> does not
>> >>> apply
>> >>> error: patch failed:
>> >>>
>> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
>> >>> error:
>> >>>
>> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
>> >>> error:
>> >>>
>> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
>> >>> error:
>> >>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:
>> patch
>> >>> does not apply
>> >>> error: patch failed:
>> >>> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
>> >>> error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> client/WEB-INF/classes/resources/messages.properties:14
>> >>> error: client/WEB-INF/classes/resources/messages.properties: patch
>> does not
>> >>> apply
>> >>> error: patch failed: client/pom.xml:22
>> >>> error: client/pom.xml: patch does not apply
>> >>> error: patch failed: client/tomcatconf/applicationContext.xml.in:798
>> >>> error: client/tomcatconf/applicationContext.xml.in: patch does not
>> apply
>> >>> error: patch failed:
>> >>> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
>> >>> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch
>> does
>> >>> not apply
>> >>> error: patch failed:
>> >>>
>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
>> >>> error:
>> >>>
>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
>> >>> error:
>> >>>
>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
>> >>> error:
>> >>>
>> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
>> >>> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch
>> does
>> >>> not apply
>> >>> error: patch failed:
>> engine/schema/src/com/cloud/storage/VolumeVO.java:68
>> >>> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does
>> not
>> >>> apply
>> >>> error: patch failed:
>> >>>
>> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
>> >>> error:
>> >>>
>> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
>> >>> error:
>> >>>
>> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
>> >>> error:
>> >>>
>> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
>> >>> error:
>> >>>
>> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>>
>> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
>> >>> error:
>> >>>
>> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
>> >>> patch does not apply
>> >>> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
>> >>> error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
>> >>> error: patch failed:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
>> >>> error:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
>> >>> patch does not apply
>> >>> error:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
>> >>> already exists in index
>> >>> error: patch failed:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
>> >>> error:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
>> >>> patch does not apply
>> >>> error:
>> >>>
>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
>> >>> already exists in index
>> >>> error: patch failed:
>> >>> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
>> >>> error:
>> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
>> >>> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:
>> patch
>> >>> does not apply
>> >>> error: patch failed:
>> >>> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
>> >>> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:
>> patch
>> >>> does not apply
>> >>> error: patch failed:
>> server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
>> >>> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch
>> does not
>> >>> apply
>> >>> error: patch failed:
>> >>> server/src/com/cloud/configuration/ConfigurationManager.java:97
>> >>> error: server/src/com/cloud/configuration/ConfigurationManager.java:
>> patch
>> >>> does not apply
>> >>> error: patch failed:
>> >>> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
>> >>> error:
>> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
>> >>> patch does not apply
>> >>> error: patch failed:
>> >>> server/src/com/cloud/server/ConfigurationServerImpl.java:925
>> >>> error: server/src/com/cloud/server/ConfigurationServerImpl.java:
>> patch does
>> >>> not apply
>> >>> error: patch failed:
>> server/src/com/cloud/storage/VolumeManager.java:45
>> >>> error: server/src/com/cloud/storage/VolumeManager.java: patch does
>> not apply
>> >>> error: patch failed:
>> server/src/com/cloud/storage/VolumeManagerImpl.java:58
>> >>> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch
>> does not
>> >>> apply
>> >>> error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
>> >>> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not
>> apply
>> >>> error: patch failed:
>> >>> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
>> >>> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:
>> patch
>> >>> does not apply
>> >>> error: patch failed: setup/db/db/schema-410to420.sql:263
>> >>> error: setup/db/db/schema-410to420.sql: patch does not apply
>> >>> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
>> >>> error: tools/marvin/marvin/cloudstackConnection.py: patch does not
>> apply
>> >>> error: patch failed: ui/dictionary.jsp:25
>> >>> error: ui/dictionary.jsp: patch does not apply
>> >>> error: patch failed: ui/scripts/configuration.js:906
>> >>> error: ui/scripts/configuration.js: patch does not apply
>> >>> error: patch failed: ui/scripts/docs.js:270
>> >>> error: ui/scripts/docs.js: patch does not apply
>> >>> error: patch failed: ui/scripts/storage.js:132
>> >>> error: ui/scripts/storage.js: patch does not apply
>> >>> Patch failed at 0001 SolidFire plug-in and enhancements to the storage
>> >>> plug-in framework
>> >>> When you have resolved this problem run "git am --resolved".
>> >>> If you would prefer to skip this patch, instead run "git am --skip".
>> >>> To restore the original branch and stop patching run "git am --abort".
>> >>>
>> >>>
>> >>> --
>> >>> *Mike Tutkowski*
>> >>> *Senior CloudStack Developer, SolidFire Inc.*
>> >>> e: mike.tutkowski@solidfire.com
>> >>> o: 303.746.7302
>> >>> Advancing the way the world uses the
>> >>> cloud<http://solidfire.com/solution/overview/?video=play>
>> >>> *?*
>> >
>> >
>> > ------------------------
>> > Powered by BigRock.com
>> >
>>
>
>
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkowski@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>



-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Re: Git question about applying patch files

Posted by Mike Tutkowski <mi...@solidfire.com>.
Thanks, everyone!

Once I finish up implementing review suggestions, I can try again with
building a squashed patch file.


On Thu, Jun 13, 2013 at 8:41 AM, John Burwell <jb...@basho.com> wrote:

> Prasanna,
>
> +1 to using rebase on feature branches.
>
> At least as I understand things and have experienced rebase, it
> preserves  all commits on the feature branch.  For Review Board and
> master merges, those commits need to be collapsed, or in git parlance,
> squashed.  The script I referenced below squashes the commits and
> works regardless of whether you have been using rebase or merge on
> your feature branch.
>
> Thanks,
> -John
>
> On Jun 13, 2013, at 2:01 AM, Prasanna Santhanam <ts...@apache.org> wrote:
>
> > The 'cleanest cleanest' way is to use rebase as Sheng recommends but I
> > know people who've used git successfully with just doing merge. It's
> > (rebase) one of those features of git you discover only after
> > using-abusing it for long enough. But if you're adventurous ..  :)
> >
> > Do NOT do a rebase if you've done merges until now on your branch.
> >
> > Here's a nice post explaining how to work with rebase for those
> > hesitant to use it:
> > http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/
> >
> > --
> > Prasanna.,
> >
> > On Thu, Jun 13, 2013 at 01:50:15AM -0400, John Burwell wrote:
> >> Mike,
> >>
> >> The cleanest way have found to create these patches is  actually
> >> create a temporary work branch from master, merge the feature branch
> >> into it with the squashed option, and then generate the patch.  This
> >> gist (https://gist.github.com/jburwell/5771480) is the shell script
> >> I used to generate the S3-backed Secondary Storage patch submissions
> >> to Review Board.  It should be fairly easy to adapt by adjusting the
> >> FEATURE_BRANCH and WORK_HOME values.
> >>
> >> Thanks,
> >> -John
> >>
> >> On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <
> mike.tutkowski@solidfire.com> wrote:
> >>
> >>> I have a branch, solidfire_plugin, off of master in my local repo.
> >>>
> >>> I wanted to submit a patch to Review Board.
> >>>
> >>> Essentially, I followed these steps (where upstream is the official CS
> >>> repo):
> >>>
> >>> git checkout master
> >>>
> >>> git fetch upstream
> >>>
> >>> git reset --hard upstream/master
> >>>
> >>> git checkout solidfire_plugin
> >>>
> >>> git merge master
> >>>
> >>> git format-patch master --stdout > solidfire_plugin.patch (this
> collected
> >>> six commits worth of work)
> >>>
> >>> git checkout master
> >>>
> >>> git am solidfire_plugin.patch
> >>> This final command lead to this error message (below). I was surprised
> >>> because I had just performed a merge from master to solidfire_plugin
> before
> >>> generating the patch file (so I was thinking the patch file should
> cleanly
> >>> apply on master).
> >>>
> >>> Any thoughts on this?
> >>>
> >>> Thanks!
> >>>
> >>> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> >>> Applying: SolidFire plug-in and enhancements to the storage plug-in
> >>> framework
> >>>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> >>> trailing whitespace.
> >>>
> >>>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> >>> trailing whitespace.
> >>>
> >>>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> >>> trailing whitespace.
> >>>
> >>>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> >>> trailing whitespace.
> >>>
> >>>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> >>> trailing whitespace.
> >>>
> >>> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> >>> error: api/src/com/cloud/offering/DiskOffering.java: patch does not
> apply
> >>> error: patch failed: api/src/com/cloud/storage/Volume.java:120
> >>> error: api/src/com/cloud/storage/Volume.java: patch does not apply
> >>> error: patch failed:
> api/src/org/apache/cloudstack/api/ApiConstants.java:49
> >>> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does
> not
> >>> apply
> >>> error: patch failed:
> >>>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> >>> error:
> >>>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> >>> error:
> >>>
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> >>> error:
> >>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:
> patch
> >>> does not apply
> >>> error: patch failed:
> >>> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> >>> error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> >>> patch does not apply
> >>> error: patch failed:
> client/WEB-INF/classes/resources/messages.properties:14
> >>> error: client/WEB-INF/classes/resources/messages.properties: patch
> does not
> >>> apply
> >>> error: patch failed: client/pom.xml:22
> >>> error: client/pom.xml: patch does not apply
> >>> error: patch failed: client/tomcatconf/applicationContext.xml.in:798
> >>> error: client/tomcatconf/applicationContext.xml.in: patch does not
> apply
> >>> error: patch failed:
> >>> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> >>> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch
> does
> >>> not apply
> >>> error: patch failed:
> >>>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> >>> error:
> >>>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> >>> error:
> >>>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> >>> error:
> >>>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> >>> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch
> does
> >>> not apply
> >>> error: patch failed:
> engine/schema/src/com/cloud/storage/VolumeVO.java:68
> >>> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does
> not
> >>> apply
> >>> error: patch failed:
> >>>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> >>> error:
> >>>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> >>> error:
> >>>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> >>> error:
> >>>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> >>> error:
> >>>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> >>> error:
> >>>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> >>> patch does not apply
> >>> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> >>> error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
> >>> error: patch failed:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> >>> error:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> >>> patch does not apply
> >>> error:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> >>> already exists in index
> >>> error: patch failed:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> >>> error:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> >>> patch does not apply
> >>> error:
> >>>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> >>> already exists in index
> >>> error: patch failed:
> >>> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> >>> error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> >>> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
> >>> does not apply
> >>> error: patch failed:
> >>> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> >>> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
> >>> does not apply
> >>> error: patch failed:
> server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> >>> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does
> not
> >>> apply
> >>> error: patch failed:
> >>> server/src/com/cloud/configuration/ConfigurationManager.java:97
> >>> error: server/src/com/cloud/configuration/ConfigurationManager.java:
> patch
> >>> does not apply
> >>> error: patch failed:
> >>> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> >>> error:
> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> >>> patch does not apply
> >>> error: patch failed:
> >>> server/src/com/cloud/server/ConfigurationServerImpl.java:925
> >>> error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch
> does
> >>> not apply
> >>> error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
> >>> error: server/src/com/cloud/storage/VolumeManager.java: patch does not
> apply
> >>> error: patch failed:
> server/src/com/cloud/storage/VolumeManagerImpl.java:58
> >>> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does
> not
> >>> apply
> >>> error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
> >>> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not
> apply
> >>> error: patch failed:
> >>> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> >>> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:
> patch
> >>> does not apply
> >>> error: patch failed: setup/db/db/schema-410to420.sql:263
> >>> error: setup/db/db/schema-410to420.sql: patch does not apply
> >>> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> >>> error: tools/marvin/marvin/cloudstackConnection.py: patch does not
> apply
> >>> error: patch failed: ui/dictionary.jsp:25
> >>> error: ui/dictionary.jsp: patch does not apply
> >>> error: patch failed: ui/scripts/configuration.js:906
> >>> error: ui/scripts/configuration.js: patch does not apply
> >>> error: patch failed: ui/scripts/docs.js:270
> >>> error: ui/scripts/docs.js: patch does not apply
> >>> error: patch failed: ui/scripts/storage.js:132
> >>> error: ui/scripts/storage.js: patch does not apply
> >>> Patch failed at 0001 SolidFire plug-in and enhancements to the storage
> >>> plug-in framework
> >>> When you have resolved this problem run "git am --resolved".
> >>> If you would prefer to skip this patch, instead run "git am --skip".
> >>> To restore the original branch and stop patching run "git am --abort".
> >>>
> >>>
> >>> --
> >>> *Mike Tutkowski*
> >>> *Senior CloudStack Developer, SolidFire Inc.*
> >>> e: mike.tutkowski@solidfire.com
> >>> o: 303.746.7302
> >>> Advancing the way the world uses the
> >>> cloud<http://solidfire.com/solution/overview/?video=play>
> >>> *?*
> >
> >
> > ------------------------
> > Powered by BigRock.com
> >
>



-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Re: Git question about applying patch files

Posted by John Burwell <jb...@basho.com>.
Prasanna,

+1 to using rebase on feature branches.

At least as I understand things and have experienced rebase, it
preserves  all commits on the feature branch.  For Review Board and
master merges, those commits need to be collapsed, or in git parlance,
squashed.  The script I referenced below squashes the commits and
works regardless of whether you have been using rebase or merge on
your feature branch.

Thanks,
-John

On Jun 13, 2013, at 2:01 AM, Prasanna Santhanam <ts...@apache.org> wrote:

> The 'cleanest cleanest' way is to use rebase as Sheng recommends but I
> know people who've used git successfully with just doing merge. It's
> (rebase) one of those features of git you discover only after
> using-abusing it for long enough. But if you're adventurous ..  :)
>
> Do NOT do a rebase if you've done merges until now on your branch.
>
> Here's a nice post explaining how to work with rebase for those
> hesitant to use it:
> http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/
>
> --
> Prasanna.,
>
> On Thu, Jun 13, 2013 at 01:50:15AM -0400, John Burwell wrote:
>> Mike,
>>
>> The cleanest way have found to create these patches is  actually
>> create a temporary work branch from master, merge the feature branch
>> into it with the squashed option, and then generate the patch.  This
>> gist (https://gist.github.com/jburwell/5771480) is the shell script
>> I used to generate the S3-backed Secondary Storage patch submissions
>> to Review Board.  It should be fairly easy to adapt by adjusting the
>> FEATURE_BRANCH and WORK_HOME values.
>>
>> Thanks,
>> -John
>>
>> On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <mi...@solidfire.com> wrote:
>>
>>> I have a branch, solidfire_plugin, off of master in my local repo.
>>>
>>> I wanted to submit a patch to Review Board.
>>>
>>> Essentially, I followed these steps (where upstream is the official CS
>>> repo):
>>>
>>> git checkout master
>>>
>>> git fetch upstream
>>>
>>> git reset --hard upstream/master
>>>
>>> git checkout solidfire_plugin
>>>
>>> git merge master
>>>
>>> git format-patch master --stdout > solidfire_plugin.patch (this collected
>>> six commits worth of work)
>>>
>>> git checkout master
>>>
>>> git am solidfire_plugin.patch
>>> This final command lead to this error message (below). I was surprised
>>> because I had just performed a merge from master to solidfire_plugin before
>>> generating the patch file (so I was thinking the patch file should cleanly
>>> apply on master).
>>>
>>> Any thoughts on this?
>>>
>>> Thanks!
>>>
>>> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
>>> Applying: SolidFire plug-in and enhancements to the storage plug-in
>>> framework
>>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
>>> trailing whitespace.
>>>
>>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
>>> trailing whitespace.
>>>
>>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
>>> trailing whitespace.
>>>
>>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
>>> trailing whitespace.
>>>
>>> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
>>> trailing whitespace.
>>>
>>> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
>>> error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
>>> error: patch failed: api/src/com/cloud/storage/Volume.java:120
>>> error: api/src/com/cloud/storage/Volume.java: patch does not apply
>>> error: patch failed: api/src/org/apache/cloudstack/api/ApiConstants.java:49
>>> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does not
>>> apply
>>> error: patch failed:
>>> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
>>> error:
>>> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
>>> patch does not apply
>>> error: patch failed:
>>> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
>>> error:
>>> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
>>> patch does not apply
>>> error: patch failed:
>>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
>>> error:
>>> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java: patch
>>> does not apply
>>> error: patch failed:
>>> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
>>> error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
>>> patch does not apply
>>> error: patch failed: client/WEB-INF/classes/resources/messages.properties:14
>>> error: client/WEB-INF/classes/resources/messages.properties: patch does not
>>> apply
>>> error: patch failed: client/pom.xml:22
>>> error: client/pom.xml: patch does not apply
>>> error: patch failed: client/tomcatconf/applicationContext.xml.in:798
>>> error: client/tomcatconf/applicationContext.xml.in: patch does not apply
>>> error: patch failed:
>>> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
>>> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
>>> not apply
>>> error: patch failed:
>>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
>>> error:
>>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
>>> patch does not apply
>>> error: patch failed:
>>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
>>> error:
>>> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
>>> patch does not apply
>>> error: patch failed:
>>> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
>>> error:
>>> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
>>> patch does not apply
>>> error: patch failed:
>>> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
>>> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch does
>>> not apply
>>> error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
>>> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
>>> apply
>>> error: patch failed:
>>> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
>>> error:
>>> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
>>> patch does not apply
>>> error: patch failed:
>>> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
>>> error:
>>> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
>>> patch does not apply
>>> error: patch failed:
>>> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
>>> error:
>>> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
>>> patch does not apply
>>> error: patch failed:
>>> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
>>> error:
>>> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
>>> patch does not apply
>>> error: patch failed:
>>> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
>>> error:
>>> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
>>> patch does not apply
>>> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
>>> error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
>>> error: patch failed:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
>>> error:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
>>> patch does not apply
>>> error:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
>>> already exists in index
>>> error: patch failed:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
>>> error:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
>>> patch does not apply
>>> error:
>>> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
>>> already exists in index
>>> error: patch failed:
>>> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
>>> error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
>>> patch does not apply
>>> error: patch failed:
>>> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
>>> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
>>> does not apply
>>> error: patch failed:
>>> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
>>> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
>>> does not apply
>>> error: patch failed: server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
>>> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does not
>>> apply
>>> error: patch failed:
>>> server/src/com/cloud/configuration/ConfigurationManager.java:97
>>> error: server/src/com/cloud/configuration/ConfigurationManager.java: patch
>>> does not apply
>>> error: patch failed:
>>> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
>>> error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
>>> patch does not apply
>>> error: patch failed:
>>> server/src/com/cloud/server/ConfigurationServerImpl.java:925
>>> error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch does
>>> not apply
>>> error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
>>> error: server/src/com/cloud/storage/VolumeManager.java: patch does not apply
>>> error: patch failed: server/src/com/cloud/storage/VolumeManagerImpl.java:58
>>> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does not
>>> apply
>>> error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
>>> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not apply
>>> error: patch failed:
>>> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
>>> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
>>> does not apply
>>> error: patch failed: setup/db/db/schema-410to420.sql:263
>>> error: setup/db/db/schema-410to420.sql: patch does not apply
>>> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
>>> error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
>>> error: patch failed: ui/dictionary.jsp:25
>>> error: ui/dictionary.jsp: patch does not apply
>>> error: patch failed: ui/scripts/configuration.js:906
>>> error: ui/scripts/configuration.js: patch does not apply
>>> error: patch failed: ui/scripts/docs.js:270
>>> error: ui/scripts/docs.js: patch does not apply
>>> error: patch failed: ui/scripts/storage.js:132
>>> error: ui/scripts/storage.js: patch does not apply
>>> Patch failed at 0001 SolidFire plug-in and enhancements to the storage
>>> plug-in framework
>>> When you have resolved this problem run "git am --resolved".
>>> If you would prefer to skip this patch, instead run "git am --skip".
>>> To restore the original branch and stop patching run "git am --abort".
>>>
>>>
>>> --
>>> *Mike Tutkowski*
>>> *Senior CloudStack Developer, SolidFire Inc.*
>>> e: mike.tutkowski@solidfire.com
>>> o: 303.746.7302
>>> Advancing the way the world uses the
>>> cloud<http://solidfire.com/solution/overview/?video=play>
>>> *?*
>
>
> ------------------------
> Powered by BigRock.com
>

Re: Git question about applying patch files

Posted by Prasanna Santhanam <ts...@apache.org>.
The 'cleanest cleanest' way is to use rebase as Sheng recommends but I
know people who've used git successfully with just doing merge. It's
(rebase) one of those features of git you discover only after
using-abusing it for long enough. But if you're adventurous ..  :)

Do NOT do a rebase if you've done merges until now on your branch.

Here's a nice post explaining how to work with rebase for those
hesitant to use it:
http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/

-- 
Prasanna.,

On Thu, Jun 13, 2013 at 01:50:15AM -0400, John Burwell wrote:
> Mike,
> 
> The cleanest way have found to create these patches is  actually
> create a temporary work branch from master, merge the feature branch
> into it with the squashed option, and then generate the patch.  This
> gist (https://gist.github.com/jburwell/5771480) is the shell script
> I used to generate the S3-backed Secondary Storage patch submissions
> to Review Board.  It should be fairly easy to adapt by adjusting the
> FEATURE_BRANCH and WORK_HOME values.
> 
> Thanks,
> -John
> 
> On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <mi...@solidfire.com> wrote:
> 
> > I have a branch, solidfire_plugin, off of master in my local repo.
> > 
> > I wanted to submit a patch to Review Board.
> > 
> > Essentially, I followed these steps (where upstream is the official CS
> > repo):
> > 
> > git checkout master
> > 
> > git fetch upstream
> > 
> > git reset --hard upstream/master
> > 
> > git checkout solidfire_plugin
> > 
> > git merge master
> > 
> > git format-patch master --stdout > solidfire_plugin.patch (this collected
> > six commits worth of work)
> > 
> > git checkout master
> > 
> > git am solidfire_plugin.patch
> > This final command lead to this error message (below). I was surprised
> > because I had just performed a merge from master to solidfire_plugin before
> > generating the patch file (so I was thinking the patch file should cleanly
> > apply on master).
> > 
> > Any thoughts on this?
> > 
> > Thanks!
> > 
> > mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> > Applying: SolidFire plug-in and enhancements to the storage plug-in
> > framework
> > /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> > trailing whitespace.
> > 
> > /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> > trailing whitespace.
> > 
> > /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> > trailing whitespace.
> > 
> > /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> > trailing whitespace.
> > 
> > /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> > trailing whitespace.
> > 
> > error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> > error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
> > error: patch failed: api/src/com/cloud/storage/Volume.java:120
> > error: api/src/com/cloud/storage/Volume.java: patch does not apply
> > error: patch failed: api/src/org/apache/cloudstack/api/ApiConstants.java:49
> > error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does not
> > apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> > error:
> > api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> > patch does not apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> > error:
> > api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> > patch does not apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> > error:
> > api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java: patch
> > does not apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> > error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> > patch does not apply
> > error: patch failed: client/WEB-INF/classes/resources/messages.properties:14
> > error: client/WEB-INF/classes/resources/messages.properties: patch does not
> > apply
> > error: patch failed: client/pom.xml:22
> > error: client/pom.xml: patch does not apply
> > error: patch failed: client/tomcatconf/applicationContext.xml.in:798
> > error: client/tomcatconf/applicationContext.xml.in: patch does not apply
> > error: patch failed:
> > core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> > error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
> > not apply
> > error: patch failed:
> > core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> > error:
> > core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> > patch does not apply
> > error: patch failed:
> > core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> > error:
> > core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> > patch does not apply
> > error: patch failed:
> > engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> > error:
> > engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> > patch does not apply
> > error: patch failed:
> > engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> > error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch does
> > not apply
> > error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
> > error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
> > apply
> > error: patch failed:
> > engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> > error:
> > engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> > patch does not apply
> > error: patch failed:
> > engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> > error:
> > engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> > patch does not apply
> > error: patch failed:
> > engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> > error:
> > engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> > patch does not apply
> > error: patch failed:
> > engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> > error:
> > engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> > patch does not apply
> > error: patch failed:
> > plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> > error:
> > plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> > patch does not apply
> > error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> > error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
> > error: patch failed:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> > error:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> > patch does not apply
> > error:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> > already exists in index
> > error: patch failed:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> > error:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> > patch does not apply
> > error:
> > plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> > already exists in index
> > error: patch failed:
> > server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> > error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> > patch does not apply
> > error: patch failed:
> > server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> > error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
> > does not apply
> > error: patch failed:
> > server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> > error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
> > does not apply
> > error: patch failed: server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> > error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does not
> > apply
> > error: patch failed:
> > server/src/com/cloud/configuration/ConfigurationManager.java:97
> > error: server/src/com/cloud/configuration/ConfigurationManager.java: patch
> > does not apply
> > error: patch failed:
> > server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> > error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> > patch does not apply
> > error: patch failed:
> > server/src/com/cloud/server/ConfigurationServerImpl.java:925
> > error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch does
> > not apply
> > error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
> > error: server/src/com/cloud/storage/VolumeManager.java: patch does not apply
> > error: patch failed: server/src/com/cloud/storage/VolumeManagerImpl.java:58
> > error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does not
> > apply
> > error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
> > error: server/src/com/cloud/test/DatabaseConfig.java: patch does not apply
> > error: patch failed:
> > server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> > error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
> > does not apply
> > error: patch failed: setup/db/db/schema-410to420.sql:263
> > error: setup/db/db/schema-410to420.sql: patch does not apply
> > error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> > error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
> > error: patch failed: ui/dictionary.jsp:25
> > error: ui/dictionary.jsp: patch does not apply
> > error: patch failed: ui/scripts/configuration.js:906
> > error: ui/scripts/configuration.js: patch does not apply
> > error: patch failed: ui/scripts/docs.js:270
> > error: ui/scripts/docs.js: patch does not apply
> > error: patch failed: ui/scripts/storage.js:132
> > error: ui/scripts/storage.js: patch does not apply
> > Patch failed at 0001 SolidFire plug-in and enhancements to the storage
> > plug-in framework
> > When you have resolved this problem run "git am --resolved".
> > If you would prefer to skip this patch, instead run "git am --skip".
> > To restore the original branch and stop patching run "git am --abort".
> > 
> > 
> > -- 
> > *Mike Tutkowski*
> > *Senior CloudStack Developer, SolidFire Inc.*
> > e: mike.tutkowski@solidfire.com
> > o: 303.746.7302
> > Advancing the way the world uses the
> > cloud<http://solidfire.com/solution/overview/?video=play>
> > *?*
> 


------------------------
Powered by BigRock.com


Re: Git question about applying patch files

Posted by John Burwell <jb...@basho.com>.
Mike,

The cleanest way have found to create these patches is  actually create a temporary work branch from master, merge the feature branch into it with the squashed option, and then generate the patch.  This gist (https://gist.github.com/jburwell/5771480) is the shell script I used to generate the S3-backed Secondary Storage patch submissions to Review Board.  It should be fairly easy to adapt by adjusting the FEATURE_BRANCH and WORK_HOME values.

Thanks,
-John

On Jun 12, 2013, at 6:25 PM, Mike Tutkowski <mi...@solidfire.com> wrote:

> I have a branch, solidfire_plugin, off of master in my local repo.
> 
> I wanted to submit a patch to Review Board.
> 
> Essentially, I followed these steps (where upstream is the official CS
> repo):
> 
> git checkout master
> 
> git fetch upstream
> 
> git reset --hard upstream/master
> 
> git checkout solidfire_plugin
> 
> git merge master
> 
> git format-patch master --stdout > solidfire_plugin.patch (this collected
> six commits worth of work)
> 
> git checkout master
> 
> git am solidfire_plugin.patch
> This final command lead to this error message (below). I was surprised
> because I had just performed a merge from master to solidfire_plugin before
> generating the patch file (so I was thinking the patch file should cleanly
> apply on master).
> 
> Any thoughts on this?
> 
> Thanks!
> 
> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> Applying: SolidFire plug-in and enhancements to the storage plug-in
> framework
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> trailing whitespace.
> 
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> trailing whitespace.
> 
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> trailing whitespace.
> 
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> trailing whitespace.
> 
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> trailing whitespace.
> 
> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
> error: patch failed: api/src/com/cloud/storage/Volume.java:120
> error: api/src/com/cloud/storage/Volume.java: patch does not apply
> error: patch failed: api/src/org/apache/cloudstack/api/ApiConstants.java:49
> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does not
> apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> error:
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> patch does not apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> error:
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> patch does not apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> error:
> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java: patch
> does not apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> patch does not apply
> error: patch failed: client/WEB-INF/classes/resources/messages.properties:14
> error: client/WEB-INF/classes/resources/messages.properties: patch does not
> apply
> error: patch failed: client/pom.xml:22
> error: client/pom.xml: patch does not apply
> error: patch failed: client/tomcatconf/applicationContext.xml.in:798
> error: client/tomcatconf/applicationContext.xml.in: patch does not apply
> error: patch failed:
> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
> not apply
> error: patch failed:
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> error:
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> patch does not apply
> error: patch failed:
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> error:
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> patch does not apply
> error: patch failed:
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> error:
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> patch does not apply
> error: patch failed:
> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch does
> not apply
> error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
> apply
> error: patch failed:
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> error:
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> patch does not apply
> error: patch failed:
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> error:
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> patch does not apply
> error: patch failed:
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> error:
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> patch does not apply
> error: patch failed:
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> error:
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> patch does not apply
> error: patch failed:
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> error:
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> patch does not apply
> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
> error: patch failed:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> error:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> patch does not apply
> error:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> already exists in index
> error: patch failed:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> error:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> patch does not apply
> error:
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> already exists in index
> error: patch failed:
> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> patch does not apply
> error: patch failed:
> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
> does not apply
> error: patch failed:
> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
> does not apply
> error: patch failed: server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does not
> apply
> error: patch failed:
> server/src/com/cloud/configuration/ConfigurationManager.java:97
> error: server/src/com/cloud/configuration/ConfigurationManager.java: patch
> does not apply
> error: patch failed:
> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> patch does not apply
> error: patch failed:
> server/src/com/cloud/server/ConfigurationServerImpl.java:925
> error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch does
> not apply
> error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
> error: server/src/com/cloud/storage/VolumeManager.java: patch does not apply
> error: patch failed: server/src/com/cloud/storage/VolumeManagerImpl.java:58
> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does not
> apply
> error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not apply
> error: patch failed:
> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
> does not apply
> error: patch failed: setup/db/db/schema-410to420.sql:263
> error: setup/db/db/schema-410to420.sql: patch does not apply
> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
> error: patch failed: ui/dictionary.jsp:25
> error: ui/dictionary.jsp: patch does not apply
> error: patch failed: ui/scripts/configuration.js:906
> error: ui/scripts/configuration.js: patch does not apply
> error: patch failed: ui/scripts/docs.js:270
> error: ui/scripts/docs.js: patch does not apply
> error: patch failed: ui/scripts/storage.js:132
> error: ui/scripts/storage.js: patch does not apply
> Patch failed at 0001 SolidFire plug-in and enhancements to the storage
> plug-in framework
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> 
> 
> -- 
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkowski@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*


Re: Git question about applying patch files

Posted by Wei ZHOU <us...@gmail.com>.
I use "git diff master" and "patch -p1 <*.patch" to generate and apply the
patches.


2013/6/13 Sheng Yang <sh...@yasker.org>

> You should use git-rebase rather than git-merge if the patches are in
> relatively small numbers. I doubt git-format-patch would get the correct
> result if your patches are not the top commits.
>
> So you maybe want:
>
> git checkout master
> git pull
> git checkout solidfire_plugin
> git rebase master
> git format-patch master (it would generate one patch for each commit)
> git checkout master
>
> You can use git am 0*(it would apply the patch in original sequence, and
> assume you don't have any other 0* files in the directory)
>
> Or you just get records of your commits' SHA1, then use "git-cherry-pick"
> for master one by one(then skip the format-patch step above).
>
> I think for now, you'd better revert the "git-merge" commit then do
> git-rebase instead.
>
> --Sheng
>
>
> On Wed, Jun 12, 2013 at 3:25 PM, Mike Tutkowski <
> mike.tutkowski@solidfire.com> wrote:
>
> > I have a branch, solidfire_plugin, off of master in my local repo.
> >
> > I wanted to submit a patch to Review Board.
> >
> > Essentially, I followed these steps (where upstream is the official CS
> > repo):
> >
> > git checkout master
> >
> > git fetch upstream
> >
> > git reset --hard upstream/master
> >
> > git checkout solidfire_plugin
> >
> > git merge master
> >
> > git format-patch master --stdout > solidfire_plugin.patch (this collected
> > six commits worth of work)
> >
> > git checkout master
> >
> > git am solidfire_plugin.patch
> > This final command lead to this error message (below). I was surprised
> > because I had just performed a merge from master to solidfire_plugin
> before
> > generating the patch file (so I was thinking the patch file should
> cleanly
> > apply on master).
> >
> > Any thoughts on this?
> >
> > Thanks!
> >
> > mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> > Applying: SolidFire plug-in and enhancements to the storage plug-in
> > framework
> >
> >
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> > trailing whitespace.
> >
> >
> >
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> > trailing whitespace.
> >
> >
> >
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> > trailing whitespace.
> >
> >
> >
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> > trailing whitespace.
> >
> >
> >
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> > trailing whitespace.
> >
> > error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> > error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
> > error: patch failed: api/src/com/cloud/storage/Volume.java:120
> > error: api/src/com/cloud/storage/Volume.java: patch does not apply
> > error: patch failed:
> api/src/org/apache/cloudstack/api/ApiConstants.java:49
> > error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does
> not
> > apply
> > error: patch failed:
> >
> >
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> > error:
> >
> >
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> > error:
> >
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> > patch does not apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> > error:
> > api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:
> patch
> > does not apply
> > error: patch failed:
> > api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> > error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> > patch does not apply
> > error: patch failed:
> > client/WEB-INF/classes/resources/messages.properties:14
> > error: client/WEB-INF/classes/resources/messages.properties: patch does
> not
> > apply
> > error: patch failed: client/pom.xml:22
> > error: client/pom.xml: patch does not apply
> > error: patch failed: client/tomcatconf/applicationContext.xml.in:798
> > error: client/tomcatconf/applicationContext.xml.in: patch does not apply
> > error: patch failed:
> > core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> > error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
> > not apply
> > error: patch failed:
> >
> >
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> > error:
> >
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> > error:
> >
> >
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> > error:
> >
> >
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> > patch does not apply
> > error: patch failed:
> > engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> > error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch
> does
> > not apply
> > error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
> > error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
> > apply
> > error: patch failed:
> >
> >
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> > error:
> >
> >
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> > error:
> >
> >
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> > error:
> >
> >
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> > error:
> >
> >
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> > patch does not apply
> > error: patch failed:
> >
> >
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> > error:
> >
> >
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> > patch does not apply
> > error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> > error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
> > error: patch failed:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> > error:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> > patch does not apply
> > error:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> > already exists in index
> > error: patch failed:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> > error:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> > patch does not apply
> > error:
> >
> >
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> > already exists in index
> > error: patch failed:
> > server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> > error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> > patch does not apply
> > error: patch failed:
> > server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> > error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
> > does not apply
> > error: patch failed:
> > server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> > error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
> > does not apply
> > error: patch failed:
> server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> > error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does
> not
> > apply
> > error: patch failed:
> > server/src/com/cloud/configuration/ConfigurationManager.java:97
> > error: server/src/com/cloud/configuration/ConfigurationManager.java:
> patch
> > does not apply
> > error: patch failed:
> > server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> > error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> > patch does not apply
> > error: patch failed:
> > server/src/com/cloud/server/ConfigurationServerImpl.java:925
> > error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch
> does
> > not apply
> > error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
> > error: server/src/com/cloud/storage/VolumeManager.java: patch does not
> > apply
> > error: patch failed:
> server/src/com/cloud/storage/VolumeManagerImpl.java:58
> > error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does
> not
> > apply
> > error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
> > error: server/src/com/cloud/test/DatabaseConfig.java: patch does not
> apply
> > error: patch failed:
> > server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> > error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
> > does not apply
> > error: patch failed: setup/db/db/schema-410to420.sql:263
> > error: setup/db/db/schema-410to420.sql: patch does not apply
> > error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> > error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
> > error: patch failed: ui/dictionary.jsp:25
> > error: ui/dictionary.jsp: patch does not apply
> > error: patch failed: ui/scripts/configuration.js:906
> > error: ui/scripts/configuration.js: patch does not apply
> > error: patch failed: ui/scripts/docs.js:270
> > error: ui/scripts/docs.js: patch does not apply
> > error: patch failed: ui/scripts/storage.js:132
> > error: ui/scripts/storage.js: patch does not apply
> > Patch failed at 0001 SolidFire plug-in and enhancements to the storage
> > plug-in framework
> > When you have resolved this problem run "git am --resolved".
> > If you would prefer to skip this patch, instead run "git am --skip".
> > To restore the original branch and stop patching run "git am --abort".
> >
> >
> > --
> > *Mike Tutkowski*
> > *Senior CloudStack Developer, SolidFire Inc.*
> > e: mike.tutkowski@solidfire.com
> > o: 303.746.7302
> > Advancing the way the world uses the
> > cloud<http://solidfire.com/solution/overview/?video=play>
> > *™*
> >
>

Re: Git question about applying patch files

Posted by Sheng Yang <sh...@yasker.org>.
You should use git-rebase rather than git-merge if the patches are in
relatively small numbers. I doubt git-format-patch would get the correct
result if your patches are not the top commits.

So you maybe want:

git checkout master
git pull
git checkout solidfire_plugin
git rebase master
git format-patch master (it would generate one patch for each commit)
git checkout master

You can use git am 0*(it would apply the patch in original sequence, and
assume you don't have any other 0* files in the directory)

Or you just get records of your commits' SHA1, then use "git-cherry-pick"
for master one by one(then skip the format-patch step above).

I think for now, you'd better revert the "git-merge" commit then do
git-rebase instead.

--Sheng


On Wed, Jun 12, 2013 at 3:25 PM, Mike Tutkowski <
mike.tutkowski@solidfire.com> wrote:

> I have a branch, solidfire_plugin, off of master in my local repo.
>
> I wanted to submit a patch to Review Board.
>
> Essentially, I followed these steps (where upstream is the official CS
> repo):
>
> git checkout master
>
> git fetch upstream
>
> git reset --hard upstream/master
>
> git checkout solidfire_plugin
>
> git merge master
>
> git format-patch master --stdout > solidfire_plugin.patch (this collected
> six commits worth of work)
>
> git checkout master
>
> git am solidfire_plugin.patch
> This final command lead to this error message (below). I was surprised
> because I had just performed a merge from master to solidfire_plugin before
> generating the patch file (so I was thinking the patch file should cleanly
> apply on master).
>
> Any thoughts on this?
>
> Thanks!
>
> mtutkowski-lt:cloudstack mtutkowski$ git am solidfire_plugin_a.patch
> Applying: SolidFire plug-in and enhancements to the storage plug-in
> framework
>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:60:
> trailing whitespace.
>
>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:62:
> trailing whitespace.
>
>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:64:
> trailing whitespace.
>
>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:66:
> trailing whitespace.
>
>
> /Users/mtutkowski/documents/cloudstack/src/cloudstack/.git/rebase-apply/patch:68:
> trailing whitespace.
>
> error: patch failed: api/src/com/cloud/offering/DiskOffering.java:46
> error: api/src/com/cloud/offering/DiskOffering.java: patch does not apply
> error: patch failed: api/src/com/cloud/storage/Volume.java:120
> error: api/src/com/cloud/storage/Volume.java: patch does not apply
> error: patch failed: api/src/org/apache/cloudstack/api/ApiConstants.java:49
> error: api/src/org/apache/cloudstack/api/ApiConstants.java: patch does not
> apply
> error: patch failed:
>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:52
> error:
>
> api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java:
> patch does not apply
> error: patch failed:
>
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:67
> error:
> api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java:
> patch does not apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java:51
> error:
> api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java: patch
> does not apply
> error: patch failed:
> api/src/org/apache/cloudstack/api/response/VolumeResponse.java:79
> error: api/src/org/apache/cloudstack/api/response/VolumeResponse.java:
> patch does not apply
> error: patch failed:
> client/WEB-INF/classes/resources/messages.properties:14
> error: client/WEB-INF/classes/resources/messages.properties: patch does not
> apply
> error: patch failed: client/pom.xml:22
> error: client/pom.xml: patch does not apply
> error: patch failed: client/tomcatconf/applicationContext.xml.in:798
> error: client/tomcatconf/applicationContext.xml.in: patch does not apply
> error: patch failed:
> core/src/com/cloud/agent/api/AttachVolumeCommand.java:23
> error: core/src/com/cloud/agent/api/AttachVolumeCommand.java: patch does
> not apply
> error: patch failed:
>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:28
> error:
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeAnswerTest.java:
> patch does not apply
> error: patch failed:
>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:27
> error:
>
> core/test/org/apache/cloudstack/api/agent/test/AttachVolumeCommandTest.java:
> patch does not apply
> error: patch failed:
>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:36
> error:
>
> engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreParameters.java:
> patch does not apply
> error: patch failed:
> engine/schema/src/com/cloud/storage/DiskOfferingVO.java:34
> error: engine/schema/src/com/cloud/storage/DiskOfferingVO.java: patch does
> not apply
> error: patch failed: engine/schema/src/com/cloud/storage/VolumeVO.java:68
> error: engine/schema/src/com/cloud/storage/VolumeVO.java: patch does not
> apply
> error: patch failed:
>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:149
> error:
>
> engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java:
> patch does not apply
> error: patch failed:
>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:57
> error:
>
> engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java:
> patch does not apply
> error: patch failed:
>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:84
> error:
>
> engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java:
> patch does not apply
> error: patch failed:
>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:92
> error:
>
> engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java:
> patch does not apply
> error: patch failed:
>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:5362
> error:
>
> plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java:
> patch does not apply
> error: patch failed: plugins/storage/volume/solidfire/pom.xml:12
> error: plugins/storage/volume/solidfire/pom.xml: patch does not apply
> error: patch failed:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:18
> error:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java:
> patch does not apply
> error:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFirePrimaryDataStoreLifeCycle.java:
> already exists in index
> error: patch failed:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:1
> error:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java:
> patch does not apply
> error:
>
> plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
> already exists in index
> error: patch failed:
> server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:67
> error: server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java:
> patch does not apply
> error: patch failed:
> server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java:101
> error: server/src/com/cloud/api/query/dao/VolumeJoinDaoImpl.java: patch
> does not apply
> error: patch failed:
> server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java:60
> error: server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java: patch
> does not apply
> error: patch failed: server/src/com/cloud/api/query/vo/VolumeJoinVO.java:57
> error: server/src/com/cloud/api/query/vo/VolumeJoinVO.java: patch does not
> apply
> error: patch failed:
> server/src/com/cloud/configuration/ConfigurationManager.java:97
> error: server/src/com/cloud/configuration/ConfigurationManager.java: patch
> does not apply
> error: patch failed:
> server/src/com/cloud/configuration/ConfigurationManagerImpl.java:2160
> error: server/src/com/cloud/configuration/ConfigurationManagerImpl.java:
> patch does not apply
> error: patch failed:
> server/src/com/cloud/server/ConfigurationServerImpl.java:925
> error: server/src/com/cloud/server/ConfigurationServerImpl.java: patch does
> not apply
> error: patch failed: server/src/com/cloud/storage/VolumeManager.java:45
> error: server/src/com/cloud/storage/VolumeManager.java: patch does not
> apply
> error: patch failed: server/src/com/cloud/storage/VolumeManagerImpl.java:58
> error: server/src/com/cloud/storage/VolumeManagerImpl.java: patch does not
> apply
> error: patch failed: server/src/com/cloud/test/DatabaseConfig.java:965
> error: server/src/com/cloud/test/DatabaseConfig.java: patch does not apply
> error: patch failed:
> server/test/com/cloud/vpc/MockConfigurationManagerImpl.java:654
> error: server/test/com/cloud/vpc/MockConfigurationManagerImpl.java: patch
> does not apply
> error: patch failed: setup/db/db/schema-410to420.sql:263
> error: setup/db/db/schema-410to420.sql: patch does not apply
> error: patch failed: tools/marvin/marvin/cloudstackConnection.py:204
> error: tools/marvin/marvin/cloudstackConnection.py: patch does not apply
> error: patch failed: ui/dictionary.jsp:25
> error: ui/dictionary.jsp: patch does not apply
> error: patch failed: ui/scripts/configuration.js:906
> error: ui/scripts/configuration.js: patch does not apply
> error: patch failed: ui/scripts/docs.js:270
> error: ui/scripts/docs.js: patch does not apply
> error: patch failed: ui/scripts/storage.js:132
> error: ui/scripts/storage.js: patch does not apply
> Patch failed at 0001 SolidFire plug-in and enhancements to the storage
> plug-in framework
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
>
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkowski@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>