Giter Site home page Giter Site logo

kgps's People

Contributors

krnowak avatar

Watchers

 avatar  avatar  avatar

kgps's Issues

Better documentation

Of course.

Information about file format, clauses, workflows and examples. Probably write a short reason why I wrote this tool.

Fix issues in summary statistics

Follow up from #9:

  • update heuristics for changed line for binary diff
    • we can filter the maybe relevant lines based on whether the binary file was created or deleted (so the stats line will say that the file was changed from or to zero bytes
    • maybe expand the truncations if we can do it:
 foo/bar/too/long/a | …
 .../too/long/waaaaaaaaay/tooooooo/loooooong | …
 foo/bar/too/long/x | …

can be expanded to:

 foo/bar/too/long/a | …
 foo/bar/too/long/waaaaaaaaay/tooooooo/loooooong | …
 foo/bar/too/long/x | …
  • scale the number of pluses and minuses properly (currently they are not scaled at all, if 1000 lines were added in a file, it will print a 1000 of +)
  • add tests:
    • long paths
    • long filename
      • need to see what git does if the filename is 60 chars long
    • scaling based on file with most changes
  • make stat render context the certain column widths once and remember them
  • likely the file stat base should be doing the drawing to avoid circular dependency between file stat base and stat render context (harmless, but still icky)

Generate proper listing and summary in git patches

It's about generating stuff like:

 test.sh                               |  1 +
 tests/basic/expected/0001-Add-b.patch | 16 ++++++++++++++++
 tests/basic/expected/0002-Add-c.patch | 17 +++++++++++++++++
 tests/basic/expected/ADD_B.patch      |  5 -----
 tests/basic/expected/ADD_C.patch      |  6 ------
 tests/basic/expected/patches.list     |  8 --------
 6 files changed, 34 insertions(+), 19 deletions(-)
 create mode 100644 tests/basic/expected/0001-Add-b.patch
 create mode 100644 tests/basic/expected/0002-Add-c.patch
 delete mode 100644 tests/basic/expected/ADD_B.patch
 delete mode 100644 tests/basic/expected/ADD_C.patch
 delete mode 100644 tests/basic/expected/patches.list

For first iteration I will be happy if 16 ++++++++++++++++ looks like 16 +.

Add an overlap clause to be able to generate overlapping patches

Currently the generated patches do not overlap.

# OVERLAP
# OUTCOME
 c1
 c2
 c3
+1
+2
 a1
 a2
 a3
# SECTION: FOO
 c1
 c2
-c3
-a1
 a2
 a3
# SECTION: BAR
 c1
 c2
+c3
+1
+2
+a1
 a2
 a3
# END_OVERLAP

Problems:

  • The overlap will break if I change the order of sections in listing.

Maybe handle patches with git patch being dumped in the commit message

Splitter will likely parse the commit message as a patch, instead of ignoring it. I guess I would need to find the first empty line to know where headers end and commit message starts. To find where commit message ends, I would need to find a first empty line starting from the end of the file. That empty line would mean that the listing ends and diffs start. Going back further until a line with --- would tell me where the commit message ends.

Maybe this can be done without reading the file from the end, but simply to find all empty lines and all lines being ---. The last empty line is a border between the listing and diffs, and the preceding --- line would be an end of commit message.

Handle unicode in patch subject

Using unicode in subject results in additional headers being generated and subject being escaped.

Not sure if using unicode in commit message or in diffs also causes generation of additional headers.

Handle renames

---
 bar => foo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename bar => foo (90%)

diff --git a/bar b/foo
similarity index 90%
rename from bar
rename to foo
index 8e43dd5..bd3d4e8 100644
--- a/bar
+++ b/foo
@@ -2,7 +2,7 @@ aaa
 aaa
 aaa
 aaa
-aaa
+bbb
 aaa
 aaa
 aaa
-- 

or

---
 bar => foo | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename bar => foo (100%)

diff --git a/bar b/foo
similarity index 100%
rename from bar
rename to foo
-- 

Problem - can't deduce similarity index if we split the changes in the file between sections.
Also would be nice to be able to split the "rename with changes" into either "rename then change" or "change then rename".

Programming bug

This patch produces an error Can't call method "get_sigil" on an undefined value at ../../Kgps/TextDiff.pm line 810, <GEN0> line 55.

From fecc6385233b5dd3acd41ed0bcdc01b61499212b Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <[email protected]>
Date: Fri, 11 May 2018 22:47:53 +0200
Subject: [PATCH] foo

---
# SECTION: FIRST
#  SUBJECT: FIRST
# SECTION: SECOND
#  SUBJECT: SECOND
# SECTION: THIRD
#  SUBJECT: THIRD
# SECTION: FOURTH
#  SUBJECT: FOURTH
 a | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/a b/a
index e69de29..d4a8d5c 100644
--- a/a
+++ b/a
@@ -0,0 +1,21 @@
# SECTION: SECOND
+1
+2
+3
# SECTION: FOURTH
+43
+4
+54
+56
# SECTION: FIRST
+456
+
+5768
# SECTION: THIRD
+68
+
# SECTION: FOURTH
+34
+3
+3
# SECTION: FIRST
+
# SECTION: FOURTH
+4
+6
# SECTION: SECOND
+7
# SECTION: THIRD
+87
+
-- 
2.17.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.