Skip to content

Commit 1adec46

Browse files
committed
Added some verbosity support to the mergeready script. Added support for commits containing deleted files.
- Legacy-Id: 8299
1 parent a78cb8c commit 1adec46

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

bin/mergeready

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ except Exception, e:
7070
# Handle options
7171

7272
# set default values, if any
73-
opt_verbose = False
73+
opt_verbose = 0
7474

7575
# handle individual options
7676
for opt, value in opts:
@@ -81,7 +81,7 @@ for opt, value in opts:
8181
print( program, version )
8282
sys.exit(0)
8383
elif opt in ["-V", "--verbose"]: # Output version information, then exit
84-
opt_verbose = True
84+
opt_verbose += 1
8585

8686
# ----------------------------------------------------------------------
8787
def say(s):
@@ -190,12 +190,14 @@ if write_cache:
190190

191191
def get_list(repo, filename):
192192
list = []
193+
note("Reading list from '%s'" % filename)
193194
with open(filename) as file:
194195
for line in file:
195196
line = line.strip()
196197
if line.startswith('#') or line == "":
197198
continue
198199
try:
200+
note(" '%s'" % line)
199201
changeset = line.split()[0]
200202
branch, rev = changeset.split('@')
201203
if branch.startswith('/'):
@@ -213,17 +215,22 @@ def get_list(repo, filename):
213215

214216
def get_ready_commits(repo, tree):
215217
list = []
216-
commit_log = pipe('svn log -v -r %s:HEAD %s/%s/' % ((head-500), repo, tree))
218+
note("Getting ready commits from '%s'" % tree)
219+
cmd = 'svn log -v -r %s:HEAD %s/%s/' % ((head-500), repo, tree)
220+
if opt_verbose > 1:
221+
note("Running '%s' ..." % cmd)
222+
commit_log = pipe(cmd)
217223
for line in commit_log.splitlines():
218224
if re.search('^r[0-9]+ ', line):
219225
rev, who, when = split_loginfo(line)
220226
branch = None
221227
continue
222-
if (line.startswith(' M') or line.startswith(' A')) and branch == None:
228+
if (line.startswith(' M') or line.startswith(' A') or line.startswith(' D')) and branch == None:
223229
type, path = line[:4], line[5:]
224230
branch = '/'.join(path.split('/')[1:4])
225231
elif re.search("(?i)(commit ready (for|to) merge)", line):
226232
if not (rev in merged_revs and branch == merged_revs[rev]):
233+
note(" %s %s: %s@%s" % (when, who, branch, rev))
227234
list += [(rev, repo, branch),]
228235
elif rev in merged_revs and not branch == merged_revs[rev]:
229236
sys.stderr.write('Rev %s: %s != %s' % (rev, branch, merged_revs[rev]))
@@ -242,14 +249,17 @@ ready += get_ready_commits(repo, 'branch/amsl')
242249
ready_commits = {}
243250
for entry in ready:
244251
rev, repo, branch = entry
245-
loginfo = pipe('svn log -v -r %s %s/%s/' % (rev, repo, branch)).splitlines()
252+
cmd = 'svn log -v -r %s %s/%s/' % (rev, repo, branch)
253+
if opt_verbose > 1:
254+
note("Running '%s' ..." % cmd)
255+
loginfo = pipe(cmd).splitlines()
246256
try:
247257
rev, who, when = split_loginfo(loginfo[1])
248258
except IndexError:
249259
die("Wrong changeset version in %s@%s ?" % (branch, rev))
250260
for line in loginfo[3:]:
251261
type, path = line[:4], line[5:]
252-
if 'M' in type or 'A' in type:
262+
if 'M' in type or 'A' in type or 'D' in type:
253263
break
254264
merge_path = os.path.join(*path.split(os.path.sep)[:4])
255265
if not (rev, repo, merge_path) in hold:

0 commit comments

Comments
 (0)