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.tutkow...@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.tutkow...@solidfire.com > > o: 303.746.7302 > > Advancing the way the world uses the > > cloud<http://solidfire.com/solution/overview/?video=play> > > *™* > > >