summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorpelya <x.pelya.x@gmail.com>2012-03-28 14:49:58 +0300
committerShawn Pearce <sop@google.com>2012-04-13 09:20:10 -0700
commitd67872d2f47b2f09a0e2aa4adfd62e6f69154c9b (patch)
tree654e38712aec5961e0e628b8be95b260b7eb9c80 /project.py
parente9d6b611c5bec499360c175035770132f1e60c71 (diff)
downloadgit-repo-d67872d2f47b2f09a0e2aa4adfd62e6f69154c9b.tar.gz
Option for 'repo diff' to generate output suitable for 'patch' cmd
The -u option causes 'repo diff' to generate diff output with file paths relative to the repository root, so the output can be applied to the Unix 'patch' command. The name '-u' was selected for convenience, because both 'diff' and 'git diff' accept the option with the same name to generate an 'unified diff' output suitable for 'patch' command. Change-Id: I79c8356db4ed20ecaccc258b3ba139db76666fe0 Reviewed-on: https://gerrit-review.googlesource.com/34380 Reviewed-by: Shawn Pearce <sop@google.com> Tested-by: Shawn Pearce <sop@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/project.py b/project.py
index 946a6ac3..303abe33 100644
--- a/project.py
+++ b/project.py
@@ -749,7 +749,7 @@ class Project(object):
749 749
750 return 'DIRTY' 750 return 'DIRTY'
751 751
752 def PrintWorkTreeDiff(self): 752 def PrintWorkTreeDiff(self, absolute_paths=False):
753 """Prints the status of the repository to stdout. 753 """Prints the status of the repository to stdout.
754 """ 754 """
755 out = DiffColoring(self.config) 755 out = DiffColoring(self.config)
@@ -757,6 +757,9 @@ class Project(object):
757 if out.is_on: 757 if out.is_on:
758 cmd.append('--color') 758 cmd.append('--color')
759 cmd.append(HEAD) 759 cmd.append(HEAD)
760 if absolute_paths:
761 cmd.append('--src-prefix=a/%s/' % self.relpath)
762 cmd.append('--dst-prefix=b/%s/' % self.relpath)
760 cmd.append('--') 763 cmd.append('--')
761 p = GitCommand(self, 764 p = GitCommand(self,
762 cmd, 765 cmd,