← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~hjd/widelands/utils-cleanup into lp:widelands

 

Hans Joachim Desserud has proposed merging lp:~hjd/widelands/utils-cleanup into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~hjd/widelands/utils-cleanup/+merge/224023

* detect_revsion had the ability to detect git revision, however from what I could see it boiled down to using git-svn to get the svn revision. Feel free to correct me if this still makes sense, but it seems to be a relic from when Widelands lived on sourceforge, was hosted with subversion and someone presumably used git-svn to get nifty features like branches.
* Removed count-longlines.py since line length is checked at compile time by codecheck.
* When reading the cppcheck manpage I discovered that --std=c++11 is the default option. I am not sure how relevant checking against the other standards were (c99 and posix), so I simply removed them, since I figured c++11 was the most important one.
-- 
https://code.launchpad.net/~hjd/widelands/utils-cleanup/+merge/224023
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/utils-cleanup into lp:widelands.
=== removed file 'utils/count-longlines.py'
--- utils/count-longlines.py	2010-11-15 21:23:02 +0000
+++ utils/count-longlines.py	1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-#!/usr/bin/python -tt
-"""./count-longlines.py
-(called from main widelands directory)
-
-Count lines that are too long to fit on 80 character screens
-when using different tabwidths."""
-
-import fnmatch
-import os
-import string
-import fileinput
-import sys
-
-def find(root, glob):
-	files=[]
-	for file in os.listdir(root):
-		file=os.path.join(root, file)
-		if fnmatch.fnmatch(file, glob):
-			files.append(file)
-		if os.path.isdir(file):
-			files+=find(file, glob)
-	return files
-
-files =find(".", "*.h")
-files+=find(".", "*.cc")
-
-shortlines=0
-longlines=0
-oversizelines=0
-
-for line in fileinput.input(files):
-	line2=line.expandtabs(2).rstrip()
-	line3=line.expandtabs(3).rstrip()
-
-	if len(line3)>80:
-		longlines+=1
-		if len(line2)>80:
-			oversizelines+=1
-	else:
-		shortlines+=1
-
-lines=shortlines + longlines
-print
-print "Total lines:                         %7i   100.00%%" % (lines)
-print "Short lines        <80 @ tabwidth=3: %7i   %6.2f%%" % (shortlines, 100.0*shortlines/lines)
-print "Long lines         >80 @ tabwidth=3: %7i   %6.2f%%" % (longlines, 100.0*longlines/lines)
-print
-print "OVERSIZE LINES !!  >80 @ tabwidth=2: %7i   %6.2f%%" % (oversizelines, 100.0*oversizelines/lines)
-print

=== modified file 'utils/create_cppcheck_report'
--- utils/create_cppcheck_report	2012-04-29 15:44:08 +0000
+++ utils/create_cppcheck_report	2014-06-21 15:30:27 +0000
@@ -8,7 +8,7 @@
 cppcheck --version                                                                     >> $FILE
 echo "</h2>"                                                                           >> $FILE
 echo "<div>"                                                                           >> $FILE
-cppcheck --force --quiet --verbose --std=posix --std=c99 --std=c++11 --enable=all -I src src 2>&1 | sed "s@^\[\(.*\):\([[:digit:]]\+\)\]: \(.*\)\$@<a href=\"http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/annotate/head%3A/\1\?#L\2\";>\1:\2</a>: \3<br/>@" >> $FILE
+cppcheck --force --quiet --verbose --enable=all -I src src 2>&1 | sed "s@^\[\(.*\):\([[:digit:]]\+\)\]: \(.*\)\$@<a href=\"http://bazaar.launchpad.net/%7Ewidelands-dev/widelands/trunk/annotate/head%3A/\1\?#L\2\";>\1:\2</a>: \3<br/>@" >> $FILE
 echo "</div>"                                                                          >> $FILE
 echo "</body>"                                                                         >> $FILE
 echo "</html>"                                                                         >> $FILE

=== modified file 'utils/detect_revision.py'
--- utils/detect_revision.py	2013-07-26 09:50:23 +0000
+++ utils/detect_revision.py	2014-06-21 15:30:27 +0000
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 # Tries to find out the repository revision of the current working directory
-# using bzr or git
+# using bzr or debian/changelog
 
 import os
 import sys
@@ -52,26 +52,6 @@
     if os.path.exists(fname):
         return open(fname).read().strip()
 
-def detect_git_revision():
-    if not sys.platform.startswith('linux') and \
-       not sys.platform.startswith('darwin'):
-        return None
-
-    is_git_workdir=os.system('git show >/dev/null 2>&1')==0
-    if is_git_workdir:
-        git_revnum=os.popen('git show --pretty=format:%h | head -n 1').read().rstrip()
-        is_pristine=os.popen('git show --pretty=format:%b | grep ^git-svn-id\\:').read().find("git-svn-id:") == 0
-        common_ancestor=os.popen('git show-branch --sha1-name refs/remotes/git-svn HEAD | tail -n 1 | sed "s@++ \\[\\([0-9a-f]*\\)\\] .*@\\1@"').read().rstrip()
-        svn_revnum=os.popen('git show --pretty=format:%b%n '+common_ancestor+' | grep ^git-svn-id\\: -m 1 | sed "sM.*@\\([0-9]*\\) .*M\\1M"').read().rstrip()
-
-        if svn_revnum=='':
-            return 'unofficial-git-%s' % (git_revnum,)
-        elif is_pristine:
-            return 'unofficial-git-%s(svn%s)' % (git_revnum, svn_revnum)
-        else:
-            return 'unofficial-git-%s(svn%s+changes)' % (git_revnum, svn_revnum)
-
-
 def detect_bzr_revision():
     if __has_bzrlib:
         b = BzrDir.open(base_path).open_branch()
@@ -92,7 +72,6 @@
 def detect_revision():
     for func in (
         check_for_explicit_version,
-        detect_git_revision,
         detect_bzr_revision,
         detect_debian_version):
         rv = func()