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

Side by Side Diff: gcl.py

Issue 501171: Add full_move flag to GIT.GenerateDiff and Factor out FindGclientRootDir into gclient_utils. (Closed)
Patch Set: Created 10 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Wrapper script around Rietveld's upload.py that groups files into 6 """Wrapper script around Rietveld's upload.py that groups files into
7 changelists.""" 7 changelists."""
8 8
9 import getpass 9 import getpass
10 import os 10 import os
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 root = os.path.realpath(root) 824 root = os.path.realpath(root)
825 subpath = os.path.realpath(subpath) 825 subpath = os.path.realpath(subpath)
826 if not subpath.startswith(root): 826 if not subpath.startswith(root):
827 return None 827 return None
828 # If the root does not have a trailing \ or /, we add it so the returned 828 # If the root does not have a trailing \ or /, we add it so the returned
829 # path starts immediately after the seperator regardless of whether it is 829 # path starts immediately after the seperator regardless of whether it is
830 # provided. 830 # provided.
831 root = os.path.join(root, '') 831 root = os.path.join(root, '')
832 return subpath[len(root):] 832 return subpath[len(root):]
833 833
834 # Try to find the gclient root.
835 def FindGclientRootDir(from_dir):
836 path = os.path.realpath(from_dir)
837 while not os.path.exists(os.path.join(path, '.gclient')):
838 next = os.path.split(path)
839 if not next[1]:
840 return None
841 path = next[0]
842 return path
843
844 trychange_args = [] 834 trychange_args = []
845 settings = { 835 settings = {
846 'port': GetCodeReviewSetting('TRYSERVER_HTTP_PORT'), 836 'port': GetCodeReviewSetting('TRYSERVER_HTTP_PORT'),
847 'host': GetCodeReviewSetting('TRYSERVER_HTTP_HOST'), 837 'host': GetCodeReviewSetting('TRYSERVER_HTTP_HOST'),
848 'svn_repo': GetCodeReviewSetting('TRYSERVER_SVN_URL'), 838 'svn_repo': GetCodeReviewSetting('TRYSERVER_SVN_URL'),
849 'project': GetCodeReviewSetting('TRYSERVER_PROJECT'), 839 'project': GetCodeReviewSetting('TRYSERVER_PROJECT'),
850 'root': GetCodeReviewSetting('TRYSERVER_ROOT'), 840 'root': GetCodeReviewSetting('TRYSERVER_ROOT'),
851 'patchlevel': GetCodeReviewSetting('TRYSERVER_PATCHLEVEL'), 841 'patchlevel': GetCodeReviewSetting('TRYSERVER_PATCHLEVEL'),
852 } 842 }
853 for (k, v) in settings.iteritems(): 843 for (k, v) in settings.iteritems():
854 if v: 844 if v:
855 trychange_args.extend(['--' + k, v]) 845 trychange_args.extend(['--' + k, v])
856 846
857 gclient_root = FindGclientRootDir(GetRepositoryRoot()) 847 gclient_root = gclient_utils.FindGclientRoot(GetRepositoryRoot())
858 if gclient_root: 848 if gclient_root:
859 trychange_args.extend(['--root', PathDifference(gclient_root, 849 trychange_args.extend(['--root', PathDifference(gclient_root,
860 GetRepositoryRoot())]) 850 GetRepositoryRoot())])
861 if change_info: 851 if change_info:
862 trychange_args.extend(['--name', change_info.name]) 852 trychange_args.extend(['--name', change_info.name])
863 if change_info.issue: 853 if change_info.issue:
864 trychange_args.extend(["--issue", str(change_info.issue)]) 854 trychange_args.extend(["--issue", str(change_info.issue)])
865 if change_info.patchset: 855 if change_info.patchset:
866 trychange_args.extend(["--patchset", str(change_info.patchset)]) 856 trychange_args.extend(["--patchset", str(change_info.patchset)])
867 trychange_args.extend(args) 857 trychange_args.extend(args)
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 return 0 1229 return 0
1240 args =["svn", command] 1230 args =["svn", command]
1241 root = GetRepositoryRoot() 1231 root = GetRepositoryRoot()
1242 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()]) 1232 args.extend([os.path.join(root, x) for x in change_info.GetFileNames()])
1243 RunShell(args, True) 1233 RunShell(args, True)
1244 return 0 1234 return 0
1245 1235
1246 1236
1247 if __name__ == "__main__": 1237 if __name__ == "__main__":
1248 sys.exit(main()) 1238 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698