Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: scm.py

Issue 2824035: Add explicit file rename/cp information to svn rietveld uploads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
===================================================================
--- scm.py (revision 51118)
+++ scm.py (working copy)
@@ -800,6 +800,7 @@
filenames = [RelativePath(f, root) for f in filenames]
# Get information about the modified items (files and directories)
data = dict([(f, SVN.CaptureInfo(f)) for f in filenames])
+ diffs = []
if full_move:
# Eliminate modified files inside moved/copied directory.
for (filename, info) in data.iteritems():
@@ -811,8 +812,32 @@
if not filename in filenames:
# Remove filtered out items.
del data[filename]
+ else:
+ metaheaders = []
+ for (filename, info) in data.iteritems():
+ if SVN.IsMovedInfo(info):
+ # for now, the most common case is a head copy,
+ # so let's just encode that as a straight up cp.
+ srcurl = info.get('Copied From URL')
+ root = info.get('Repository Root')
+ rev = int(info.get('Copied From Rev'))
+ assert srcurl.startswith(root)
+ src = srcurl[len(root)+1:]
+ srcinfo = SVN.CaptureInfo(srcurl)
+ if (srcinfo.get('Revision') != rev and
+ SVN.Capture(['diff', '-r', '%d:head' % rev, srcurl])):
+ metaheaders.append("#$ svn cp -r %d %s %s "
+ "### WARNING: note non-trunk copy\n" %
+ (rev, src, filename))
+ else:
+ metaheaders.append("#$ cp %s %s\n" % (src,
+ filename))
+
+ if metaheaders:
+ diffs.append("### BEGIN SVN COPY METADATA\n")
+ diffs.extend(metaheaders)
+ diffs.append("### END SVN COPY METADATA\n")
# Now ready to do the actual diff.
- diffs = []
for filename in sorted(data.iterkeys()):
diffs.append(SVN._DiffItemInternal(filename, data[filename], bogus_dir,
full_move=full_move,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698