diffmanifests 3.6.2__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.
Files changed (38) hide show
  1. diffmanifests-3.6.2/LICENSE +21 -0
  2. diffmanifests-3.6.2/MANIFEST.in +5 -0
  3. diffmanifests-3.6.2/PKG-INFO +489 -0
  4. diffmanifests-3.6.2/README.md +449 -0
  5. diffmanifests-3.6.2/diff.py +11 -0
  6. diffmanifests-3.6.2/diffmanifests/__init__.py +0 -0
  7. diffmanifests-3.6.2/diffmanifests/__main__.py +6 -0
  8. diffmanifests-3.6.2/diffmanifests/cmd/__init__.py +0 -0
  9. diffmanifests-3.6.2/diffmanifests/cmd/argument.py +41 -0
  10. diffmanifests-3.6.2/diffmanifests/cmd/banner.py +9 -0
  11. diffmanifests-3.6.2/diffmanifests/cmd/version.py +3 -0
  12. diffmanifests-3.6.2/diffmanifests/config/config.json +17 -0
  13. diffmanifests-3.6.2/diffmanifests/differ/__init__.py +0 -0
  14. diffmanifests-3.6.2/diffmanifests/differ/differ.py +137 -0
  15. diffmanifests-3.6.2/diffmanifests/gerrit/__init__.py +0 -0
  16. diffmanifests-3.6.2/diffmanifests/gerrit/gerrit.py +51 -0
  17. diffmanifests-3.6.2/diffmanifests/gitiles/__init__.py +0 -0
  18. diffmanifests-3.6.2/diffmanifests/gitiles/gitiles.py +64 -0
  19. diffmanifests-3.6.2/diffmanifests/logger/__init__.py +0 -0
  20. diffmanifests-3.6.2/diffmanifests/logger/logger.py +42 -0
  21. diffmanifests-3.6.2/diffmanifests/main.py +82 -0
  22. diffmanifests-3.6.2/diffmanifests/printer/__init__.py +0 -0
  23. diffmanifests-3.6.2/diffmanifests/printer/printer.py +104 -0
  24. diffmanifests-3.6.2/diffmanifests/proto/__init__.py +0 -0
  25. diffmanifests-3.6.2/diffmanifests/proto/proto.py +71 -0
  26. diffmanifests-3.6.2/diffmanifests/querier/__init__.py +0 -0
  27. diffmanifests-3.6.2/diffmanifests/querier/querier.py +264 -0
  28. diffmanifests-3.6.2/diffmanifests.egg-info/PKG-INFO +489 -0
  29. diffmanifests-3.6.2/diffmanifests.egg-info/SOURCES.txt +37 -0
  30. diffmanifests-3.6.2/diffmanifests.egg-info/dependency_links.txt +1 -0
  31. diffmanifests-3.6.2/diffmanifests.egg-info/entry_points.txt +2 -0
  32. diffmanifests-3.6.2/diffmanifests.egg-info/not-zip-safe +1 -0
  33. diffmanifests-3.6.2/diffmanifests.egg-info/requires.txt +12 -0
  34. diffmanifests-3.6.2/diffmanifests.egg-info/top_level.txt +1 -0
  35. diffmanifests-3.6.2/requirements.txt +10 -0
  36. diffmanifests-3.6.2/setup.cfg +7 -0
  37. diffmanifests-3.6.2/setup.py +55 -0
  38. diffmanifests-3.6.2/tests/test_main.py +456 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 craftslab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include diffmanifests/config/*.json
2
+ include LICENSE
3
+ include README.md
4
+ include diff.py
5
+ include requirements.txt
@@ -0,0 +1,489 @@
1
+ Metadata-Version: 2.4
2
+ Name: diffmanifests
3
+ Version: 3.6.2
4
+ Summary: Diff Manifests via Gitiles API
5
+ Home-page: https://github.com/craftslab/diffmanifests
6
+ Download-URL: https://github.com/craftslab/diffmanifests/archive/v3.6.2.tar.gz
7
+ Author: Jia Jia
8
+ Author-email: angersax@sina.com
9
+ License: Apache-2.0
10
+ Keywords: diff,manifests,gitiles,api
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: colorama
17
+ Requires-Dist: openpyxl
18
+ Requires-Dist: requests
19
+ Requires-Dist: xmltodict
20
+ Provides-Extra: dev
21
+ Requires-Dist: coverage; extra == "dev"
22
+ Requires-Dist: coveralls; extra == "dev"
23
+ Requires-Dist: pytest; extra == "dev"
24
+ Requires-Dist: setuptools; extra == "dev"
25
+ Requires-Dist: twine; extra == "dev"
26
+ Requires-Dist: wheel; extra == "dev"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: download-url
33
+ Dynamic: home-page
34
+ Dynamic: keywords
35
+ Dynamic: license
36
+ Dynamic: license-file
37
+ Dynamic: provides-extra
38
+ Dynamic: requires-dist
39
+ Dynamic: summary
40
+
41
+ <div align="center">
42
+
43
+ # 📋 diffmanifests
44
+
45
+ **A powerful tool for deep manifest comparison via Gerrit & Gitiles API**
46
+
47
+ [English](README.md) | [įŽ€äŊ“中文](README_cn.md)
48
+
49
+ [![PyPI](https://img.shields.io/pypi/v/diffmanifests.svg?color=brightgreen)](https://pypi.org/project/diffmanifests/)
50
+ [![Coverage Status](https://coveralls.io/repos/github/craftslab/diffmanifests/badge.svg?branch=master)](https://coveralls.io/github/craftslab/diffmanifests?branch=master)
51
+ [![License](https://img.shields.io/github/license/craftslab/diffmanifests.svg?color=brightgreen)](https://github.com/craftslab/diffmanifests/blob/master/LICENSE)
52
+ [![Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
53
+
54
+ </div>
55
+
56
+ ---
57
+
58
+ ## 🌟 Overview
59
+
60
+ **diffmanifests** is a sophisticated CLI tool designed to reveal deeper differences between manifest files by leveraging the Gerrit and Gitiles APIs. It provides comprehensive change tracking, hashtag support, and detailed commit analysis for efficient manifest version management.
61
+
62
+ ### ✨ Key Highlights
63
+
64
+ - 🔍 **Deep Comparison**: Analyze differences between manifest versions with precision
65
+ - đŸˇī¸ **Hashtag Integration**: Full support for Gerrit hashtags and categorization
66
+ - 📊 **Visual Reporting**: Generate detailed JSON reports with comprehensive commit information
67
+ - 🔄 **API-Powered**: Seamlessly integrates with Gerrit and Gitiles REST APIs
68
+ - ⚡ **Easy to Use**: Simple command-line interface with clear configuration
69
+ - 🎨 **VS Code Extension**: [Available for Visual Studio Code](vscode/README.md) with GUI integration
70
+
71
+ ---
72
+
73
+ ## 📋 Table of Contents
74
+
75
+ - [Requirements](#-requirements)
76
+ - [Installation](#-installation)
77
+ - [VS Code Extension](#-vs-code-extension)
78
+ - [Quick Start](#-quick-start)
79
+ - [Configuration](#-configuration)
80
+ - [Features](#-features)
81
+ - [Output Format](#-output-format)
82
+ - [Examples](#-examples)
83
+ - [Development](#-development)
84
+ - [License](#-license)
85
+ - [References](#-references)
86
+
87
+ ---
88
+
89
+ ## 🔧 Requirements
90
+
91
+ - **Python**: >= 3.7
92
+ - **Dependencies**:
93
+ - `colorama` - Terminal color output
94
+ - `openpyxl` - Excel file handling
95
+ - `requests` - HTTP library
96
+ - `xmltodict` - XML parsing
97
+
98
+ ---
99
+
100
+ ## đŸ“Ļ Installation
101
+
102
+ ### Install from PyPI
103
+
104
+ ```bash
105
+ pip install diffmanifests
106
+ ```
107
+
108
+ ### Upgrade to Latest Version
109
+
110
+ ```bash
111
+ pip install diffmanifests --upgrade
112
+ ```
113
+
114
+ ### Install from Source
115
+
116
+ ```bash
117
+ git clone https://github.com/craftslab/diffmanifests.git
118
+ cd diffmanifests
119
+ pip install -e .
120
+ ```
121
+
122
+ ---
123
+
124
+ ## 🎨 VS Code Extension
125
+
126
+ A **Visual Studio Code extension** is available for seamless integration with your IDE!
127
+
128
+ ### Features
129
+
130
+ - đŸ–ąī¸ **GUI Integration**: Compare manifests directly from VS Code
131
+ - 📋 **Sidebar View**: Dedicated sidebar with quick access to all features and settings
132
+ - ⚡ **Quick Actions**: Compare manifests, check environment, and manage settings from sidebar
133
+ - 📂 **Recent Files**: Track and quickly access recently compared files
134
+ - đŸŽ¯ **Context Menu**: Right-click on XML files to compare
135
+ - âš™ī¸ **Auto-Configuration**: Automatic Python environment detection
136
+ - 📊 **Multiple Output Formats**: JSON and Excel support
137
+ - 🔄 **Auto-Installation**: Automatically installs diffmanifests package
138
+ - 🌐 **Cross-Platform**: Works on Windows, Linux (Ubuntu), and macOS
139
+
140
+ ### Quick Links
141
+
142
+ - 📖 **[VS Code Extension Documentation](vscode/README.md)** - Full user guide
143
+ - 🚀 **[Installation Guide](vscode/INSTALL.md)** - Platform-specific instructions
144
+ - ⚡ **[Quick Start](vscode/QUICKSTART.md)** - Get started in minutes
145
+
146
+ ### Installation
147
+
148
+ ```bash
149
+ # Navigate to extension directory
150
+ cd vscode
151
+
152
+ # Install dependencies and build
153
+ npm install
154
+ npm run compile
155
+
156
+ # Package extension
157
+ vsce package
158
+
159
+ # Install in VS Code
160
+ code --install-extension diffmanifests-1.0.0.vsix
161
+ ```
162
+
163
+ For detailed installation instructions, see the [VS Code Extension Guide](vscode/README.md).
164
+
165
+ ---
166
+
167
+ ## 🚀 Quick Start
168
+
169
+ ### Basic Usage
170
+
171
+ ```bash
172
+ diffmanifests \
173
+ --config-file config.json \
174
+ --manifest1-file manifest1.xml \
175
+ --manifest2-file manifest2.xml \
176
+ --output-file output.json
177
+ ```
178
+
179
+ ### Command Line Arguments
180
+
181
+ | Argument | Description | Required |
182
+ |----------|-------------|----------|
183
+ | `--config-file` | Path to configuration JSON file | ✅ |
184
+ | `--manifest1-file` | Path to first manifest XML file (older version) | ✅ |
185
+ | `--manifest2-file` | Path to second manifest XML file (newer version) | ✅ |
186
+ | `--output-file` | Path to output file for results (supports `.json`, `.txt`, `.xlsx` formats) | ✅ |
187
+
188
+ ---
189
+
190
+ ## âš™ī¸ Configuration
191
+
192
+ Configuration parameters can be set in a JSON file. See the [config directory](https://github.com/craftslab/diffmanifests/blob/master/diffmanifests/config) for examples.
193
+
194
+ ### Configuration Structure
195
+
196
+ Create a `config.json` file with the following structure:
197
+
198
+ ```json
199
+ {
200
+ "gerrit": {
201
+ "url": "https://your-gerrit-instance.com",
202
+ "user": "your-username",
203
+ "pass": "your-password-or-token"
204
+ },
205
+ "gitiles": {
206
+ "url": "https://your-gitiles-instance.com",
207
+ "user": "your-username",
208
+ "pass": "your-password-or-token",
209
+ "retry": 3,
210
+ "timeout": 30
211
+ }
212
+ }
213
+ ```
214
+
215
+ ### Configuration Parameters
216
+
217
+ #### Gerrit Settings
218
+
219
+ | Parameter | Type | Description |
220
+ |-----------|------|-------------|
221
+ | `url` | string | Gerrit instance URL |
222
+ | `user` | string | Authentication username |
223
+ | `pass` | string | Authentication password or API token |
224
+
225
+ #### Gitiles Settings
226
+
227
+ | Parameter | Type | Description | Default |
228
+ |-----------|------|-------------|---------|
229
+ | `url` | string | Gitiles instance URL | - |
230
+ | `user` | string | Authentication username | - |
231
+ | `pass` | string | Authentication password or API token | - |
232
+ | `retry` | integer | Number of retry attempts for failed requests | 1 |
233
+ | `timeout` | integer | Request timeout in seconds (-1 for no timeout) | -1 |
234
+
235
+ ---
236
+
237
+ ## đŸŽ¯ Features
238
+
239
+ ### 📊 Manifest Comparison
240
+
241
+ Compare two manifest versions to identify changes between commits. The tool analyzes differences using a three-way comparison model:
242
+
243
+ ![branch](branch.png)
244
+
245
+ **Comparison Logic**:
246
+ - **Diagram A**: Changes from commit 1 to commit 2
247
+ - **Diagram B**: Alternative change paths
248
+ - **Diagram C**: Merge scenarios
249
+
250
+ ### đŸˇī¸ Hashtag Support
251
+
252
+ Comprehensive support for Gerrit hashtags through REST API v3.12.1, enabling better change tracking and categorization.
253
+
254
+ #### Key Benefits
255
+
256
+ ✅ **Automatic hashtag extraction** from Gerrit changes
257
+ ✅ **Enhanced categorization** and filtering capabilities
258
+ ✅ **Seamless Gerrit workflow** integration
259
+ ✅ **Graceful fallback** for changes without hashtags
260
+
261
+ #### Use Cases
262
+
263
+ | Hashtags | Use Case |
264
+ |----------|----------|
265
+ | `["feature", "ui", "enhancement"]` | New UI features |
266
+ | `["bugfix", "critical"]` | Critical bug fixes |
267
+ | `["security", "cve"]` | Security-related changes |
268
+ | `["refactor", "cleanup"]` | Code refactoring |
269
+ | `[]` | Changes without hashtags |
270
+
271
+ ---
272
+
273
+ ## 📄 Output Format
274
+
275
+ The tool supports three output formats determined by the file extension:
276
+
277
+ - **`.json`** - Structured JSON format for programmatic processing
278
+ - **`.txt`** - Human-readable plain text format
279
+ - **`.xlsx`** - Excel spreadsheet format for analysis and reporting
280
+
281
+ ### JSON Output Structure
282
+
283
+ ```json
284
+ {
285
+ "author": "Developer Name <dev@example.com>",
286
+ "branch": "master",
287
+ "change": "https://gerrit.example.com/c/12345",
288
+ "commit": "abc123def456789...",
289
+ "committer": "Developer Name <dev@example.com>",
290
+ "date": "2025-08-20 12:00:00 +0000",
291
+ "diff": "ADD COMMIT",
292
+ "hashtags": ["security", "cve", "bugfix"],
293
+ "message": "Fix security vulnerability CVE-2025-1234",
294
+ "repo": "platform/frameworks/base",
295
+ "topic": "security-fix",
296
+ "url": "https://android.googlesource.com/platform/frameworks/base/+/abc123def456789"
297
+ }
298
+ ```
299
+
300
+ ### Output Fields
301
+
302
+ | Field | Type | Description |
303
+ |-------|------|-------------|
304
+ | `author` | string | Original commit author |
305
+ | `branch` | string | Target branch name |
306
+ | `change` | string | Gerrit change URL |
307
+ | `commit` | string | Git commit SHA |
308
+ | `committer` | string | Person who committed the change |
309
+ | `date` | string | Commit timestamp |
310
+ | `diff` | string | Type of change (ADD COMMIT, REMOVE COMMIT, etc.) |
311
+ | `hashtags` | array | List of associated hashtags |
312
+ | `message` | string | Commit message |
313
+ | `repo` | string | Repository path |
314
+ | `topic` | string | Gerrit topic name |
315
+ | `url` | string | Gitiles commit URL |
316
+
317
+ ---
318
+
319
+ ## 💡 Examples
320
+
321
+ ### Example 1: Basic Comparison (JSON Output)
322
+
323
+ ```bash
324
+ diffmanifests \
325
+ --config-file ./config/config.json \
326
+ --manifest1-file ./data/android-11.xml \
327
+ --manifest2-file ./data/android-12.xml \
328
+ --output-file ./results/diff-output.json
329
+ ```
330
+
331
+ **Alternative Output Formats:**
332
+
333
+ ```bash
334
+ # Plain text format
335
+ diffmanifests \
336
+ --config-file ./config/config.json \
337
+ --manifest1-file ./data/android-11.xml \
338
+ --manifest2-file ./data/android-12.xml \
339
+ --output-file ./results/diff-output.txt
340
+
341
+ # Excel format
342
+ diffmanifests \
343
+ --config-file ./config/config.json \
344
+ --manifest1-file ./data/android-11.xml \
345
+ --manifest2-file ./data/android-12.xml \
346
+ --output-file ./results/diff-output.xlsx
347
+ ```
348
+
349
+ ### Example 2: With Custom Configuration
350
+
351
+ ```bash
352
+ # config.json
353
+ {
354
+ "gerrit": {
355
+ "url": "https://android-review.googlesource.com",
356
+ "user": "developer",
357
+ "pass": "your-token"
358
+ },
359
+ "gitiles": {
360
+ "url": "https://android.googlesource.com",
361
+ "user": "developer",
362
+ "pass": "your-token",
363
+ "retry": 5,
364
+ "timeout": 60
365
+ }
366
+ }
367
+
368
+ # Run comparison
369
+ diffmanifests \
370
+ --config-file config.json \
371
+ --manifest1-file old-manifest.xml \
372
+ --manifest2-file new-manifest.xml \
373
+ --output-file changes.json
374
+ ```
375
+
376
+ ### Example 3: Analyzing Output
377
+
378
+ ```python
379
+ import json
380
+
381
+ # Load the output
382
+ with open('output.json', 'r') as f:
383
+ changes = json.load(f)
384
+
385
+ # Filter security-related changes
386
+ security_changes = [
387
+ c for c in changes
388
+ if 'security' in c.get('hashtags', []) or 'cve' in c.get('hashtags', [])
389
+ ]
390
+
391
+ print(f"Found {len(security_changes)} security-related changes")
392
+ ```
393
+
394
+ ---
395
+
396
+ ## đŸ› ī¸ Development
397
+
398
+ ### Setting Up Development Environment
399
+
400
+ ```bash
401
+ # Clone the repository
402
+ git clone https://github.com/craftslab/diffmanifests.git
403
+ cd diffmanifests
404
+
405
+ # Install development dependencies
406
+ pip install -e .[dev]
407
+
408
+ # Run tests
409
+ pytest tests/
410
+
411
+ # Run tests with coverage
412
+ coverage run -m pytest tests/
413
+ coverage report
414
+ ```
415
+
416
+ ### Running Tests
417
+
418
+ ```bash
419
+ # Run all tests
420
+ pytest
421
+
422
+ # Run specific test module
423
+ pytest tests/differ/test_differ.py
424
+
425
+ # Run with verbose output
426
+ pytest -v
427
+
428
+ # Run with coverage report
429
+ pytest --cov=diffmanifests tests/
430
+ ```
431
+
432
+ ### Project Scripts
433
+
434
+ Located in the `script/` directory:
435
+
436
+ - `clean.sh` - Clean build artifacts and cache files
437
+ - `dist.sh` - Build distribution packages
438
+ - `install.sh` - Install the package locally
439
+ - `run.sh` - Run the tool with test data
440
+ - `test.sh` - Execute test suite
441
+
442
+ ---
443
+
444
+ ## 📜 License
445
+
446
+ This project is licensed under the **Apache License 2.0**.
447
+
448
+ See [LICENSE](https://github.com/craftslab/diffmanifests/blob/master/LICENSE) for full details.
449
+
450
+ ---
451
+
452
+ ## 📚 References
453
+
454
+ - [Gerrit REST API Documentation](https://gerrit-documentation.storage.googleapis.com/Documentation/3.12.1/rest-api.html)
455
+ - [Gerrit ChangeInfo Entity](https://gerrit-documentation.storage.googleapis.com/Documentation/3.12.1/rest-api-changes.html#change-info)
456
+ - [git-repo/subcmds/diffmanifests](https://gerrit.googlesource.com/git-repo/+/master/subcmds/diffmanifests.py)
457
+ - [Gitiles API Documentation](https://gerrit.googlesource.com/gitiles/+/master/Documentation/design.md)
458
+
459
+ ---
460
+
461
+ ## 🤝 Contributing
462
+
463
+ Contributions are welcome! Please feel free to submit a Pull Request.
464
+
465
+ ### How to Contribute
466
+
467
+ 1. Fork the repository
468
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
469
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
470
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
471
+ 5. Open a Pull Request
472
+
473
+ ---
474
+
475
+ ## 📞 Support
476
+
477
+ - **Issues**: [GitHub Issues](https://github.com/craftslab/diffmanifests/issues)
478
+ - **Email**: angersax@sina.com
479
+ - **PyPI**: [diffmanifests on PyPI](https://pypi.org/project/diffmanifests/)
480
+
481
+ ---
482
+
483
+ <div align="center">
484
+
485
+ **Made with â¤ī¸ by [craftslab](https://github.com/craftslab)**
486
+
487
+ ⭐ Star this repository if you find it helpful!
488
+
489
+ </div>