Skip to content

Add sync progress bar demo scripts and documentation#1

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/add-python-test-script
Draft

Add sync progress bar demo scripts and documentation#1
Copilot wants to merge 4 commits intomasterfrom
copilot/add-python-test-script

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 19, 2026

Provides reference implementations for P4.Progress callbacks during sync operations.

Files

  • simple_sync_progress.py (112 lines) - Minimal example with ASCII progress bar
  • p4_sync_progress_demo.py (362 lines) - Full implementation with CLI args, basic/tqdm modes
  • SYNC_PROGRESS_EXAMPLES.md - P4.Progress API reference, constants, patterns
  • QUICK_START.md - Common use cases and customization examples

Usage

import P4

class SimpleProgressBar(P4.Progress):
    def setTotal(self, total):
        self.total = total
    
    def update(self, position):
        percent = (position / self.total) * 100
        print(f'[{"="*40}] {percent:.1f}%')

p4 = P4.P4()
p4.progress = SimpleProgressBar()
p4.connect()
p4.run_sync("//...")

Command-line:

python simple_sync_progress.py
python p4_sync_progress_demo.py --tqdm --path //depot/main/...

Implementation

Both scripts extend P4.Progress base class:

  • init(type) - Operation start (TYPE_SENDFILE/RECEIVEFILE/TRANSFER/COMPUTATION)
  • setDescription(desc, unit) - Set description and unit type (PERCENT/FILES/KBYTES/MBYTES)
  • setTotal(total) - Total items to process
  • update(position) - Current position
  • done(fail) - Completion callback

No changes to existing p4python code.

Original prompt

Analyse the codebase of this repo and write my a python test script allowing me to do a sync and display a progress bar.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 19, 2026 17:10
- Created p4_sync_progress_demo.py: Full-featured demo with CLI options
- Created simple_sync_progress.py: Minimal example for quick start
- Created SYNC_PROGRESS_EXAMPLES.md: Comprehensive documentation

Co-authored-by: Bibi31 <20553493+Bibi31@users.noreply.github.com>
Co-authored-by: Bibi31 <20553493+Bibi31@users.noreply.github.com>
Co-authored-by: Bibi31 <20553493+Bibi31@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Python test script for sync with progress bar Add sync progress bar demo scripts and documentation Jan 19, 2026
Copilot AI requested a review from Bibi31 January 19, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants