feat: Add tag support to file history display
- Modified cvs_client.py get_file_history() to parse and extract tags from CVS log - Updated ui.js displayHistory() to render tags for each revision - Added CSS styling for history tags with proper theming support - Tags are displayed inline with revision information in history view
This commit is contained in:
parent
c15b759378
commit
45ad8bb135
3 changed files with 55 additions and 0 deletions
|
|
@ -232,6 +232,7 @@ class CVSClient:
|
|||
revisions = []
|
||||
current_revision = {}
|
||||
in_log = False
|
||||
in_tags = False
|
||||
|
||||
for line in output.split('\n'):
|
||||
# Look for revision lines (format: "revision X.X")
|
||||
|
|
@ -240,12 +241,19 @@ class CVSClient:
|
|||
# Look for date/author/state line (format: "date: YYYY/MM/DD HH:MM:SS; author: NAME; state: STATE;")
|
||||
date_match = re.match(r'^date:\s+(\d{4}/\d{2}/\d{2}\s+\d{2}:\d{2}:\d{2});\s+author:\s+(\S+);\s+state:\s+(\S+);', line)
|
||||
|
||||
# Look for branches line (format: "branches: ...")
|
||||
branches_match = re.match(r'^branches:', line)
|
||||
|
||||
# Look for tag lines (format: "\tTAG_NAME: X.X")
|
||||
tag_match = re.match(r'^\s+(\S+):\s+(\S+)', line)
|
||||
|
||||
if rev_match:
|
||||
# Start of a new revision
|
||||
if current_revision and 'revision' in current_revision:
|
||||
revisions.append(current_revision)
|
||||
current_revision = {'revision': rev_match.group(1)}
|
||||
in_log = False
|
||||
in_tags = False
|
||||
|
||||
if date_match:
|
||||
current_revision.update({
|
||||
|
|
@ -255,11 +263,29 @@ class CVSClient:
|
|||
'lines_changed': 'N/A' # cvs log doesn't provide line counts
|
||||
})
|
||||
in_log = False
|
||||
in_tags = False
|
||||
|
||||
if branches_match:
|
||||
# Branches section starts, tags follow
|
||||
in_tags = True
|
||||
in_log = False
|
||||
continue
|
||||
|
||||
# Capture tags (lines with indentation after branches line)
|
||||
if in_tags and tag_match and not re.match(r'^---', line):
|
||||
tag_name = tag_match.group(1)
|
||||
tag_revision = tag_match.group(2)
|
||||
# Only add tags that match the current revision
|
||||
if tag_revision == current_revision.get('revision'):
|
||||
if 'tags' not in current_revision:
|
||||
current_revision['tags'] = []
|
||||
current_revision['tags'].append(tag_name)
|
||||
|
||||
# Capture log message (lines after date/author/state until next revision or separator)
|
||||
if in_log:
|
||||
if line.strip() == '' or re.match(r'^---', line):
|
||||
in_log = False
|
||||
in_tags = False
|
||||
elif not re.match(r'^(revision|date|branches):', line):
|
||||
if 'log' not in current_revision:
|
||||
current_revision['log'] = ''
|
||||
|
|
@ -282,6 +308,9 @@ class CVSClient:
|
|||
rev['log'] = rev['log'].strip().split('\n')[0]
|
||||
else:
|
||||
rev['log'] = ''
|
||||
# Ensure tags field exists
|
||||
if 'tags' not in rev:
|
||||
rev['tags'] = []
|
||||
|
||||
return revisions
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue