git-p4son 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_p4son-0.3.2 → git_p4son-0.3.4}/PKG-INFO +27 -3
- {git_p4son-0.3.2 → git_p4son-0.3.4}/README.md +26 -2
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/__init__.py +1 -1
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/perforce.py +10 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/sync.py +322 -175
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/sync_split.py +16 -2
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son.egg-info/PKG-INFO +27 -3
- {git_p4son-0.3.2 → git_p4son-0.3.4}/pyproject.toml +1 -1
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_perforce.py +30 -1
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_sync.py +188 -12
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_sync_split.py +181 -2
- {git_p4son-0.3.2 → git_p4son-0.3.4}/LICENSE +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/__main__.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/alias.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/changelist_store.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/cli.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/common.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/complete.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/completions/_git-p4son +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/completions/git-p4son.bash +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/completions/git-p4son.ps1 +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/config.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/git.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/hooks.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/init.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/lib.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/list_changes.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/log.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/new.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/review.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/state.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son/update.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son.egg-info/SOURCES.txt +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son.egg-info/dependency_links.txt +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son.egg-info/entry_points.txt +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/git_p4son.egg-info/top_level.txt +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/setup.cfg +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_alias.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_changelist_store.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_cli.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_common.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_complete.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_config.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_git.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_hooks.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_init.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_lib_changelist.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_lib_edit.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_lib_review.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_list_changes.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_log.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_new.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_review.py +0 -0
- {git_p4son-0.3.2 → git_p4son-0.3.4}/tests/test_state.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: git-p4son
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Utility for keeping a Perforce workspace and local git repo in sync
|
|
5
5
|
Author-email: Andreas Andersson <andreas@neoboid.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -231,6 +231,14 @@ be managed manually or via Perforce directly.
|
|
|
231
231
|
After syncing, git-p4son prints a summary of how each writable file was handled, and instructs you to review and
|
|
232
232
|
commit any files that need attention.
|
|
233
233
|
|
|
234
|
+
**Workspaces with `allwrite`** - When your client spec has the `allwrite` option, every file is writable by design,
|
|
235
|
+
so the read-only flag carries no information about local changes. git-p4son classifies files exactly as above (the
|
|
236
|
+
verdict comes from git, not from the flag), but leaves the write bit alone on files it finds unchanged: with
|
|
237
|
+
`noclobber` Perforce compares digests before refusing to overwrite a writable file, and unchanged files pass that
|
|
238
|
+
check. Only files with local changes are made read-only for the duration of the sync, since those are the ones
|
|
239
|
+
Perforce would otherwise refuse to overwrite. The same digest check applies to git-ignored files: unchanged ones sync
|
|
240
|
+
normally, and after the sync git-p4son lists the ones Perforce skipped because they were modified locally.
|
|
241
|
+
|
|
234
242
|
## Usage
|
|
235
243
|
|
|
236
244
|
git-p4son provides nine commands: `init`, `sync`, `sync-split`, `new`, `update`, `review`, `list-changes`,
|
|
@@ -335,7 +343,10 @@ own submits one at a time. Repeat `--user` to split out several people's changel
|
|
|
335
343
|
It is equivalent to working out the numbers by hand and running
|
|
336
344
|
`git p4son sync <before-theirs> <theirs> ... head`, and it delegates to `sync` once the sequence is
|
|
337
345
|
resolved, so [pre-sync and post-sync hooks](#hooks), writable-file merging, and the clean-workspace checks
|
|
338
|
-
all behave exactly as they do for `sync`.
|
|
346
|
+
all behave exactly as they do for `sync`. The clean-workspace checks and the pre-sync hooks are the one
|
|
347
|
+
thing that runs earlier: resolving the sequence costs several Perforce queries, so they go first, and a
|
|
348
|
+
dirty workspace or a hook that aborts the sync says so before that work. They run once for the whole sync,
|
|
349
|
+
and not at all for a `--dry-run` or when there is nothing to sync.
|
|
339
350
|
|
|
340
351
|
**Arguments:**
|
|
341
352
|
- `changelist` (optional): Changelist number to sync up to, or `head` for the latest. Omit to sync to the
|
|
@@ -639,12 +650,25 @@ clone, so no `chmod` is needed.
|
|
|
639
650
|
#### block-while-running (pre-sync)
|
|
640
651
|
|
|
641
652
|
Aborts the sync while a named process is running, so a sync cannot swap out assets that a running editor still
|
|
642
|
-
has loaded:
|
|
653
|
+
has loaded. Link it into your workspace's `pre-sync` hook directory - on macOS and Linux:
|
|
643
654
|
|
|
644
655
|
```sh
|
|
645
656
|
ln -s /path/to/git-p4son/examples/hooks/pre-sync/block-while-running.py .git-p4son/hooks/pre-sync/
|
|
646
657
|
```
|
|
647
658
|
|
|
659
|
+
On Windows, from PowerShell. Note that `-Path` is the link to create and `-Target` the existing file, the
|
|
660
|
+
reverse of the `ln -s` argument order, and that `-Target` should be absolute: a relative path is resolved
|
|
661
|
+
against the current directory and quietly produces a broken link.
|
|
662
|
+
|
|
663
|
+
```powershell
|
|
664
|
+
New-Item -ItemType SymbolicLink `
|
|
665
|
+
-Path "C:\p4\my-workspace\.git-p4son\hooks\pre-sync\block-while-running.py" `
|
|
666
|
+
-Target "C:\src\git-p4son\examples\hooks\pre-sync\block-while-running.py"
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
Creating a symlink on Windows needs either an elevated shell or Developer Mode enabled (Settings > System >
|
|
670
|
+
For developers). Without one of those, copy the file instead and re-copy it whenever the clone updates.
|
|
671
|
+
|
|
648
672
|
Which processes block a sync is read from your workspace's own `.git-p4son/config.toml`, so a symlinked hook
|
|
649
673
|
stays per-project:
|
|
650
674
|
|
|
@@ -208,6 +208,14 @@ be managed manually or via Perforce directly.
|
|
|
208
208
|
After syncing, git-p4son prints a summary of how each writable file was handled, and instructs you to review and
|
|
209
209
|
commit any files that need attention.
|
|
210
210
|
|
|
211
|
+
**Workspaces with `allwrite`** - When your client spec has the `allwrite` option, every file is writable by design,
|
|
212
|
+
so the read-only flag carries no information about local changes. git-p4son classifies files exactly as above (the
|
|
213
|
+
verdict comes from git, not from the flag), but leaves the write bit alone on files it finds unchanged: with
|
|
214
|
+
`noclobber` Perforce compares digests before refusing to overwrite a writable file, and unchanged files pass that
|
|
215
|
+
check. Only files with local changes are made read-only for the duration of the sync, since those are the ones
|
|
216
|
+
Perforce would otherwise refuse to overwrite. The same digest check applies to git-ignored files: unchanged ones sync
|
|
217
|
+
normally, and after the sync git-p4son lists the ones Perforce skipped because they were modified locally.
|
|
218
|
+
|
|
211
219
|
## Usage
|
|
212
220
|
|
|
213
221
|
git-p4son provides nine commands: `init`, `sync`, `sync-split`, `new`, `update`, `review`, `list-changes`,
|
|
@@ -312,7 +320,10 @@ own submits one at a time. Repeat `--user` to split out several people's changel
|
|
|
312
320
|
It is equivalent to working out the numbers by hand and running
|
|
313
321
|
`git p4son sync <before-theirs> <theirs> ... head`, and it delegates to `sync` once the sequence is
|
|
314
322
|
resolved, so [pre-sync and post-sync hooks](#hooks), writable-file merging, and the clean-workspace checks
|
|
315
|
-
all behave exactly as they do for `sync`.
|
|
323
|
+
all behave exactly as they do for `sync`. The clean-workspace checks and the pre-sync hooks are the one
|
|
324
|
+
thing that runs earlier: resolving the sequence costs several Perforce queries, so they go first, and a
|
|
325
|
+
dirty workspace or a hook that aborts the sync says so before that work. They run once for the whole sync,
|
|
326
|
+
and not at all for a `--dry-run` or when there is nothing to sync.
|
|
316
327
|
|
|
317
328
|
**Arguments:**
|
|
318
329
|
- `changelist` (optional): Changelist number to sync up to, or `head` for the latest. Omit to sync to the
|
|
@@ -616,12 +627,25 @@ clone, so no `chmod` is needed.
|
|
|
616
627
|
#### block-while-running (pre-sync)
|
|
617
628
|
|
|
618
629
|
Aborts the sync while a named process is running, so a sync cannot swap out assets that a running editor still
|
|
619
|
-
has loaded:
|
|
630
|
+
has loaded. Link it into your workspace's `pre-sync` hook directory - on macOS and Linux:
|
|
620
631
|
|
|
621
632
|
```sh
|
|
622
633
|
ln -s /path/to/git-p4son/examples/hooks/pre-sync/block-while-running.py .git-p4son/hooks/pre-sync/
|
|
623
634
|
```
|
|
624
635
|
|
|
636
|
+
On Windows, from PowerShell. Note that `-Path` is the link to create and `-Target` the existing file, the
|
|
637
|
+
reverse of the `ln -s` argument order, and that `-Target` should be absolute: a relative path is resolved
|
|
638
|
+
against the current directory and quietly produces a broken link.
|
|
639
|
+
|
|
640
|
+
```powershell
|
|
641
|
+
New-Item -ItemType SymbolicLink `
|
|
642
|
+
-Path "C:\p4\my-workspace\.git-p4son\hooks\pre-sync\block-while-running.py" `
|
|
643
|
+
-Target "C:\src\git-p4son\examples\hooks\pre-sync\block-while-running.py"
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Creating a symlink on Windows needs either an elevated shell or Developer Mode enabled (Settings > System >
|
|
647
|
+
For developers). Without one of those, copy the file instead and re-copy it whenever the clone updates.
|
|
648
|
+
|
|
625
649
|
Which processes block a sync is read from your workspace's own `.git-p4son/config.toml`, so a symlinked hook
|
|
626
650
|
stays per-project:
|
|
627
651
|
|
|
@@ -77,6 +77,10 @@ class P4ClientSpec:
|
|
|
77
77
|
def clobber(self) -> bool:
|
|
78
78
|
return 'clobber' in self.options
|
|
79
79
|
|
|
80
|
+
@property
|
|
81
|
+
def allwrite(self) -> bool:
|
|
82
|
+
return 'allwrite' in self.options
|
|
83
|
+
|
|
80
84
|
@property
|
|
81
85
|
def uses_crlf(self) -> bool:
|
|
82
86
|
if self.line_end == 'win':
|
|
@@ -472,6 +476,12 @@ def is_binary_file_type(head_type: str) -> bool:
|
|
|
472
476
|
return base_type in ('binary', 'ubinary')
|
|
473
477
|
|
|
474
478
|
|
|
479
|
+
def is_always_writable_file_type(head_type: str) -> bool:
|
|
480
|
+
"""Check if a Perforce headType carries the +w (always writable) modifier."""
|
|
481
|
+
_, _, modifiers = head_type.partition('+')
|
|
482
|
+
return 'w' in modifiers
|
|
483
|
+
|
|
484
|
+
|
|
475
485
|
@dataclass
|
|
476
486
|
class P4SyncPreviewFile:
|
|
477
487
|
"""A file a sync would affect, from p4 sync -n output.
|