Put patches to refs/patches/<user>/<name>
When using Git, trychange.py used to put patches to refs/patches/<name>
refs, where <name> is a name of a patch. Now the using the username as a part
of the path.
This way we have better control over permissions per user basis
R=agable@chromium.org, iannucci@chromium.org
TEST=Sent a change to quickoffice try server. Master and slave do not
need to be modified because the ref file in master branch points to
the correct branch name
Review URL: https://codereview.chromium.org/231663005
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@263432 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/trychange.py b/trychange.py
index 8a6e35e..8fe2b5f 100755
--- a/trychange.py
+++ b/trychange.py
@@ -640,12 +640,13 @@
with _PrepareDescriptionAndPatchFiles(description, options) as (
patch_filename, description_filename):
logging.info('Committing patch')
- target_branch = ('refs/patches/' +
- os.path.basename(patch_filename).replace(' ','-'))
+ target_branch = 'refs/patches/%s/%s' % (
+ Escape(options.user),
+ os.path.basename(patch_filename).replace(' ','_'))
target_filename = os.path.join(patch_dir, 'patch.diff')
branch_file = os.path.join(patch_dir, GIT_BRANCH_FILE)
try:
- # Crete a new branch and put the patch there
+ # Create a new branch and put the patch there.
patch_git('checkout', '--orphan', target_branch)
patch_git('reset')
patch_git('clean', '-f')