Add an option to .stgitrc which causes the object repository to be repacked
after every "stg pull" operation. Especially on NFS, this improves overall
performance considerably. The only downside is that the first time it runs
it will take a very long time if the repository hasn't been packed
recently.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
# Leave the original files in the working tree in case of a merge conflict
#keeporig: yes
# Leave the original files in the working tree in case of a merge conflict
#keeporig: yes
+# Optimize (repack) the object store after every pull
+#keepoptimized: yes
+
# Extensions for the files involved in a three-way merge (ancestor,
# current, patched)
#extensions: .ancestor .current .patched
# Extensions for the files involved in a three-way merge (ancestor,
# current, patched)
#extensions: .ancestor .current .patched
if not options.nopush:
push_patches(applied, options.merged)
if not options.nopush:
push_patches(applied, options.merged)
+ # maybe tidy up
+ repack = config.get('stgit', 'keepoptimized')
+ if repack == 'yes':
+ git.repack()
+
'diff3 -L current -L ancestor -L patched -m -E ' \
'"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"')
config.set('stgit', 'keeporig', 'yes')
'diff3 -L current -L ancestor -L patched -m -E ' \
'"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"')
config.set('stgit', 'keeporig', 'yes')
+config.set('stgit', 'keepoptimized', 'no')
config.set('stgit', 'extensions', '.ancestor .current .patched')
# Read the configuration files (if any) and override the default settings
config.set('stgit', 'extensions', '.ancestor .current .patched')
# Read the configuration files (if any) and override the default settings
if __run(config.get('stgit', 'pullcmd'), args) != 0:
raise GitException, 'Failed "git-pull %s"' % repository
if __run(config.get('stgit', 'pullcmd'), args) != 0:
raise GitException, 'Failed "git-pull %s"' % repository
+def repack():
+ """Repack all objects into a single pack
+ """
+ __run('git-repack -a -d -f')
+
def apply_patch(filename = None, diff = None, base = None,
fail_dump = True):
"""Apply a patch onto the current or given index. There must not
def apply_patch(filename = None, diff = None, base = None,
fail_dump = True):
"""Apply a patch onto the current or given index. There must not