git commands using the xpath representation to select content blocks of code
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
extras
libgitxp
test
.gitignore
LICENSE.txt
MANIFEST
README.rst
setup.py

README.rst

gitxp

gitxp (xp for xpath) is a set of git commands to show/add/delete content blocks of files by using the xpath representation

Code is available on GitHub on the following address: https://github.com/sickless/gitxp

Code is currently tested on 2.6.8 and 2.7.3

Examples

git addxp

test $ git show HEAD:test.py
class Foo:
    def __init__(self):
        pass

    def bar(self):
        return None

    def bar2(self):
        return "bar2"

test $ git di
diff --git a/test.py b/test.py
index d3d67fb..1b845d7 100644
--- a/test.py
+++ b/test.py
@@ -6,5 +6,8 @@ class Foo:
         return None

     def bar2(self):
+        """Bla bla"""
         return "bar2"

+    def bar3(self):
+        return "bar3"
test $ git addxp test.py/Foo/bar3
test $ git di --cached
diff --git a/test.py b/test.py
index d3d67fb..aa820d8 100644
--- a/test.py
+++ b/test.py
@@ -8,3 +8,5 @@ class Foo:
     def bar2(self):
         return "bar2"

+    def bar3(self):
+        return "bar3"
test $ git di
diff --git a/test.py b/test.py
index aa820d8..1b845d7 100644
--- a/test.py
+++ b/test.py
@@ -6,6 +6,7 @@ class Foo:
         return None

     def bar2(self):
+        """Bla bla"""
         return "bar2"

     def bar3(self):
test $ git addxp test.py/Foo/bar2
test $ git di --cached
diff --git a/test.py b/test.py
index d3d67fb..1b845d7 100644
--- a/test.py
+++ b/test.py
@@ -6,5 +6,8 @@ class Foo:
         return None

     def bar2(self):
+        """Bla bla"""
         return "bar2"

+    def bar3(self):
+        return "bar3"
test $

git delxp

test $ cat test.py
class Foo:
    def __init__(self):
        pass

    def bar(self):
        return None

    def bar2(self):
        return "bar2"

test $ git delxp test.py/Foo/bar
test $ cat test.py
class Foo:
    def __init__(self):
        pass

    def bar2(self):
        return "bar2"

test $ git di --cached
diff --git a/test.py b/test.py
index d3d67fb..4f6a66f 100644
--- a/test.py
+++ b/test.py
@@ -2,8 +2,6 @@ class Foo:
     def __init__(self):
         pass

-    def bar(self):
-        return None

     def bar2(self):
         return "bar2"
test $ git delxp test.py/Foo/bar2
test $ cat test.py
class Foo:
    def __init__(self):
        pass

test $ git di --cached
diff --git a/test.py b/test.py
index d3d67fb..52105ff 100644
--- a/test.py
+++ b/test.py
@@ -2,9 +2,5 @@ class Foo:
     def __init__(self):
         pass

-    def bar(self):
-        return None

-    def bar2(self):
-        return "bar2"

test $

git resetxp & git checkoutxp

test $ git di --cached
diff --git a/test.py b/test.py
index d3d67fb..03d02b5 100644
--- a/test.py
+++ b/test.py
@@ -2,9 +2,6 @@ class Foo:
     def __init__(self):
         pass

-    def bar(self):
-        return None
-
     def bar2(self):
         return "bar2"

test $ git di
test $ git resetxp test.py/Foo/bar
test $ git di --cached
test $ git di
diff --git a/test.py b/test.py
index d3d67fb..03d02b5 100644
--- a/test.py
+++ b/test.py
@@ -2,9 +2,6 @@ class Foo:
     def __init__(self):
         pass

-    def bar(self):
-        return None
-
     def bar2(self):
         return "bar2"

test $ git checkoutxp  test.py/Foo/bar
test $ git di --cached
test $ git di
test $

Extra

The project is hosted on: http://gitxp.sickless.net

The project is hosted by http://www.sickless.net