Parse a view line, splitting it into depot and client sides. Append to self.mappings, preserving order. This is only needed for tag creation.
(self, view_line)
| 2791 | self.client_spec_path_cache = {} |
| 2792 | |
| 2793 | def append(self, view_line): |
| 2794 | """Parse a view line, splitting it into depot and client sides. Append |
| 2795 | to self.mappings, preserving order. This is only needed for tag |
| 2796 | creation. |
| 2797 | """ |
| 2798 | |
| 2799 | # Split the view line into exactly two words. P4 enforces |
| 2800 | # structure on these lines that simplifies this quite a bit. |
| 2801 | # |
| 2802 | # Either or both words may be double-quoted. |
| 2803 | # Single quotes do not matter. |
| 2804 | # Double-quote marks cannot occur inside the words. |
| 2805 | # A + or - prefix is also inside the quotes. |
| 2806 | # There are no quotes unless they contain a space. |
| 2807 | # The line is already white-space stripped. |
| 2808 | # The two words are separated by a single space. |
| 2809 | # |
| 2810 | if view_line[0] == '"': |
| 2811 | # First word is double quoted. Find its end. |
| 2812 | close_quote_index = view_line.find('"', 1) |
| 2813 | if close_quote_index <= 0: |
| 2814 | die("No first-word closing quote found: %s" % view_line) |
| 2815 | depot_side = view_line[1:close_quote_index] |
| 2816 | # skip closing quote and space |
| 2817 | rhs_index = close_quote_index + 1 + 1 |
| 2818 | else: |
| 2819 | space_index = view_line.find(" ") |
| 2820 | if space_index <= 0: |
| 2821 | die("No word-splitting space found: %s" % view_line) |
| 2822 | depot_side = view_line[0:space_index] |
| 2823 | rhs_index = space_index + 1 |
| 2824 | |
| 2825 | # prefix + means overlay on previous mapping |
| 2826 | if depot_side.startswith("+"): |
| 2827 | depot_side = depot_side[1:] |
| 2828 | |
| 2829 | # prefix - means exclude this path, leave out of mappings |
| 2830 | exclude = False |
| 2831 | if depot_side.startswith("-"): |
| 2832 | exclude = True |
| 2833 | depot_side = depot_side[1:] |
| 2834 | |
| 2835 | if not exclude: |
| 2836 | self.mappings.append(depot_side) |
| 2837 | |
| 2838 | def convert_client_path(self, clientFile): |
| 2839 | # chop off //client/ part to make it relative |
no test coverage detected