Using Bugzilla and Git

Revision as of 11:29, 13 July 2015 by Jorge de la Cruz (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using Bugzilla and Git to get Code Diffs

   KB 20763        Last updated on 2015-07-13  




0.00
(0 votes)

Introduction to Git Fusion

Now that Zimbra is using Git Fusion with its Perforce repository, it is possible to map changes in Bugzilla to diffs in the Zimbra FOSS Open-Source code. More details on pulling the source code via Git is available here: Building Zimbra using Git. You will need to check out the Git repository to perform the below steps.

Identifying the Files Changed via Bugzilla

For example, let's say you wanted to look at the code changes for this IE11 bug:

Look at the timestamp and files modified, for example in this comment: https://bugzilla.zimbra.com/show_bug.cgi?id=83440#c5

Change 481303 by dchristiansen@dchristiansen-vmware on 2013/08/26 
	01:13:05
<snip>
Affected files ...
... //depot/zimbra/main/ZimbraTagLib/src/java/com/zimbra/cs/taglib/bean/ZUserAgentBean.java#25 edit
... //depot/zimbra/main/ZimbraWebClient/WebRoot/js/ajax/boot/AjxEnv.js#47 edit
... //depot/zimbra/main/ZimbraWebClient/src/com/zimbra/webClient/servlet/SkinResources.java#146 edit

Those are the files and timestamps modified in that bug/fix.

Using Git to identify diffs

Now, do "git log" on that file, and use it to locate the

$ cd ./git/main-foss/ZimbraTagLib/src/java/com/zimbra/cs/taglib/bean $ git log ZUserAgentBean.java

commit 8203afea79935ae402cba797e17634ec2af52752
Author: Dan Christiansen (c) <dchristiansen@zimbra.com>
Date:   Mon Aug 26 08:13:05 2013 +0000

    bug 83440 -- detect IE11
   
    We add IE11 as a new browser mode, isModernIE, to reflect Microsoft's
    approach that IE11 should be treated more like other browsers than
    its previous versions.
   
    No functionality changes.
   
    http://bugzilla.zimbra.com/show_bug.cgi?id=83440

Using git diff

Then run the git diff on that commit ID and file:

$ git diff 8203afea79935ae402cba797e17634ec2af52752 ZUserAgentBean.java

diff --git a/ZimbraTagLib/src/java/com/zimbra/cs/taglib/bean/ZUserAgentBean.java b/ZimbraTagLi
index eb7a6af..5ecdbeb 100644
--- a/ZimbraTagLib/src/java/com/zimbra/cs/taglib/bean/ZUserAgentBean.java
+++ b/ZimbraTagLib/src/java/com/zimbra/cs/taglib/bean/ZUserAgentBean.java
@@ -30,7 +30,6 @@ public class ZUserAgentBean {
     boolean isOsWindows = false;
     boolean isOsLinux = false;
     boolean isOsAndroid = false;
-    boolean isAndroidTablet = false;
     boolean isNav  = false;
     boolean isIE = false;
     boolean isModernIE = false;
@@ -46,6 +45,7 @@ public class ZUserAgentBean {
     boolean isIPhone = false;
     boolean isIPod = false;
     boolean isTouchiPad = false;
+    boolean isMobile = false;
 
     // Refer bug 80330 for details.
     @Deprecated
@@ -127,7 +127,7 @@ public class ZUserAgentBean {
                 } else if ((index = token.indexOf("netscape/")) != -1){
                     trueNs = true;
                     browserVersion = new Version(token.substring(index + 9));
-                } else if ((index = token.indexOf("safari/")) != -1){
+                } else if (token.indexOf("safari/") != -1){
                     isSafari = true;
                 } else if ((index = token.indexOf("chrome/")) != -1){
                     isChrome = true;
@@ -141,12 +141,11 @@ public class ZUserAgentBean {
                     isOsLinux = true;
                 }else if (token.indexOf("android") != -1){
                     isOsAndroid = true;
-                    isAndroidTablet = true;
                 }else if ((index = token.indexOf("version/")) != -1){
                     //In case of safari, get the browser version here
                     browserVersion = new Version(token.substring(index + 8));
-                }else if (token.indexOf("mobile") != -1 && isOsAndroid) {
-                    isAndroidTablet = false;
+                }else if (token.indexOf("mobile") != -1) {
+                    isMobile = true;
                 }


                 token = agtArr.hasMoreTokens() ? agtArr.nextToken() : null;
@@ -182,8 +181,6 @@ public class ZUserAgentBean {
 
     public boolean getIsOsAndroid() { return isOsAndroid; }
 
-    public boolean getIsAndroidTablet() { return isAndroidTablet; }
-   
     public boolean getIsOpera() { return isOpera; }
    
     public boolean getIsSafari() { return isSafari; }
@@ -273,6 +270,8 @@ public class ZUserAgentBean {
 
     public boolean getIsTouchiPad() { return isTouchiPad; }
 
+    public boolean getIsMobile() { return isMobile; }
+
     public static class Version {
        
         private String mRawVersion;

Cool runnings!



Verified Against: ZCS 8.0 ZCS 7.0 Date Created: 02/11/2014
Article ID: https://wiki.zimbra.com/index.php?title=Using_Bugzilla_and_Git Date Modified: 2015-07-13



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search