1 |
Author: zmedico |
2 |
Date: 2008-08-01 01:44:10 +0000 (Fri, 01 Aug 2008) |
3 |
New Revision: 11304 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/repoman |
7 |
Log: |
8 |
Bug #229033 - Use `svn propget -R svn:keywords` to detect which will have |
9 |
changed headers that require an additional manifest commit. Thanks to |
10 |
Fabian Groffen for this patch which I've made some modifications to: |
11 |
* For clarity, use separate "no_expansion" variable for cvs bin blobs. |
12 |
* Fix svn keyword parsing to properly handle multiple keywords delimited |
13 |
by newlines. |
14 |
|
15 |
|
16 |
Modified: main/trunk/bin/repoman |
17 |
=================================================================== |
18 |
--- main/trunk/bin/repoman 2008-08-01 00:47:23 UTC (rev 11303) |
19 |
+++ main/trunk/bin/repoman 2008-08-01 01:44:10 UTC (rev 11304) |
20 |
@@ -1747,20 +1747,29 @@ |
21 |
mynew=portage.cvstree.findnew(mycvstree,recursive=1,basedir="./") |
22 |
myremoved=portage.cvstree.findremoved(mycvstree,recursive=1,basedir="./") |
23 |
bin_blob_pattern = re.compile("^-kb$") |
24 |
- bin_blobs = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern, |
25 |
+ no_expansion = set(portage.cvstree.findoption(mycvstree, bin_blob_pattern, |
26 |
recursive=1, basedir="./")) |
27 |
|
28 |
|
29 |
if vcs == "svn": |
30 |
svnstatus = os.popen("svn status").readlines() |
31 |
mychanged = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("M") ] |
32 |
- for manifest in [ file for file in mychanged if '/Manifest' in file ]: |
33 |
- mychanged.remove(manifest) |
34 |
- mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ] |
35 |
+ mynew = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("A") ] |
36 |
myremoved = [ elem.rstrip()[7:] for elem in svnstatus if elem.startswith("D") ] |
37 |
- # no idea how to detect binaries in SVN |
38 |
- bin_blobs = [] |
39 |
+ # in contrast to CVS, SVN expands nothing by default. |
40 |
+ # bin_blobs historically |
41 |
+ # were just there to see what files need to be checked for |
42 |
+ # keyword expansion, which is exactly what we do here, so |
43 |
+ # slightly change the semantic meaning of "bin_blob"... In the |
44 |
+ # future we could store which keyword is expanded. |
45 |
+ props = os.popen("svn propget -R svn:keywords").readlines() |
46 |
|
47 |
+ # For files with multiple props set, props are delimited by newlines, |
48 |
+ # so exclude lines that don't contain " - " since each of those lines |
49 |
+ # only a contain props for a file listed on a previous line. |
50 |
+ expansion = set(prop.split(" - ")[0] \ |
51 |
+ for prop in props if " - " in prop) |
52 |
+ |
53 |
if vcs: |
54 |
if not (mychanged or mynew or myremoved): |
55 |
print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"" |
56 |
@@ -1779,8 +1788,17 @@ |
57 |
headerstring = "'\$(Header|Id)" |
58 |
headerstring += ".*\$'" |
59 |
for myfile in myupdates: |
60 |
- if myfile in bin_blobs: |
61 |
- continue |
62 |
+ |
63 |
+ # for CVS, no_expansion contains files that are excluded from expansion |
64 |
+ if vcs == "cvs": |
65 |
+ if myfile in no_expansion: |
66 |
+ continue |
67 |
+ |
68 |
+ # for SVN, expansion contains files that are included in expansion |
69 |
+ elif vcs == "svn": |
70 |
+ if myfile not in expansion: |
71 |
+ continue |
72 |
+ |
73 |
myout = commands.getstatusoutput("egrep -q "+headerstring+" "+myfile) |
74 |
if myout[0] == 0: |
75 |
myheaders.append(myfile) |
76 |
@@ -1835,6 +1853,8 @@ |
77 |
|
78 |
if myupdates or myremoved: |
79 |
myfiles = myupdates + myremoved |
80 |
+ if not myheaders and "sign" not in repoman_settings.features: |
81 |
+ myfiles += mymanifests |
82 |
fd, commitmessagefile = tempfile.mkstemp(".repoman.msg") |
83 |
mymsg = os.fdopen(fd, "w") |
84 |
mymsg.write(commitmessage) |
85 |
@@ -1921,8 +1941,8 @@ |
86 |
write_atomic(x, "".join(mylines)) |
87 |
|
88 |
manifest_commit_required = True |
89 |
- if myheaders or myupdates or myremoved or mynew: |
90 |
- myfiles=myheaders+myupdates+myremoved+mynew |
91 |
+ if myupdates or myremoved or mynew: |
92 |
+ myfiles=myupdates+myremoved+mynew |
93 |
for x in range(len(myfiles)-1, -1, -1): |
94 |
if myfiles[x].count("/") < 4-repolevel: |
95 |
del myfiles[x] |