Skip to content

Commit

Permalink
Support the new move/add and move/delete operations in Perforce.
Browse files Browse the repository at this point in the history
New versions of Perforce provide more explicit information when moving
files. There are two new types: move/add and move/delete. These more or
less map (for our purposes) to just add and delete. We should now handle
them.

Fixes bug #1417
  • Loading branch information
chipx86 committed Dec 22, 2009
1 parent a39e3f2 commit 9d1648a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rbtools/postreview.py
Expand Up @@ -1641,7 +1641,10 @@ def _changenum_diff(self, changenum):
if not line:
continue

m = re.search(r'\.\.\. ([^#]+)#(\d+) (add|edit|delete|integrate|branch)', line)
m = re.search(r'\.\.\. ([^#]+)#(\d+) '
r'(add|edit|delete|integrate|branch|move/add'
r'|move/delete)',
line)
if not m:
die("Unsupported line from p4 opened: %s" % line)

Expand All @@ -1661,7 +1664,7 @@ def _changenum_diff(self, changenum):
old_depot_path = new_depot_path = None
changetype_short = None

if changetype == 'edit' or changetype == 'integrate':
if changetype in ['edit', 'integrate']:
# A big assumption
new_revision = base_revision + 1

Expand All @@ -1680,8 +1683,7 @@ def _changenum_diff(self, changenum):
new_file = tmp_diff_to_filename

changetype_short = "M"

elif changetype == 'add' or changetype == 'branch':
elif changetype in ['add', 'branch', 'move/add']:
# We have a new file, get p4 to put this new file into a pretty
# temp file for us. No old file to worry about here.
if cl_is_pending:
Expand All @@ -1690,8 +1692,7 @@ def _changenum_diff(self, changenum):
self._write_file(depot_path, tmp_diff_to_filename)
new_file = tmp_diff_to_filename
changetype_short = "A"

elif changetype == 'delete':
elif changetype in ['delete', 'move/delete']:
# We've deleted a file, get p4 to put the deleted file into a temp
# file for us. The new file remains the empty file.
old_depot_path = "%s#%s" % (depot_path, base_revision)
Expand Down

0 comments on commit 9d1648a

Please sign in to comment.