BIND 10 trac1644, updated. 9a25a7d76337270c5a555bd98cba95a2fb7d7295 [trac1644]Merge branch 'trac1644' of ssh://git.bind10.isc.org//var/bind10/git/bind10 into trac1644

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 15 17:51:04 UTC 2012


The branch, trac1644 has been updated
       via  9a25a7d76337270c5a555bd98cba95a2fb7d7295 (commit)
       via  61992b3bdb4d128971e459da4e6d741a48ad01d1 (commit)
       via  d05c01185756886ce13c49610a813eeb4288a04f (commit)
       via  579ba09beadc10c63ff523ccab6a21f112f364c5 (commit)
       via  373eda27fc0e591356a7311e2ad560bb9441e64f (commit)
       via  09d97fb51ee5d9d00077a52b3678f94c158a365b (commit)
       via  50a11ee4e494c9a57d43cdfb2af953d6c8565e47 (commit)
       via  1303709492895c08fac466f75069a2cafafb1de5 (commit)
       via  9c8dd4effe803bedeb2660c30f72a3ac4ecb308d (commit)
       via  aa72029e21dc74db7eb7a354ef9f921227e53a6b (commit)
       via  758d1d155f95a65702969866454ccfdfd90a7336 (commit)
       via  3422adaa26b0e1c24d6e230694975a4986cb0965 (commit)
       via  64caf0ab35936f4df289032579783a63a5f26fee (commit)
       via  803c513e70af98eb71d4fcd954ae1714b6f1c968 (commit)
       via  f59f3629b17d25cf0f8920582af2e5e1ca5283c1 (commit)
       via  2e14ad5917f64c67866f5b49a87515c5c6479ef3 (commit)
      from  572cd0d4d2866708af03a0413cac704b98e5538a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a25a7d76337270c5a555bd98cba95a2fb7d7295
Merge: 61992b3bdb4d128971e459da4e6d741a48ad01d1 572cd0d4d2866708af03a0413cac704b98e5538a
Author: Jeremy C. Reed <jreed at ISC.org>
Date:   Thu Mar 15 12:50:49 2012 -0500

    [trac1644]Merge branch 'trac1644' of ssh://git.bind10.isc.org//var/bind10/git/bind10 into trac1644
    
    fix conflicts

-----------------------------------------------------------------------

Summary of changes:
 src/lib/asiodns/sync_udp_server.cc    |    1 +
 src/lib/testutils/testdata/.gitignore |    2 +
 src/lib/util/buffer.h                 |    4 +-
 src/lib/util/tests/buffer_unittest.cc |   12 ++-
 tools/git-obsolete-branch.py          |  198 +++++++++++++++++++++++++++++++++
 5 files changed, 213 insertions(+), 4 deletions(-)
 create mode 100755 tools/git-obsolete-branch.py

-----------------------------------------------------------------------
diff --git a/src/lib/asiodns/sync_udp_server.cc b/src/lib/asiodns/sync_udp_server.cc
index 52da3bf..fb53fba 100644
--- a/src/lib/asiodns/sync_udp_server.cc
+++ b/src/lib/asiodns/sync_udp_server.cc
@@ -26,6 +26,7 @@
 
 #include <boost/bind.hpp>
 
+#include <sys/types.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <unistd.h>             // for some IPC/network system calls
diff --git a/src/lib/testutils/testdata/.gitignore b/src/lib/testutils/testdata/.gitignore
index 3c239fc..1f61066 100644
--- a/src/lib/testutils/testdata/.gitignore
+++ b/src/lib/testutils/testdata/.gitignore
@@ -10,3 +10,5 @@
 /shortanswer_fromWire.wire
 /simplequery_fromWire.wire
 /simpleresponse_fromWire.wire
+/test1.zone.copied
+/test2.zone.copied
diff --git a/src/lib/util/buffer.h b/src/lib/util/buffer.h
index a885db1..b8cc12d 100644
--- a/src/lib/util/buffer.h
+++ b/src/lib/util/buffer.h
@@ -380,9 +380,7 @@ public:
     /// \param pos The position in the buffer to be returned.
     uint8_t operator[](size_t pos) const
     {
-        if (pos >= size_) {
-            isc_throw(InvalidBufferPosition, "read at invalid position");
-        }
+        assert (pos < size_);
         return (buffer_[pos]);
     }
     //@}
diff --git a/src/lib/util/tests/buffer_unittest.cc b/src/lib/util/tests/buffer_unittest.cc
index 666924e..8cccd28 100644
--- a/src/lib/util/tests/buffer_unittest.cc
+++ b/src/lib/util/tests/buffer_unittest.cc
@@ -182,7 +182,17 @@ TEST_F(BufferTest, outputBufferReadat) {
     for (int i = 0; i < sizeof(testdata); i ++) {
         EXPECT_EQ(testdata[i], obuffer[i]);
     }
-    EXPECT_THROW(obuffer[sizeof(testdata)], isc::util::InvalidBufferPosition);
+#ifdef EXPECT_DEATH
+    // We use assert now, so we check it dies
+    EXPECT_DEATH({
+        try {
+            obuffer[sizeof(testdata)];
+        } catch (...) {
+            // Prevent exceptions killing the application, we need
+            // to make sure it dies the real hard way
+        }
+        }, "");
+#endif
 }
 
 TEST_F(BufferTest, outputBufferClear) {
diff --git a/tools/git-obsolete-branch.py b/tools/git-obsolete-branch.py
new file mode 100755
index 0000000..70a7788
--- /dev/null
+++ b/tools/git-obsolete-branch.py
@@ -0,0 +1,198 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2012  Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+#
+# This script lists obsolete (fully merged) branches. It is useful for periodic
+# maintenance of our GIT tree.
+#
+# It is good idea to use following command before running this script:
+#
+# git pull
+# git remote prune origin
+#
+# This script requires python 2.7 or 3.
+#
+# I have limited experience in Python. If things are done in a strange or
+# uncommon way, there are no obscure reasons to do it that way, just plain
+# lack of experience.
+#
+#                                                                        tomek
+
+import string
+import subprocess
+import sys
+from optparse import OptionParser
+
+class Branch:
+    MERGED = 1
+    NOTMERGED = 2
+    name = None
+    status = NOTMERGED
+    last_commit = None
+
+
+def branch_list_get(verbose):
+    """ Generates a list of available remote branches and
+        checks their status (merged/unmerged). A branch is merged
+        if all changes on that branch are also on master. """
+
+    # call git branch -r (list of remote branches)
+    txt_list = subprocess.check_output(["git", "branch", "-r"])
+
+    txt_list = txt_list.split(b"\n")
+
+    # we will store list of suitable branches here
+    out = []
+    for branch in txt_list:
+        # skip empty lines
+        if len(branch) == 0:
+            continue
+
+        # skip branches that are aliases (something -> something_else)
+        if branch.find(b"->") != -1:
+            continue
+
+        # don't complain about master
+        if branch == b"origin/master":
+            continue
+
+        branch_info = Branch()
+
+        # get branch name
+        branch_info.name = branch.strip(b" ")
+        branch_info.name = branch_info.name.decode("utf-8")
+
+        # check if branch is merged or not
+        if verbose:
+            print("Checking branch %s" % branch_info.name)
+
+        # get a diff with changes that are on that branch only
+        # i.e. all unmerged code.
+        cmd = ["git", "diff", "master..." + branch_info.name ]
+        diff = subprocess.check_output(cmd)
+        if len(diff) == 0:
+            # No diff? Then all changes from that branch are on master as well.
+            branch_info.status = Branch.MERGED
+
+            # let's get the last contributor with extra formatting
+            # see man git-log and search for PRETTY FORMATS.
+            # %ai = date, %ae = author e-mail, %an = author name
+            cmd = [ "git" , "log", "-n", "1", "--pretty=\"%ai,%ae,%an\"",
+                    branch_info.name ]
+            offender = subprocess.check_output(cmd)
+            offender = offender.strip(b"\n\"")
+
+            # comment out this 2 lines to disable obfuscation
+            offender = offender.replace(b"@", b"(at)")
+            # Obfuscating a dot does not work too well for folks that use
+            # initials
+            #offender = offender.replace(b".", b"(dot)")
+
+            branch_info.last_commit = offender.decode("utf-8")
+
+        else:
+            # diff is not empty, so there is something to merge
+            branch_info.status = Branch.NOTMERGED
+
+        out.append(branch_info)
+    return out
+
+def branch_print(branches, csv, print_merged, print_notmerged, print_stats):
+    """ prints out list of branches with specified details (using
+        human-readable (or CSV) format. It is possible to specify,
+        which branches should be printed (merged, notmerged) and
+        also print out summary statistics """
+
+    # counters used for statistics
+    merged = 0
+    notmerged = 0
+
+    # compact list of merged/notmerged branches
+    merged_str = ""
+    notmerged_str = ""
+    for branch in branches:
+        if branch.status == Branch.MERGED:
+            merged = merged + 1
+            if not print_merged:
+                continue
+            if csv:
+                print("%s,merged,%s" % (branch.name, branch.last_commit) )
+            else:
+                merged_str = merged_str + " " + branch.name
+        else:
+            # NOT MERGED
+            notmerged = notmerged + 1
+            if not print_notmerged:
+                continue
+            if csv:
+                print("%s,notmerged,%s" % (branch.name, branch.last_commit) )
+            else:
+                notmerged_str = notmerged_str + " " + branch.name
+
+    if not csv:
+        if print_merged:
+            print("Merged branches    : %s" % (merged_str))
+        if print_notmerged:
+            print("NOT merged branches: %s" % (notmerged_str))
+
+    if print_stats:
+        print("#----------")
+        print("#Merged    : %d" % merged)
+        print("#Not merged: %d" % notmerged)
+
+
+def parse_args(args=sys.argv[1:], Parser=OptionParser):
+
+    parser = Parser(description="This script prints out merged and/or unmerged"
+                    " branches of a GIT tree.")
+
+    parser.add_option("-c", "--csv", action="store_true",
+                      default=False, help="generates CSV output")
+    parser.add_option("-u", "--unmerged", action="store_true",
+                      default=False, help="lists unmerged branches")
+    parser.add_option("-m", "--skip-merged", action="store_true",
+                      default=False, help="omits listing merged branches")
+    parser.add_option("-s", "--stats", action="store_true",
+                      default=False, help="prints also statistics")
+
+    (options, args) = parser.parse_args(args)
+
+    if args:
+        parser.print_help()
+        sys.exit(1)
+
+    return options
+
+def main():
+    usage = """%prog
+    Lists all obsolete (fully merged into master) branches.
+    """
+
+    options = parse_args()
+    csv = options.csv
+    merged = not options.skip_merged
+    unmerged = options.unmerged
+    stats = options.stats
+
+    if csv:
+        print("branch name,status,date,last commit(mail),last commit(name)")
+
+    branch_list = branch_list_get(not csv)
+
+    branch_print(branch_list, csv, merged, unmerged, stats)
+
+if __name__ == '__main__':
+   main()



More information about the bind10-changes mailing list