Package: rrgit
# rrgitrrgitis a command line utility to aid in the process of editing RepRapFirmware / Duet controller configuration files over a network connection. It is designed to be as git-like as possible in order to provide a familiar interface. Of course, however, the RepRapFirmware interface is far less extensive compared to git, sorrgithandles just the basics. It will allow you to clone, pull, push, and diff between the controller and local copies of the files.## InstallationThe simplest way to install is:pip install rrgitAlternatively:` git clonehttps://github.com/adammhaile/rrgit.gitcd rrgit python setup.py install `This will install the necessary packages and make available therrgitandrrg(simply an alias) commands.## UsageThe following base commands are available. With the exception ofcloneall commands must be called from the root of therrgitcloned directory.### Clonerrgit clone HOSTNAME [DIRECTORY]Clone the config fromHOSTNAMEtoDIRECTORYThe intent is to userrgitmuch like you wouldgitby starting from an existing set of configuration files, already on a remote machine.HOSTNAMEcan be an IP address or local network hostname and can include http/https but it is not required. The base network address is the important item here.DIRECTORYis optional if you simply want to clone down to the current working directy. Note that this is only an option if the current directory is completely empty. Otherwise provide an absolute or relative directory path. That directory need not exist as it will be created.One cloned, the directory specified will be populated with all non-ignored (see more below on.rrgitignore) files from the specified remote machine.Note that RepRapFirmware has very specific directories (such assys,gcodes, andmacros) that it uses. Anything other than the official directory names (which are pulled from the remote system at connection time) will be ignored. Therefore you could add any other files or directories into yourrrgitdirectory and they will be ignored byrrgit.### Statusrrgit statusQuery both the remote machine and the local directory to automatically discover and report on any differences between the two. Note that, unlikegit, this is only able to detect if files have a different timestamp or are a different size. The report will be broken down into the following categories:Remote only: files that only exist on remoteRemote newer: files that are newer on remote than localLocal only: files that only exist on localLocal newer: files that are newer on local than remoteDifferent size: files that have the same timestamp but differ in size. This is extremely unlikely. Typically all change detection is timestamp based.### Pullrrgit pull [–force/-f] [–yes/-y] [file_patterns …]Pulls remote files to local. Must be run from the root of therrgitclone directory. With no options specified, it will only pull remote files that differ from local. Note that since there is no concept of history or commits as with actual git, this acts a little different. If you have made changes on both remote and local and then choose to pull, it will overwrite local with remote. There is no automatic conflict resolution.However, it will ask you to confirm the overwrite if the local files are newer than remote or if they only exist on local (in which case they would be deleted locally). You can use the–yesoption to suppress this confirmation request.Using the–forceoption is effectively like re-cloning the configuration files. It will pull down all remote files to local, regardless of local state. This includes deletions locally.Finally, you can optionally provide any number of relative file paths or [git pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) style file patterns. It will then only act upon files that match those patterns.Be aware that on Linux or Mac systems bash will provide file path expansion on any wildcard file patterns provided. This is fine when acting upon local files but with pull, the pattern matching is purely for remote files. If you let bash do the path expansion for you it willonlymatch files that are also local. To get around this, it is recommended to wrap all file patterns in single quotes like this:rrgit pull ‘sys/*.g’Which would pull all.gfiles from thesysdirectory on the remote system.There is no need to use the single quote wrapping on Windows systems asrrgitwill always handle wildcard file patterns internally.### Pushrrgit push [–force/-f] [–yes/-y] [file_patterns …]Thepushcommand functions identically to thepullcommand, just in the other direction, local to remote.### Diffrrgit diff [file_patterns …]Show a diff report of all files that do not match between remote and local, if called with no file patterns. It will, by default, diff any files that would be shown in thestatuscommand report.If file patterns are provided (which follow the same rules as described in thepullcommand) it will only show diffs for those files specified.It will always show the diff output in a format with remote as file A and local as file B.### Watchrrgit watchNOTE:Currently thewatchcommand is disabled under Windows. I cannot get thewatchdogpython package to work reliably for Windows at this time.Watch the localrrgitdirectory tree and automatically push all changes to the remote machine. This is useful if you will be making many changes and runnings tests after each. Instead of running thepushcommand each time the files will be pushed as soon as they are saved locally.##.rrgitignorefilerrgitwill automatically create a file called.rrgitignorein the root of the cloned directory which can be used to filter out what is pulled and pushed. The format is identical to the [.gitignorefile format](https://git-scm.com/docs/gitignore).By default this file includes the following lines:` /www/ /gcodes/ /scans/ /menu/ *.uf2 *.bin `wwwis the location of the DuetWebControl files and are unlikely that you will ever need to pull/push changes to those files.gcodesis the location of uploaded job files. These files can be quite large.scansis used for depth probe scanning in RepRapFirmware which is infrequently used.menuprovides configuration files for older-style monochrome LCD displays.*.uf2and*.binfiles are the binary firmware files for your controller and are often large files which really don’t need to be synced in most cases.These are simply defaults which make the initial clone fast and likely to include everything most people will want. If you would like these files, simple edit the file to remove those lines and callrrg pullto pull down the files that were filtered out during the itial clone.## Usage with gitThe entire intent ofrrgitis to use it as a companion togititself to provide backups and history for your RepRapFirmware / Duet configs. You can do this in a couple ways:Create an empty remote git repo, clone it down locally, and then userrgit cloneto pull the configuration files into the local git repo directory.Userrgit cloneto create a localrrgitdirectory, then usegit initandgit remote addinside of that directory to associate it with a remote git repo.Once one of those options is done, you will be able to use all your normaladd,commit,push, etc. commands withgitto backup your configuration files. You basically will always want to use the opposite pull/push command inrrgitthat you used withgit. If you pull from the git back, userrgit pushto send that update to the remote machine, and vice versa.