git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/7] Add notify and warn to util.py

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Oct 29, 2009, 06:40 UTC
Message-ID
<1256798426-21816-4-git-send-email-srabbelier@gmail.com>
In-Reply-To
<1256798426-21816-1-git-send-email-srabbelier@gmail.com>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
	These turned out to be quite useful for my git-remote-hg, if
	desired this patch can move to later in the series, but I
	figured that it might be useful to someone else already.
 git_remote_helpers/util.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/git_remote_helpers/util.py b/git_remote_helpers/util.py
index 7d6adb4..d3ca487 100644
--- a/git_remote_helpers/util.py
+++ b/git_remote_helpers/util.py
@@ -15,6 +15,10 @@ import subprocess
 # Whether or not to show debug messages
 DEBUG = False
 
+def notify(msg, *args):
+	"""Print a message to stderr."""
+	print >> sys.stderr, msg % args
+
 def debug (msg, *args):
     """Print a debug message to stderr when DEBUG is enabled."""
     if DEBUG:
@@ -24,6 +28,10 @@ def error (msg, *args):
     """Print an error message to stderr."""
     print >> sys.stderr, "ERROR:", msg % args
 
+def warn(msg, *args):
+	"""Print a warning message to stderr."""
+	print >> sys.stderr, "warning:", msg % args
+
 def die (msg, *args):
     """Print as error message to stderr and exit the program."""
     error(msg, *args)
-- 
1.6.5.2.291.gf76a3
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 3 of 17 in “Prepare git-remote-helpers series for hg support”
  1. 0/7 Prepare git-remote-helpers series for hg supportSverre Rabbelier, Oct 29, 2009
  2. 2/7 .gitignore: add git-remote-cvsSverre Rabbelier, Oct 29, 2009
  3. 3/7 Add notify and warn to util.pySverre Rabbelier, Oct 29, 2009
  4. 4/7 Allow both url and foreign vcs in remote configSverre Rabbelier, Oct 29, 2009
  5. 5/7 Finally make remote helper support usefulSverre Rabbelier, Oct 29, 2009
  6. 6/7 When updating refs after a fetch, resolve the symref if setSverre Rabbelier, Oct 29, 2009
  7. 7/7 Factor ref updating out of fetch_with_importSverre Rabbelier, Oct 29, 2009
  8. Shawn O. PearceOct 29, 2009
  9. Sverre RabbelierOct 29, 2009
  10. Shawn O. PearceOct 29, 2009
  11. Sverre RabbelierOct 29, 2009
  12. Daniel BarkalowOct 29, 2009
  13. Sverre RabbelierOct 29, 2009
  14. Daniel BarkalowOct 29, 2009
  15. Sverre RabbelierOct 29, 2009
  16. Johan HerlandOct 29, 2009
  17. Sverre RabbelierOct 29, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.