Aller au contenu. | Aller à la navigation

Outils personnels

Navigation

Vous êtes ici : Accueil / Articles / Full example of committing and merging a fix

Full example of committing and merging a fix

Par Vincent Fretin publié 14/11/2009 11:57, Dernière modification 14/11/2009 11:57
I show you a full example of committing a fix in a branch and then merging it to trunk. I'm sure it will be useful to someone.

I saw there were some questions on #plone-up yesterday about merging. I show you a full example of committing a fix to plone.app.content branch 1.x and merging it to trunk.

Always add an entry in the changelog in the unreleased section (create it if it doesn't exist), add your item to the top:

vincentfretin@lelouch:~/svn/plonenext/3.3/src/plone.app.content$ svn diff
Index: docs/HISTORY.txt
===================================================================
--- docs/HISTORY.txt        (révision 31324)
+++ docs/HISTORY.txt        (copie de travail)
@@ -4,6 +4,10 @@
 1.6 - unreleased
 ----------------

+- Fixed not translatable message in table.pt: "Select ${title}"
+  appears when the mouse is over a checkbox in folder_contents.
+  [vincentfretin]
+
 - Fixed folder_add_settings_long default message, it used "context"
   instead of "here".
   [vincentfretin]
Index: plone/app/content/browser/tableview.py
===================================================================
--- plone/app/content/browser/tableview.py  (révision 31324)
+++ plone/app/content/browser/tableview.py  (copie de travail)
@@ -1,6 +1,8 @@
 from zope.app.pagetemplate import ViewPageTemplateFile
 from plone.app.content.batching import Batch
 from plone.memoize import instance
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('plone')

 try:
     from kss.core import KSSView
@@ -38,6 +40,11 @@

         self.pagenumber =  int(request.get('pagenumber', 1))

+    def msg_select_item(self, item):
+        return _(u'checkbox_select_item',
+                 default=u"Select ${title}",
+                 mapping={'title': item['title_or_id']})
+
     @property
     def within_batch_size(self):
         return len(self.items) < self.pagesize
Index: plone/app/content/browser/table.pt
===================================================================
--- plone/app/content/browser/table.pt      (révision 31324)
+++ plone/app/content/browser/table.pt      (copie de travail)
@@ -100,8 +100,8 @@
                        tal:attributes="value   item/path;
                                        id      string:cb_${item/id};
                                        checked item/checked;
-                                       alt     string:Select ${item/title_or_id};
-                                       title   string:Select ${item/title_or_id}" />
+                                       alt     python:view.msg_select_item(item);
+                                       title   python:view.msg_select_item(item)" />
                 <input type="hidden" name="selected_obj_paths:list" value="#"
                        tal:attributes="value item/relative_url" />
                 <label tal:content="item/title_or_id"

Here the commit was not attached to any plone issue. If you have one, generally you have one, precise which issue the change fixes:

- Fixed not translatable message in table.pt: "Select ${title}"
  appears when the mouse is over a checkbox in folder_contents. This closes
  http://dev.plone.org/plone/ticket/nnnn
  [vincentfretin]

Be sure to not use https here.

Your are ready to commit, I usually use the same comment as in the changelog, except I replace "This closes http://dev.plone.org/plone/ticket/nnnn" by "(closes #nnnn)" so the issue is closed automatically on the tracker:

vincentfretin@lelouch:~/svn/plonenext/3.3/src/plone.app.content$ svn ci
Envoi          docs/HISTORY.txt
Envoi          plone/app/content/browser/table.pt
Envoi          plone/app/content/browser/tableview.py
Transmission des données ...
Révision 31433 propagée.

Note the revision 31433, you will need it for merging.

Get the url of the branch, you will need it too:

vincentfretin@lelouch:~/svn/plonenext/3.3/src/plone.app.content$ svn info
URL: https://svn.plone.org/svn/plone/plone.app.content/branches/1.x

Go to your plone-coredev/branches/4.0 buildout:

vincentfretin@lelouch:~/svn/plonenext/3.3/src/plone.app.content$ cd ~/svn/plone-coredev/branches/4.0/src/plone.app.content

Verify the branch is different than plonenext 3.3:

vincentfretin@lelouch:~/svn/plone-coredev/branches/4.0/src/plone.app.content$ svn info
URL: https://svn.plone.org/svn/plone/plone.app.content/trunk

If it's the same, nothing to do. Here it's different branch, so you continue.

Merge your commit:

vincentfretin@lelouch:~/svn/plone-coredev/branches/4.0/src/plone.app.content$ svn merge -c31433 https://svn.plone.org/svn/plone/plone.app.content/branches/1.x
--- Merging r31433 into '.':
U    docs/HISTORY.txt
U    plone/app/content/browser/table.pt
U    plone/app/content/browser/tableview.py

If docs/HISTORY.txt has conflict (C instead of U here), you can resolve it manually like svn propose or revert the file, mark it as resolved:

svn revert docs/HISTORY.txt
svn resolved docs/HISTORY.txt

and merge it with a graphic tool like meld:

meld ~/svn/plonenext/3.3/src/plone.app.content/docs/HISTORY.txt docs/HISTORY.txt

Get the svn:mergeinfo message, you will use it as your commit comment:

vincentfretin@lelouch:~/svn/plone-coredev/branches/4.0/src/plone.app.content$ svn diff
Property changes on: .

Modified: svn:mergeinfo
   Merged /plone.app.content/branches/1.x:r31433
[...]

Finally commit the change:

vincentfretin@lelouch:~/svn/plone-coredev/branches/4.0/src/plone.app.content$ svn ci -m"Merged /plone.app.content/branches/1.x:r31433"

I hope it will be useful to someone.